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
## Summary
- Adds Playwright for cross-browser end-to-end testing of React on Rails
components
- Provides comprehensive test coverage for component rendering,
interactivity, and SSR/hydration
- Integrates seamlessly with existing RSpec and Jest test suites
## Key Changes
- **Playwright Configuration**: Added `spec/dummy/playwright.config.ts`
with support for Chrome, Firefox, Safari, and mobile browsers
- **Test Suites**: Created four comprehensive test suites:
- `basic-react-components.spec.ts` - Tests React component rendering and
interactions
- `turbolinks-integration.spec.ts` - Tests Turbolinks/Turbo integration
- `error-handling.spec.ts` - Console error monitoring and error handling
- `performance.spec.ts` - Performance testing for load times and memory
usage
- **Test Helpers**: Custom utilities in `fixtures/test-helpers.ts` for
React on Rails specific testing
- **Rake Tasks**: Added Playwright rake tasks for easy test execution
- **Documentation**: Updated CLAUDE.md with comprehensive Playwright
documentation
## Implementation Details
The Playwright tests are properly located in `spec/dummy/` where the
actual Rails test application lives. This ensures tests run against a
real Rails environment with compiled assets.
### Features:
- Cross-browser testing (Chrome, Firefox, Safari, mobile browsers)
- Server-side rendering verification
- Client-side hydration testing
- Performance monitoring
- Error tracking
- Automatic Rails server startup before tests
## Test Plan
1. Install Playwright dependencies:
```bash
cd spec/dummy
yarn install
yarn playwright install --with-deps
```
2. Run Playwright tests:
```bash
yarn test:e2e
```
3. Run tests in UI mode for debugging:
```bash
yarn test:e2e:ui
```
4. Verify existing tests still pass:
```bash
rake
```
## Breaking Changes
None - this is an additive change that doesn't affect existing
functionality.
## Security Implications
None - Playwright tests run locally and in CI only. No production code
changes.
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1836)
<!-- Reviewable:end -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Tests**
* Added Playwright E2E test suite, helpers, app commands, example specs,
and CI workflow with reporting.
* **Documentation**
* Added comprehensive E2E testing guide and README covering setup,
commands, examples, and debugging.
* **Chores**
* Added dev/test dependencies and npm/gem scripts, IDE ignores for E2E
artifacts, and updated tooling config for new tests.
* **Style**
* Minor lint-comment cleanups in client-side code.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
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,153 @@ 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
+
**Note:** Playwright will automatically start the Rails server on port 5017 before running tests. You don't need to manually start the server.
0 commit comments