Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .changeset/lemon-elephants-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'create-svelte': patch
'test-basics': patch
'@sveltejs/kit': patch
---

Align `playwright` server ports with `vite` preview server port
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 3000
port: 4173
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const config = {
webServer: {
command: 'npm run build && npm run preview',
port: 3000
port: 4173
}
};

Expand Down
13 changes: 10 additions & 3 deletions packages/kit/test/apps/basics/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,10 @@ test.describe('Load', () => {
}
});

test('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => {
test.only('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => {
const DEV_SERVER_PORT = 3000;
const PREVIEW_SERVER_PORT = 4173;

if (javaScriptEnabled && process.env.DEV) {
const warnings = [];

Expand All @@ -1652,7 +1655,9 @@ test.describe('Load', () => {
expect(await page.textContent('h1')).toBe('42');

expect(warnings).toContain(
'Loading http://localhost:3000/load/window-fetch/data.json using `window.fetch`. For best results, use the `fetch` that is passed to your `load` function: https://kit.svelte.dev/docs/loading#input-fetch'
`Loading http://localhost:${
process.env.DEV ? DEV_SERVER_PORT : PREVIEW_SERVER_PORT
}/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch`
);

warnings.length = 0;
Expand All @@ -1661,7 +1666,9 @@ test.describe('Load', () => {
expect(await page.textContent('h1')).toBe('42');

expect(warnings).not.toContain(
'Loading http://localhost:3000/load/window-fetch/data.json using `window.fetch`. For best results, use the `fetch` that is passed to your `load` function: https://kit.svelte.dev/docs/loading#input-fetch'
`Loading http://localhost:${
process.env.DEV ? DEV_SERVER_PORT : PREVIEW_SERVER_PORT
}/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch`
);
}
});
Expand Down
8 changes: 2 additions & 6 deletions packages/kit/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,14 @@ if (!test_browser_device) {
);
}

const port = 3000;

/** @type {import('@playwright/test').PlaywrightTestConfig} */
export const config = {
forbidOnly: !!process.env.CI,
// generous timeouts on CI
timeout: process.env.CI ? 45000 : 15000,
webServer: {
command: process.env.DEV
? `npm run dev -- --port ${port}`
: `npm run build && npm run preview -- --port ${port}`,
port
command: process.env.DEV ? 'npm run dev' : 'npm run build && npm run preview',
port: process.env.DEV ? 3000 : 4173
},
retries: process.env.CI ? 5 : 0,
projects: [
Expand Down