Skip to content

Commit 5c72a67

Browse files
authored
Merge pull request #106 from educorvi/copilot/migrate-from-cypress-to-playwright
Migrate E2E tests from Cypress to Playwright
2 parents 1732ddb + 02d3be3 commit 5c72a67

34 files changed

+1329
-2479
lines changed

.github/workflows/buildAndTest.yaml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ on:
1414
- checks_requested
1515
workflow_dispatch:
1616

17+
permissions:
18+
contents: read
19+
issues: read
20+
checks: write
21+
pull-requests: write
22+
1723
jobs:
1824
build:
1925
runs-on: ubuntu-latest
@@ -60,22 +66,21 @@ jobs:
6066
- run: yarn run build:vue-json-form
6167
- run: yarn test:unit
6268
working-directory: ./vue-json-form
63-
- name: Cypress run
64-
uses: cypress-io/github-action@v6
65-
with:
66-
working-directory: ./vue-json-form
67-
build: yarn run build
68-
start: yarn dev
69-
wait-on: 'http://localhost:5173'
70-
record: true
71-
env:
72-
# pass GitHub token to allow accurately detecting a build vs a re-run build
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
# Cypress
75-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
76-
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
69+
- name: Install Playwright Browsers
70+
run: yarn playwright install --with-deps chromium
71+
working-directory: ./vue-json-form
72+
- name: Run Playwright tests
73+
run: yarn test:e2e
74+
working-directory: ./vue-json-form
7775
- uses: actions/upload-artifact@v4
7876
if: always()
7977
with:
80-
name: cypress-screenshots
81-
path: cypress/screenshots
78+
name: playwright-report
79+
path: vue-json-form/playwright-report/
80+
retention-days: 30
81+
- name: Publish Test Results
82+
uses: EnricoMi/publish-unit-test-result-action@v2
83+
if: (!cancelled())
84+
with:
85+
files: |
86+
vue-json-form/test-results/**/*.xml

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,7 @@ dist
149149
# and uncomment the following lines
150150
.pnp.*
151151

152+
# Playwright
153+
playwright-report/
154+
test-results/
155+
playwright/.cache/

.junie/guidelines.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Project-specific development guidelines for vue-json-form (monorepo)
22

3-
Audience: Advanced contributors familiar with Yarn workspaces, Vite, Vue 3, TypeScript, Vitest, and Cypress.
3+
Audience: Advanced contributors familiar with Yarn workspaces, Vite, Vue 3, TypeScript, Vitest, and Playwright.
44

55
1) Monorepo overview and prerequisites
66
- Package manager: Yarn 4 (Berry). Confirm with node -v (CI uses Node 20/22/24). Use the same major Node versions for reproducibility.
@@ -45,22 +45,22 @@ Audience: Advanced contributors familiar with Yarn workspaces, Vite, Vue 3, Type
4545
- Run: yarn workspace @educorvi/vue-json-form vitest run src/MapperFunctions/yourFunction.test.ts
4646
- Remove temporary files when done if they are only for demonstration.
4747

48-
4) Testing: end-to-end (Cypress)
49-
- Location: vue-json-form/cypress/e2e/*.cy.ts
50-
- Dev server + Cypress (CI parity):
51-
- CI does: build deps, then in ./vue-json-form runs build, starts dev, wait-on http://localhost:5173, then runs Cypress.
48+
4) Testing: end-to-end (Playwright)
49+
- Location: vue-json-form/tests/e2e/*.spec.ts
50+
- Dev server + Playwright (CI parity):
51+
- CI does: build deps, then in ./vue-json-form installs Playwright browsers, runs Playwright tests.
5252
- Local equivalent from repo root:
5353
- yarn install --immutable
5454
- yarn build:vue-json-form
5555
- cd vue-json-form
56-
- yarn build
57-
- In one terminal: yarn dev # Vite at http://localhost:5173
58-
- In another terminal: yarn cypress # Opens Cypress runner
59-
- Headless run:
60-
- From vue-json-form: npx cypress run
56+
- npx playwright install --with-deps chromium # First time only
57+
- yarn test:e2e # Runs tests headless
58+
- Interactive mode:
59+
- From vue-json-form: yarn playwright # Opens Playwright UI
6160
- Tips
62-
- Keep e2e fixtures and example schemas under vue-json-form/src/exampleSchemas for reproducible scenarios; CI records and uploads screenshots on failures.
63-
- When adjusting ports/hosts, update wait-on in .github/workflows/buildAndTest.yaml and local commands accordingly.
61+
- Playwright automatically starts the dev server before running tests (configured in playwright.config.ts).
62+
- Keep e2e fixtures and example schemas under vue-json-form/src/exampleSchemas for reproducible scenarios; CI uploads test reports on failures.
63+
- When adjusting ports/hosts, update baseURL in playwright.config.ts and webServer settings accordingly.
6464

6565
5) Coding standards and project conventions
6666
- Languages/stack: TypeScript, Vue 3, Vite, Pinia, Sass. Typings for schemas are provided by @educorvi/vue-json-form-schemas.
@@ -93,5 +93,5 @@ Audience: Advanced contributors familiar with Yarn workspaces, Vite, Vue 3, Type
9393
- yarn install --immutable && yarn build
9494
- Iterate on vue-json-form only:
9595
- yarn build:vue-json-form && yarn workspace @educorvi/vue-json-form dev
96-
- Run Cypress like CI does:
97-
- yarn build:vue-json-form && (cd vue-json-form && yarn build && yarn dev) in one terminal, and in another terminal run yarn cypress from vue-json-form
96+
- Run Playwright like CI does:
97+
- yarn build:vue-json-form && (cd vue-json-form && yarn test:e2e)

demo/cypress.config.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

demo/cypress/e2e/example.cy.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

demo/cypress/e2e/tsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

demo/cypress/fixtures/example.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

demo/cypress/support/commands.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

demo/cypress/support/component-index.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

demo/cypress/support/component.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)