Skip to content

Commit 9ecb163

Browse files
committed
Change Playwright E2E flag from 'DEBUG' to 'CI' so it works on GitHub Actions
1 parent 7f9a541 commit 9ecb163

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

‎.github/instructions/general.instructions.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ When a Playwright-native action (e.g., `page.click()`, `page.fill()`, `page.hove
7777
## E2E Testing Standards
7878

7979
- **NEVER hard-code content slugs in e2e tests** (e.g., `/articles/typescript-best-practices`, `/services/web-development`). Content can be deleted or renamed. Always dynamically fetch the first available item from listing pages (articles, services, case-studies, etc.) and navigate to it. This prevents test breakage when content changes.
80-
- **Playwright E2E Tests**: ALWAYS run with `DEBUG=1` environment variable (e.g., `DEBUG=1 npx playwright test`). This prevents the Playwright test runner from launching its own dev server. The user maintains a running dev server for development.
81-
- **NEVER run the full e2e test suite** unless explicitly requested by the user. The full suite is very resource intensive and takes over 10 minutes to run. Only run specific e2e test files when verification is needed (e.g., `DEBUG=1 npx playwright test test/e2e/specific-file.spec.ts`).
80+
- **Playwright E2E Tests**: ALWAYS run with `CI=1` environment variable (e.g., `CI=1 npx playwright test`). This prevents the Playwright test runner from launching its own dev server. The user maintains a running dev server for development.
81+
- **NEVER run the full e2e test suite** unless explicitly requested by the user. The full suite is very resource intensive and takes over 10 minutes to run. Only run specific e2e test files when verification is needed (e.g., `CI=1 npx playwright test test/e2e/specific-file.spec.ts`).
8282
- **NEVER start a dev server yourself**. The user runs their own dev server for development. When you need a dev server running, notify the user instead of starting one.
8383

8484
### Astro View Transitions Testing

‎.github/instructions/testing.instructions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ applyTo: "**/*.spec.ts"
1414
## E2E Testing
1515

1616
- **NEVER hard-code content slugs** - fetch dynamically from listing pages
17-
- **Always run with `DEBUG=1`** - e.g., `DEBUG=1 npx playwright test test/e2e/file.spec.ts`
17+
- **Always run with `CI=1`** - e.g., `CI=1 npx playwright test test/e2e/file.spec.ts`
1818
- **NEVER run full e2e suite** unless requested - it takes 10+ minutes
1919
- **NEVER start dev server** - user maintains running server
2020
- **Use `BasePage.waitForPageLoad()`** to wait for `astro:page-load` event

‎_TODO.md‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# TODO
22

3-
## CI
4-
5-
Change the DEBUG=1 flag to C1=1, add an isCI() method to environment, check both CI and whatever GitHub Actions uses, update Playwright config to it and docs
6-
73
## Analytics
84

95
Vercel Analytics

‎playwright.config.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import 'dotenv/config'
1010
* See https://playwright.dev/docs/test-configuration.
1111
*/
1212

13-
/** Debug mode - set DEBUG=1 or DEBUG=true to run only chromium with no HTML report */
14-
const isDebugMode = Boolean(process.env['DEBUG'] && process.env['DEBUG'] !== 'false' && process.env['DEBUG'] !== '0')
13+
/** Debug mode - set CI=1 or CI=true to run only chromium with no HTML report */
14+
const isCIMode = Boolean(process.env['CI'] && (process.env['CI'] === 'true') || process.env['CI'] === '1')
1515

1616
export default defineConfig({
1717
/* Look for test files in the "tests" directory, relative to this configuration file. */
@@ -44,7 +44,7 @@ export default defineConfig({
4444
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
4545
reporter: process.env['CI']
4646
? 'github'
47-
: isDebugMode
47+
: isCIMode
4848
? [
4949
['list'],
5050
['json', { outputFile: '.cache/playwright/results.json' }],
@@ -107,7 +107,7 @@ export default defineConfig({
107107

108108
/* Run your local dev server before starting the tests */
109109
/* In debug mode, assume server is already running */
110-
...(isDebugMode
110+
...(isCIMode
111111
? {}
112112
: {
113113
webServer: {

0 commit comments

Comments
 (0)