You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Playwright E2E testing via cypress-on-rails gem
- Add cypress-on-rails gem (v1.19) with Playwright support
- Generate Playwright configuration and test structure using gem generator
- Create React on Rails specific E2E tests for components and SSR
- Add comprehensive documentation in CLAUDE.md for Playwright usage
- Include detailed README in e2e directory with examples
- Configure Rails integration for database control and factory_bot
This implementation leverages the cypress-on-rails gem to provide:
- Seamless Rails integration with database cleanup between tests
- Factory Bot support for easy test data creation
- Ability to run arbitrary Ruby code from Playwright tests
- Predefined scenarios for complex application states
- Better developer experience than standalone Playwright
Tests demonstrate React on Rails features: server-side rendering,
client-side hydration, Redux integration, and component interactivity.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
- JavaScript tests: `yarn run test` or `rake js_tests`
36
+
- Playwright E2E tests: See Playwright section below
36
37
- All tests: `rake` (default task runs lint and all tests except examples)
37
38
-**Linting** (MANDATORY BEFORE EVERY COMMIT):
38
39
-**REQUIRED**: `bundle exec rubocop` - Must pass with zero offenses
@@ -233,10 +234,140 @@ rm debug-*.js
233
234
- Generated examples are in `gen-examples/` (ignored by git)
234
235
- Only use `yarn` as the JS package manager, never `npm`
235
236
237
+
## Playwright E2E Testing
238
+
239
+
### Overview
240
+
Playwright E2E testing is integrated via the `cypress-on-rails` gem (v1.19+), which provides seamless integration between Playwright and Rails. This allows you to control Rails application state during tests, use factory_bot, and more.
241
+
242
+
### Setup
243
+
The gem and Playwright are already configured. To install Playwright browsers:
244
+
245
+
```bash
246
+
cd spec/dummy
247
+
yarn playwright install --with-deps
248
+
```
249
+
250
+
### Running Playwright Tests
251
+
252
+
```bash
253
+
cd spec/dummy
254
+
255
+
# Run all tests
256
+
yarn playwright test
257
+
258
+
# Run tests in UI mode (interactive debugging)
259
+
yarn playwright test --ui
260
+
261
+
# Run tests with visible browser
262
+
yarn playwright test --headed
263
+
264
+
# Debug a specific test
265
+
yarn playwright test --debug
266
+
267
+
# Run specific test file
268
+
yarn playwright test e2e/playwright/e2e/react_on_rails/basic_components.spec.js
269
+
```
270
+
271
+
### Writing Tests
272
+
273
+
Tests are located in `spec/dummy/e2e/playwright/e2e/`. The gem provides helpful commands for Rails integration:
0 commit comments