forked from TanStack/router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): retrofit all e2e sandboxes tests to use open ports (TanSta…
- Loading branch information
1 parent
275125e
commit 106d360
Showing
66 changed files
with
1,416 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
...ased-code-splitting/tests/preload.test.ts → ...ased-code-splitting/tests/preload.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
e2e/react-router/basic-file-based-code-splitting/tests/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { exec } from 'node:child_process' | ||
import { test as baseTest } from '@playwright/test' | ||
import { getRandomPort } from 'get-port-please' | ||
import terminate from 'terminate/promise' | ||
import waitPort from 'wait-port' | ||
|
||
async function _setup(): Promise<{ | ||
PORT: number | ||
PID: number | ||
ADDR: string | ||
killProcess: () => Promise<void> | ||
}> { | ||
const PORT = await getRandomPort() | ||
const ADDR = `http://localhost:${PORT}` | ||
|
||
const childProcess = exec( | ||
`VITE_SERVER_PORT=${PORT} pnpm run dev:e2e --port ${PORT}`, | ||
) | ||
childProcess.stdout?.on('data', (data) => { | ||
const message = data.toString() | ||
console.log('Stdout:', message) | ||
}) | ||
await waitPort({ port: PORT }) | ||
|
||
const PID = childProcess.pid! | ||
const killProcess = () => terminate(PID) | ||
|
||
return { PORT, PID, ADDR, killProcess } | ||
} | ||
|
||
type SetupApp = Awaited<ReturnType<typeof _setup>> | ||
|
||
export const test = baseTest.extend<{ setupApp: SetupApp }>({ | ||
// don't know why playwright wants this fist argument to be destructured | ||
// eslint-disable-next-line unused-imports/no-unused-vars | ||
setupApp: async ({ page }, use) => { | ||
const setup = await _setup() | ||
await use(setup) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { exec } from 'node:child_process' | ||
import { test as baseTest } from '@playwright/test' | ||
import { getRandomPort } from 'get-port-please' | ||
import terminate from 'terminate/promise' | ||
import waitPort from 'wait-port' | ||
|
||
async function _setup(): Promise<{ | ||
PORT: number | ||
PID: number | ||
ADDR: string | ||
killProcess: () => Promise<void> | ||
}> { | ||
const PORT = await getRandomPort() | ||
const ADDR = `http://localhost:${PORT}` | ||
|
||
const childProcess = exec( | ||
`VITE_SERVER_PORT=${PORT} pnpm run dev:e2e --port ${PORT}`, | ||
) | ||
childProcess.stdout?.on('data', (data) => { | ||
const message = data.toString() | ||
console.log('Stdout:', message) | ||
}) | ||
await waitPort({ port: PORT }) | ||
|
||
const PID = childProcess.pid! | ||
const killProcess = () => terminate(PID) | ||
|
||
return { PORT, PID, ADDR, killProcess } | ||
} | ||
|
||
type SetupApp = Awaited<ReturnType<typeof _setup>> | ||
|
||
export const test = baseTest.extend<{ setupApp: SetupApp }>({ | ||
// don't know why playwright wants this fist argument to be destructured | ||
// eslint-disable-next-line unused-imports/no-unused-vars | ||
setupApp: async ({ page }, use) => { | ||
const setup = await _setup() | ||
await use(setup) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.