Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/react-router/basic-esbuild-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "esbuild src/main.tsx --serve=3090 --bundle --outfile=dist/main.js --watch --servedir=.",
"dev": "esbuild src/main.tsx --serve=5601 --bundle --outfile=dist/main.js --watch --servedir=.",
"build": "esbuild src/main.tsx --bundle --outfile=dist/main.js",
"serve": "esbuild src/main.tsx --bundle --outfile=dist/main.js --servedir=.",
"start": "dev",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { defineConfig, devices } from '@playwright/test'

const PORT = 5601
const baseURL = `http://localhost:${PORT}`
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
workers: 1,

reporter: [['line']],

use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:3090/',
baseURL,
},

webServer: {
command: 'pnpm run dev',
url: 'http://localhost:3090',
command: `pnpm run dev`,
url: baseURL,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.3.4",
"get-port-please": "^3.1.2",
"terminate": "^2.8.0",
"vite": "^5.4.11",
"wait-port": "^1.1.0"
"vite": "^6.0.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { defineConfig, devices } from '@playwright/test'

const PORT = 5603
const baseURL = `http://localhost:${PORT}`
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
workers: 1,

reporter: [['line']],

// use: {
// /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3001/',
// },
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL,
},

// webServer: {
// command: 'pnpm run dev',
// url: 'http://localhost:3001',
// reuseExistingServer: !process.env.CI,
// stdout: 'pipe',
// },
webServer: {
command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm start --port ${PORT}`,
url: baseURL,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
},

projects: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { expect } from '@playwright/test'
import { test } from './utils'
import { expect, test } from '@playwright/test'

test.beforeEach(async ({ page, setupApp }) => {
await page.goto(setupApp.ADDR + '/')
})

test.afterEach(async ({ setupApp }) => {
await setupApp.killProcess()
test.beforeEach(async ({ page }) => {
await page.goto('/')
})

test('Navigating to a post page', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { expect } from '@playwright/test'
import { test } from './utils'
import { expect, test } from '@playwright/test'

test.beforeEach(async ({ page, setupApp }) => {
await page.goto(setupApp.ADDR + '/')
})

test.afterEach(async ({ setupApp }) => {
await setupApp.killProcess()
test.beforeEach(async ({ page }) => {
await page.goto('/')
})

test('hovering a link with preload=intent to a route without a loader should preload route', async ({
Expand Down
40 changes: 0 additions & 40 deletions e2e/react-router/basic-file-based-code-splitting/tests/utils.ts

This file was deleted.

5 changes: 1 addition & 4 deletions e2e/react-router/basic-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.3.4",
"get-port-please": "^3.1.2",
"terminate": "^2.8.0",
"vite": "^5.4.11",
"wait-port": "^1.1.0"
"vite": "^6.0.3"
}
}
23 changes: 13 additions & 10 deletions e2e/react-router/basic-file-based/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { defineConfig, devices } from '@playwright/test'

const PORT = 5602
const baseURL = `http://localhost:${PORT}`
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
workers: 1,

reporter: [['line']],

// use: {
// /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3001/',
// },
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL,
},

// webServer: {
// command: 'pnpm run dev',
// url: 'http://localhost:3001',
// reuseExistingServer: !process.env.CI,
// stdout: 'pipe',
// },
webServer: {
command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm start --port ${PORT}`,
url: baseURL,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
},

projects: [
{
Expand Down
33 changes: 11 additions & 22 deletions e2e/react-router/basic-file-based/tests/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { expect } from '@playwright/test'
import { test } from './utils'
import { expect, test } from '@playwright/test'
import type { Page } from '@playwright/test'

test.beforeEach(async ({ page, setupApp }) => {
const { ADDR } = setupApp
await page.goto(ADDR + '/')
})

test.afterEach(async ({ setupApp }) => {
await setupApp.killProcess()
test.beforeEach(async ({ page }) => {
await page.goto('/')
})

test('Navigating to a post page', async ({ page }) => {
Expand Down Expand Up @@ -77,10 +71,9 @@ testCases.forEach(({ description, testId }) => {
})
})

test('navigating to an unnested route', async ({ page, setupApp }) => {
const { ADDR } = setupApp
test('navigating to an unnested route', async ({ page }) => {
const postId = 'hello-world'
page.goto(ADDR + `/posts/${postId}/edit`)
page.goto(`/posts/${postId}/edit`)
await expect(page.getByTestId('params-via-hook')).toContainText(postId)
await expect(page.getByTestId('params-via-route-hook')).toContainText(postId)
await expect(page.getByTestId('params-via-route-api')).toContainText(postId)
Expand All @@ -92,12 +85,8 @@ async function getRenderCount(page: Page) {
)
return renderCount
}
async function structuralSharingTest(
page: Page,
baseUrl: string,
enabled: boolean,
) {
page.goto(baseUrl + `/structural-sharing/${enabled}/?foo=f1&bar=b1`)
async function structuralSharingTest(page: Page, enabled: boolean) {
page.goto(`/structural-sharing/${enabled}/?foo=f1&bar=b1`)
await expect(page.getByTestId('enabled')).toHaveText(JSON.stringify(enabled))

async function checkSearch({ foo, bar }: { foo: string; bar: string }) {
Expand All @@ -117,13 +106,13 @@ async function structuralSharingTest(
await checkSearch({ bar: 'b2', foo: 'f2' })
}

test('structural sharing disabled', async ({ page, setupApp }) => {
await structuralSharingTest(page, setupApp.ADDR, false)
test('structural sharing disabled', async ({ page }) => {
await structuralSharingTest(page, false)
expect(await getRenderCount(page)).toBeGreaterThan(2)
})

test('structural sharing enabled', async ({ page, setupApp }) => {
await structuralSharingTest(page, setupApp.ADDR, true)
test('structural sharing enabled', async ({ page }) => {
await structuralSharingTest(page, true)
expect(await getRenderCount(page)).toBe(2)
await page.getByTestId('link').click()
expect(await getRenderCount(page)).toBe(2)
Expand Down
40 changes: 0 additions & 40 deletions e2e/react-router/basic-file-based/tests/utils.ts

This file was deleted.

5 changes: 1 addition & 4 deletions e2e/react-router/basic-react-query-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.3.4",
"get-port-please": "^3.1.2",
"terminate": "^2.8.0",
"vite": "^5.4.11",
"wait-port": "^1.1.0"
"vite": "^6.0.3"
}
}
23 changes: 13 additions & 10 deletions e2e/react-router/basic-react-query-file-based/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { defineConfig, devices } from '@playwright/test'

const PORT = 5605
const baseURL = `http://localhost:${PORT}`
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
workers: 1,

reporter: [['line']],

// use: {
// /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3001/',
// },
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL,
},

// webServer: {
// command: 'pnpm run dev',
// url: 'http://localhost:3001',
// reuseExistingServer: !process.env.CI,
// stdout: 'pipe',
// },
webServer: {
command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm start --port ${PORT}`,
url: baseURL,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
},

projects: [
{
Expand Down
11 changes: 3 additions & 8 deletions e2e/react-router/basic-react-query-file-based/tests/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { expect } from '@playwright/test'
import { test } from './utils'
import { expect, test } from '@playwright/test'

test.beforeEach(async ({ page, setupApp }) => {
await page.goto(setupApp.ADDR + '/')
})

test.afterEach(async ({ setupApp }) => {
await setupApp.killProcess()
test.beforeEach(async ({ page }) => {
await page.goto('/')
})

test('Navigating to a post page', async ({ page }) => {
Expand Down
Loading
Loading