feat: Introduce Playwright for e2e testing#1007
Conversation
34329e6 to
9c0ff34
Compare
9c0ff34 to
bd1e33a
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces Playwright for end-to-end testing of SDK flows, providing comprehensive test coverage across major features including company onboarding, employee onboarding, contractor management, and payroll processing.
Changes:
- Added Playwright infrastructure with CI integration and test harness app
- Extended MSW mock handlers to support e2e test scenarios
- Created 15 e2e tests covering 6 major flows
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| playwright.config.ts | Configures Playwright with Chromium browser, test directory, and dev server settings |
| package.json | Adds e2e test scripts and MSW worker directory configuration |
| eslint.config.mjs | Excludes e2e directory from linting |
| vite.config.ts | Excludes e2e directory from unit test collection |
| .gitignore | Ignores Playwright test artifacts and MSW service worker file |
| .github/workflows/ci.yaml | Adds e2e job to CI pipeline with Playwright browser installation and test execution |
| e2e/vite.config.ts | Configures Vite build for e2e test app with React and SCSS support |
| e2e/index.html | Provides HTML entry point for e2e test harness |
| e2e/main.tsx | Implements flow renderer that loads different SDK flows based on URL parameters |
| e2e/mocks/browser.ts | Sets up MSW browser worker for API mocking in e2e tests |
| e2e/tests/*.spec.ts | Implements e2e tests for company onboarding, employee onboarding, contractor flows, and payroll |
| src/test/mocks/handlers.ts | Exports additional handlers and imports new mock modules for e2e support |
| src/test/mocks/apis/*.ts | Adds and updates mock API handlers to support e2e test scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add Playwright configuration with chromium browser support - Add e2e test application with MSW mocking - Add test specs for major flows: - Company onboarding - Employee onboarding - Employee self-onboarding - Contractor onboarding - Contractor payments - Payroll - Extend MSW handlers for e2e scenarios - Add CI job for running e2e tests with artifact upload
5cb4d4f to
da31686
Compare
serikjensen
left a comment
There was a problem hiding this comment.
Looking good! couple of comments
Also, question: are we removing the existing tests while we add these ones to playwright? or will that be a fast follow? Just worried about having both side by side
| import { defineConfig } from 'vite' | ||
| import react from '@vitejs/plugin-react-swc' | ||
| import svgr from 'vite-plugin-svgr' | ||
| import { resolve } from 'path' | ||
|
|
||
| export default defineConfig({ | ||
| root: resolve(__dirname), | ||
| publicDir: resolve(__dirname, 'public'), | ||
| plugins: [ | ||
| react(), | ||
| svgr({ | ||
| svgrOptions: { | ||
| exportType: 'default', | ||
| titleProp: true, | ||
| }, | ||
| include: ['**/*.svg?react', '**/*.svg'], | ||
| }), | ||
| ], | ||
| resolve: { | ||
| alias: { | ||
| '@': resolve(__dirname, '../src'), | ||
| }, | ||
| }, | ||
| css: { | ||
| preprocessorOptions: { | ||
| scss: { | ||
| api: 'modern-compiler', | ||
| additionalData: `@use "@/styles/Helpers" as *; @use '@/styles/Responsive' as *;\n`, | ||
| }, | ||
| }, | ||
| }, | ||
| server: { | ||
| port: 5173, | ||
| }, | ||
| }) |
There was a problem hiding this comment.
Could we update this to share the existing vite config where possible so it can scale?
| const getLabel = () => { | ||
| if (paymentType === 'Payroll') { | ||
| return payrollRange | ||
| ? t('selectLabelPayroll', { payrollRange }) | ||
| : t('selectFallback') | ||
| } | ||
| return t('selectFallback') | ||
| } | ||
|
|
||
| return { | ||
| label: | ||
| paymentType === 'Payroll' | ||
| ? payrollRange | ||
| ? t('selectLabelPayroll', { payrollRange }) | ||
| : t('selectFallback') | ||
| : paymentType === 'ContractorPaymentGroup' | ||
| ? t('selectLabelContractorPaymentGroup', { | ||
| requestedAmount: formatCurrency(Number(requestedAmount)), | ||
| }) | ||
| : t('selectFallback'), | ||
| label: getLabel(), |
There was a problem hiding this comment.
Do we know why it is making changes here? Seems like if there's an issue this one should be a sep PR
Summary
This PR introduces Playwright for end-to-end testing of SDK flows.
What's included
Infrastructure
e2e/) with its own Vite config and MSW mockinge2ejob in GitHub Actions that:Test Coverage
Initial tests for all major flows:
Running Locally
Why Playwright?