chore(tests): cleanup playwright configs
This commit is contained in:
@@ -1 +0,0 @@
|
||||
FRAMEWROK=svelte
|
||||
@@ -1,13 +1,4 @@
|
||||
import { defineConfig } from '@playwright/test';
|
||||
import { sharedConfigWithPort } from './playwright.shared.config';
|
||||
|
||||
const port = 3000;
|
||||
|
||||
export default defineConfig({
|
||||
...sharedConfigWithPort(port),
|
||||
webServer: {
|
||||
command: 'cd ../../examples/react && pnpm run dev',
|
||||
port,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
});
|
||||
export default defineConfig(sharedConfigWithPort({ port: 3000, framework: 'react' }));
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { PlaywrightTestConfig, devices } from '@playwright/test';
|
||||
|
||||
export function sharedConfigWithPort(port: number): PlaywrightTestConfig {
|
||||
type ConfigParams = {
|
||||
port: number;
|
||||
framework: string;
|
||||
};
|
||||
|
||||
export function sharedConfigWithPort({ port, framework }: ConfigParams): PlaywrightTestConfig {
|
||||
return {
|
||||
testDir: './e2e',
|
||||
/* Run tests in files in parallel */
|
||||
@@ -21,6 +26,11 @@ export function sharedConfigWithPort(port: number): PlaywrightTestConfig {
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
webServer: {
|
||||
command: `pnpm --filter=${framework}-examples run dev --port ${port}`,
|
||||
port,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
import { defineConfig } from '@playwright/test';
|
||||
import { sharedConfigWithPort } from './playwright.shared.config';
|
||||
|
||||
const port = 5173;
|
||||
|
||||
export default defineConfig({
|
||||
...sharedConfigWithPort(port),
|
||||
webServer: {
|
||||
command: 'cd ../../examples/svelte && pnpm run dev --port 5173',
|
||||
port: port,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
},
|
||||
});
|
||||
export default defineConfig(sharedConfigWithPort({ port: 5173, framework: 'svelte' }));
|
||||
|
||||
Reference in New Issue
Block a user