Skip to content

Commit a2cfc35

Browse files
justin808claude
andcommitted
Fix Playwright config to prevent running Jest tests
The Playwright test runner was picking up Jest tests from the tests/ directory because it wasn't using the correct config file. This caused CI failures with "ReferenceError: test is not defined" errors. Changes: - Updated package.json scripts to explicitly reference e2e/playwright.config.js - Updated CI workflow to use yarn test:e2e instead of raw playwright command - Fixed artifact path in CI to point to e2e/playwright-report/ - Updated README to use the correct yarn scripts This ensures Playwright only runs tests from e2e/playwright/e2e/ and not the Jest tests in tests/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3bc0757 commit a2cfc35

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

.github/workflows/playwright.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040

4141
- name: Run Playwright tests
4242
working-directory: spec/dummy
43-
run: yarn playwright test
43+
run: yarn test:e2e
4444

4545
- uses: actions/upload-artifact@v4
4646
if: always()
4747
with:
4848
name: playwright-report
49-
path: spec/dummy/playwright-report/
49+
path: spec/dummy/e2e/playwright-report/
5050
retention-days: 30

spec/dummy/e2e/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ This directory contains end-to-end tests using Playwright integrated with Rails
99
yarn playwright install --with-deps
1010

1111
# Run all tests
12-
yarn playwright test
12+
yarn test:e2e
1313

1414
# Run in UI mode for debugging
15-
yarn playwright test --ui
15+
yarn test:e2e:ui
1616
```
1717

1818
## Features
@@ -153,37 +153,37 @@ await app('my_command', { some: 'options' });
153153

154154
```bash
155155
# All tests
156-
yarn playwright test
156+
yarn test:e2e
157157

158158
# Specific file
159-
yarn playwright test e2e/playwright/e2e/react_on_rails/basic_components.spec.js
159+
yarn test:e2e e2e/playwright/e2e/react_on_rails/basic_components.spec.js
160160

161161
# UI mode (interactive)
162-
yarn playwright test --ui
162+
yarn test:e2e:ui
163163

164164
# Headed mode (visible browser)
165-
yarn playwright test --headed
165+
yarn test:e2e:headed
166166

167167
# Debug mode
168-
yarn playwright test --debug
168+
yarn test:e2e:debug
169169

170170
# Specific browser
171-
yarn playwright test --project=chromium
172-
yarn playwright test --project=firefox
173-
yarn playwright test --project=webkit
171+
yarn test:e2e --project=chromium
172+
yarn test:e2e --project=firefox
173+
yarn test:e2e --project=webkit
174174

175175
# View last run report
176-
yarn playwright show-report
176+
yarn test:e2e:report
177177
```
178178

179179
## Debugging
180180

181-
1. **UI Mode**: `yarn playwright test --ui` - Best for interactive debugging
182-
2. **Headed Mode**: `yarn playwright test --headed` - See browser actions
181+
1. **UI Mode**: `yarn test:e2e:ui` - Best for interactive debugging
182+
2. **Headed Mode**: `yarn test:e2e:headed` - See browser actions
183183
3. **Pause Execution**: Add `await page.pause()` in your test
184184
4. **Console Logging**: Check browser console in headed mode
185185
5. **Screenshots**: Automatically taken on failure
186-
6. **Test Reports**: Check `playwright-report/` after test run
186+
6. **Test Reports**: Check `e2e/playwright-report/` after test run
187187

188188
## Best Practices
189189

spec/dummy/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@
7373
"format": "cd ../.. && yarn run nps format",
7474
"test:js": "yarn run jest ./tests",
7575
"test": "yarn run build:test && yarn run lint && bin/rspec",
76-
"test:e2e": "playwright test",
77-
"test:e2e:ui": "playwright test --ui",
78-
"test:e2e:headed": "playwright test --headed",
79-
"test:e2e:debug": "playwright test --debug",
80-
"test:e2e:report": "playwright show-report",
76+
"test:e2e": "playwright test --config=e2e/playwright.config.js",
77+
"test:e2e:ui": "playwright test --config=e2e/playwright.config.js --ui",
78+
"test:e2e:headed": "playwright test --config=e2e/playwright.config.js --headed",
79+
"test:e2e:debug": "playwright test --config=e2e/playwright.config.js --debug",
80+
"test:e2e:report": "playwright show-report e2e/playwright-report",
8181
"build:test": "rm -rf public/webpack/test && yarn build:rescript && RAILS_ENV=test NODE_ENV=test bin/shakapacker",
8282
"build:dev": "rm -rf public/webpack/development && yarn build:rescript && RAILS_ENV=development NODE_ENV=development bin/shakapacker",
8383
"build:dev:server": "rm -rf public/webpack/development && yarn build:rescript && RAILS_ENV=development NODE_ENV=development bin/shakapacker --watch",

0 commit comments

Comments
 (0)