Skip to content

Commit 9bfa5cf

Browse files
committed
fix: separate playwright configs for scraper vs e2e tests
Scraper tests use mock servers, don't need webServer. E2E tests need the real server via webServer config.
1 parent 0a9eaa0 commit 9bfa5cf

3 files changed

Lines changed: 35 additions & 12 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"test": "vitest",
2121
"test:unit": "vitest run tests/unit",
2222
"test:integration": "vitest run tests/integration",
23-
"test:scraper": "playwright test tests/scraper",
23+
"test:scraper": "playwright test --config playwright.scraper.config.ts",
2424
"test:e2e": "playwright test tests/e2e",
2525
"test:ci": "vitest run --coverage",
2626
"test:watch": "vitest watch",

‎playwright.config.ts‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { defineConfig, devices } from '@playwright/test';
22

33
/**
4-
* Playwright configuration for scraper and E2E tests
4+
* Playwright configuration for E2E tests
5+
* For scraper tests, use playwright.scraper.config.ts
56
*/
67
export default defineConfig({
7-
testDir: './tests',
8+
testDir: './tests/e2e',
89
fullyParallel: true,
910
forbidOnly: !!process.env.CI,
1011
retries: process.env.CI ? 2 : 0,
@@ -19,17 +20,8 @@ export default defineConfig({
1920
},
2021

2122
projects: [
22-
{
23-
name: 'scraper-tests',
24-
testMatch: 'tests/scraper/**/*.spec.ts',
25-
use: {
26-
...devices['Desktop Chrome'],
27-
headless: true,
28-
},
29-
},
3023
{
3124
name: 'e2e-tests',
32-
testMatch: 'tests/e2e/**/*.spec.ts',
3325
use: {
3426
...devices['Desktop Chrome'],
3527
headless: true,

‎playwright.scraper.config.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
/**
4+
* Playwright configuration for scraper tests only
5+
* These tests use their own mock servers, no webServer needed
6+
*/
7+
export default defineConfig({
8+
testDir: './tests/scraper',
9+
fullyParallel: true,
10+
forbidOnly: !!process.env.CI,
11+
retries: process.env.CI ? 2 : 0,
12+
workers: process.env.CI ? 1 : undefined,
13+
reporter: 'html',
14+
timeout: 30000,
15+
16+
use: {
17+
trace: 'on-first-retry',
18+
screenshot: 'only-on-failure',
19+
},
20+
21+
projects: [
22+
{
23+
name: 'scraper-tests',
24+
use: {
25+
...devices['Desktop Chrome'],
26+
headless: true,
27+
},
28+
},
29+
],
30+
// No webServer - scraper tests use mock servers
31+
});

0 commit comments

Comments
 (0)