Skip to content

Commit

Permalink
Feature/cypress to playwright migration (#3513)
Browse files Browse the repository at this point in the history
* Begynt på migrering fra Cypress til Playwright
* Mer playwright oppsett og mocking
* Endret frontend oppsett til å støtte playwright og refaktorert en god del
* Lagt til playwright tester og refaktorert alle referanser fra cypress over til playwright
* Fjernet alt Cypress oppsett og migrert siste rest over til playwright
* Setter opp sharding for playwright github actions
* Lagt til fremgangsmåte for playwright i Readme
  • Loading branch information
stigus authored Jun 17, 2024
1 parent 2bf526f commit 2375975
Show file tree
Hide file tree
Showing 132 changed files with 3,615 additions and 3,314 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/app.dolly-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ on:
- libs/security-core
- apps/dolly-frontend/**
- .github/workflows/app.dolly-frontend.yml
- .github/workflows/common.cypress.yml
- .github/workflows/common.playwright.yml

jobs:

cypress:
uses: ./.github/workflows/common.cypress.yml
playwright:
uses: ./.github/workflows/common.playwright.yml
with:
working-directory: "apps/dolly-frontend"
secrets:
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/common.cypress.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/common.playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Playwright Tests
on:
workflow_call:
inputs:
working-directory:
type: string
description: "The working directory for the job, e.g. apps/dolly-frontend (without leading/trailing slash)."
required: true
secrets:
READER_TOKEN:
required: true
jobs:
playwright-tests:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [ 1, 2, 3, 4, 5 ]
shardTotal: [ 5 ]
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://npm.pkg.github.com/
scope: "@navikt"
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}/src/main/js
run: npm ci
- name: Install Playwright Browsers
working-directory: ${{ inputs.working-directory }}/src/main/js
run: npx playwright install --with-deps
- name: Run Playwright tests
working-directory: ${{ inputs.working-directory }}/src/main/js
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
23 changes: 23 additions & 0 deletions apps/dolly-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,26 @@ Deretter må du fjerne "local" fra profiles i LocalConfig og legge til "local" i
dette tilbake
før noe pushes til master). Etter dette kan du kjøre applikasjonen som beskrevet i JavaScript.

### Playwright - E2E testing

Playwright brukes til å teste mesteparten av funksjonaliteten i Dolly ved kodeendringer.

Dersom en eller flere av de tre nettleserne som Playwright utfører tester på mangler (Chrome, Firefox og Edge), kjør:

```
sudo npx playwright install msedge
sudo npx playwright install firefox
sudo npx playwright install chrome
```

Deretter kan testene kjøres med kommandoen:

```
npm run test:playwright-run
```

For debugging av testene og utvikling av nye tester brukes:

```
npm run test:playwright-dev
```
9 changes: 5 additions & 4 deletions apps/dolly-frontend/src/main/js/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ stats.json
# Code counter extension
/.VSCodeCounter

# Cypress
/cypress/videos/
/cypress/screenshots/
/cypress/downloads/
# Playwright
/test-results/
/blob-report/
/playwright-report/
/playwright/.cache/
28 changes: 0 additions & 28 deletions apps/dolly-frontend/src/main/js/cypress.config.ts

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions apps/dolly-frontend/src/main/js/cypress/e2e/BestillingStatus.cy.ts

This file was deleted.

32 changes: 0 additions & 32 deletions apps/dolly-frontend/src/main/js/cypress/e2e/DollySoek.cy.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/dolly-frontend/src/main/js/cypress/e2e/Endringsmelding.cy.ts

This file was deleted.

67 changes: 0 additions & 67 deletions apps/dolly-frontend/src/main/js/cypress/e2e/Gruppe.cy.ts

This file was deleted.

83 changes: 0 additions & 83 deletions apps/dolly-frontend/src/main/js/cypress/e2e/GruppeHeader.cy.ts

This file was deleted.

Loading

0 comments on commit 2375975

Please sign in to comment.