Skip to content

feat: Introduce Playwright for e2e testing#1007

Open
jeffredodd wants to merge 11 commits intomainfrom
feature/playwright-e2e-tests
Open

feat: Introduce Playwright for e2e testing#1007
jeffredodd wants to merge 11 commits intomainfrom
feature/playwright-e2e-tests

Conversation

@jeffredodd
Copy link
Contributor

Summary

This PR introduces Playwright for end-to-end testing of SDK flows.

What's included

Infrastructure

  • Playwright configuration with Chromium browser support
  • E2E test app (e2e/) with its own Vite config and MSW mocking
  • CI integration - new e2e job in GitHub Actions that:
    • Installs Playwright browsers
    • Initializes MSW
    • Runs e2e tests
    • Uploads test reports as artifacts

Test Coverage

Initial tests for all major flows:

  • Company Onboarding (4 tests)
  • Employee Onboarding (1 test)
  • Employee Self-Onboarding (1 test)
  • Contractor Onboarding (3 tests)
  • Contractor Payments (2 tests)
  • Payroll (4 tests)

Running Locally

# Run all e2e tests
npm run test:e2e

# Run with UI mode for debugging
npm run test:e2e:ui

# Run only the e2e dev server
npm run e2e:serve

Why Playwright?

  • Fast execution with parallel testing
  • Built-in browser automation
  • Excellent debugging with traces/videos on failure
  • Works well with MSW for API mocking
  • Good CI integration with artifact uploads

@jeffredodd jeffredodd force-pushed the feature/playwright-e2e-tests branch from 34329e6 to 9c0ff34 Compare February 3, 2026 23:55
@jeffredodd jeffredodd marked this pull request as ready for review February 3, 2026 23:55
Copilot AI review requested due to automatic review settings February 3, 2026 23:55
@jeffredodd jeffredodd force-pushed the feature/playwright-e2e-tests branch from 9c0ff34 to bd1e33a Compare February 3, 2026 23:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jeffredodd jeffredodd force-pushed the feature/playwright-e2e-tests branch from 5cb4d4f to da31686 Compare February 4, 2026 17:10
Copy link
Member

@serikjensen serikjensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +1 to +35
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,
},
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update this to share the existing vite config where possible so it can scale?

Comment on lines +168 to +178
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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know why it is making changes here? Seems like if there's an issue this one should be a sep PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants