diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 617ca83a9..e349030c5 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -113,8 +113,8 @@ jobs: name: frontend-build path: frontend/dist - playwright-ui: - name: Playwright UI tests + playwright-ladle: + name: Playwright ladle tests strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -132,13 +132,14 @@ jobs: run: npm ci - name: Install Playwright Browsers run: npx playwright install --with-deps --no-shell - - name: Run UI e2e tests - run: npm run e2e:lib-ui + - name: Run ladle playwright tests + run: npm run test:ladle - playwright-d2d: - name: Playwright d2d tests (${{ matrix.os }}) + playwright-e2e: + name: Playwright e2e tests (${{ matrix.os }}) needs: - - backend # frontend is included in backend build + - backend + - frontend # for the tests, frontend build is included in backend job strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -164,13 +165,14 @@ jobs: - name: make backend build executable run: chmod a+x ../builds/backend/abacus if: runner.os != 'Windows' - - name: Run DOM to Database e2e tests - run: npm run e2e:d2d + - name: Run e2e playwright tests + run: npm run test:e2e deploy: name: Deploy to abacus-test.nl needs: - backend + - frontend # for the tests, frontend build is included in backend job environment: name: test url: https://${{ github.sha }}.abacus-test.nl diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3adb6e520..73697ffa4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,8 +58,8 @@ jobs: name: abacus-${{ matrix.target.os }} path: ${{ matrix.target.binary }} - playwright-d2d: - name: Playwright d2d tests (${{ matrix.os }}, ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) + playwright-e2e: + name: Playwright e2e tests (${{ matrix.os }}, ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) needs: - build strategy: @@ -89,14 +89,14 @@ jobs: - name: make backend build executable run: chmod a+x ../builds/backend/abacus if: runner.os != 'Windows' - - name: Run DOM to Database e2e tests - run: npm run e2e:d2d -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + - name: Run Playwright e2e tests + run: npm run test:e2e -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} release: name: Release needs: - build - - playwright-d2d + - playwright-e2e runs-on: ubuntu-latest permissions: # contents write permission is needed to push the tag diff --git a/frontend/README.md b/frontend/README.md index 9c0ae166d..6b1306d91 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -52,14 +52,14 @@ Browser tests using Playwright: ```sh # tests for ui components using ladle: -npm run e2e:lib-ui +npm run test:ladle # tests for frontend with backend and database # tests use database at backend/target/debug/playwright.sqlite # build frontend, build backend, setup fresh seeded database: -npm run e2e:d2d +npm run test:e2e # run tests, expect builds and database to be available: -npm run e2e:d2d-dev +npm run test:e2e-dev ``` ### UI Component development diff --git a/frontend/e2e-tests/dom-to-db-tests/data-entry.e2e.ts b/frontend/e2e-tests/data-entry.e2e.ts similarity index 99% rename from frontend/e2e-tests/dom-to-db-tests/data-entry.e2e.ts rename to frontend/e2e-tests/data-entry.e2e.ts index a14bc0d09..a82d5684f 100644 --- a/frontend/e2e-tests/dom-to-db-tests/data-entry.e2e.ts +++ b/frontend/e2e-tests/data-entry.e2e.ts @@ -1,6 +1,4 @@ import { expect } from "@playwright/test"; -import { fillDataEntry } from "e2e-tests/e2e-test-helpers"; -import { formatNumber } from "e2e-tests/e2e-test-utils"; import { CandidatesListPage, CheckAndSavePage, @@ -15,6 +13,8 @@ import { import { VotersCounts, VotesCounts } from "@kiesraad/api"; import { test } from "./fixtures"; +import { fillDataEntry } from "./helpers-utils/e2e-test-helpers"; +import { formatNumber } from "./helpers-utils/e2e-test-utils"; import { noErrorsWarningsResponse, noRecountNoDifferencesDataEntry, diff --git a/frontend/e2e-tests/dom-to-db-tests/fixtures.ts b/frontend/e2e-tests/fixtures.ts similarity index 100% rename from frontend/e2e-tests/dom-to-db-tests/fixtures.ts rename to frontend/e2e-tests/fixtures.ts diff --git a/frontend/e2e-tests/e2e-test-helpers.ts b/frontend/e2e-tests/helpers-utils/e2e-test-helpers.ts similarity index 98% rename from frontend/e2e-tests/e2e-test-helpers.ts rename to frontend/e2e-tests/helpers-utils/e2e-test-helpers.ts index 83a2e418d..4a9191a4a 100644 --- a/frontend/e2e-tests/e2e-test-helpers.ts +++ b/frontend/e2e-tests/helpers-utils/e2e-test-helpers.ts @@ -9,7 +9,7 @@ import { PollingStationChoicePage, RecountedPage, VotersAndVotesPage, -} from "./page-objects/data_entry"; +} from "../page-objects/data_entry"; export async function fillDataEntry(page: Page, results: PollingStationResults) { const recountedPage = new RecountedPage(page); diff --git a/frontend/e2e-tests/e2e-test-utils.ts b/frontend/e2e-tests/helpers-utils/e2e-test-utils.ts similarity index 100% rename from frontend/e2e-tests/e2e-test-utils.ts rename to frontend/e2e-tests/helpers-utils/e2e-test-utils.ts diff --git a/frontend/e2e-tests/dom-to-db-tests/pdf-rendering.e2e.ts b/frontend/e2e-tests/pdf-rendering.e2e.ts similarity index 100% rename from frontend/e2e-tests/dom-to-db-tests/pdf-rendering.e2e.ts rename to frontend/e2e-tests/pdf-rendering.e2e.ts diff --git a/frontend/e2e-tests/dom-to-db-tests/polling-station-crud.e2e.ts b/frontend/e2e-tests/polling-station-crud.e2e.ts similarity index 88% rename from frontend/e2e-tests/dom-to-db-tests/polling-station-crud.e2e.ts rename to frontend/e2e-tests/polling-station-crud.e2e.ts index 5f2f01d30..3ec1f75e4 100644 --- a/frontend/e2e-tests/dom-to-db-tests/polling-station-crud.e2e.ts +++ b/frontend/e2e-tests/polling-station-crud.e2e.ts @@ -1,9 +1,9 @@ import { expect } from "@playwright/test"; import { PollingStationFormPgObj } from "e2e-tests/page-objects/polling_station/PollingStationFormPgObj"; -import { PollingStationListEmptyPgObj } from "../page-objects/polling_station/PollingStationListEmptyPgObj"; -import { PollingStationListPgObj } from "../page-objects/polling_station/PollingStationListPgObj"; import { test } from "./fixtures"; +import { PollingStationListEmptyPgObj } from "./page-objects/polling_station/PollingStationListEmptyPgObj"; +import { PollingStationListPgObj } from "./page-objects/polling_station/PollingStationListPgObj"; test.describe("Polling station CRUD", () => { test("it redirects correctly after successful create of first polling station of an election", async ({ diff --git a/frontend/e2e-tests/dom-to-db-tests/resume-data-entry.e2e.ts b/frontend/e2e-tests/resume-data-entry.e2e.ts similarity index 100% rename from frontend/e2e-tests/dom-to-db-tests/resume-data-entry.e2e.ts rename to frontend/e2e-tests/resume-data-entry.e2e.ts diff --git a/frontend/e2e-tests/dom-to-db-tests/test-data/request-response-templates.ts b/frontend/e2e-tests/test-data/request-response-templates.ts similarity index 100% rename from frontend/e2e-tests/dom-to-db-tests/test-data/request-response-templates.ts rename to frontend/e2e-tests/test-data/request-response-templates.ts diff --git a/frontend/e2e-tests/dom-to-db-tests/zip-download.e2e.ts b/frontend/e2e-tests/zip-download.e2e.ts similarity index 100% rename from frontend/e2e-tests/dom-to-db-tests/zip-download.e2e.ts rename to frontend/e2e-tests/zip-download.e2e.ts diff --git a/frontend/package.json b/frontend/package.json index 93f689a33..58e11652d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,9 +15,9 @@ "prettier": "prettier --ignore-unknown --write .", "preview": "vite preview", "test": "vitest", - "e2e:lib-ui": "playwright test -c playwright.lib-ui.config.ts", - "e2e:d2d": "cross-env LOCAL_CI=true playwright test -c playwright.d2d.config.ts", - "e2e:d2d-dev": "playwright test -c playwright.d2d.config.ts", + "test:e2e": "cross-env LOCAL_CI=true playwright test -c playwright.e2e.config.ts", + "test:e2e-dev": "playwright test -c playwright.e2e.config.ts", + "test:ladle": "playwright test -c playwright.ladle.config.ts", "ladle": "ladle serve", "build:ladle": "ladle build", "start:msw": "cross-env API_MODE=mock vite", diff --git a/frontend/playwright.d2d.config.ts b/frontend/playwright.e2e.config.ts similarity index 94% rename from frontend/playwright.d2d.config.ts rename to frontend/playwright.e2e.config.ts index c3cbe0407..f4199dc19 100644 --- a/frontend/playwright.d2d.config.ts +++ b/frontend/playwright.e2e.config.ts @@ -20,8 +20,8 @@ function returnWebserverCommand(): string { const config: PlaywrightTestConfig = defineConfig({ ...commonConfig, - testDir: "./e2e-tests/dom-to-db-tests", - outputDir: "./test-results/dom-to-db", + testDir: "./e2e-tests", + outputDir: "./test-results/e2e-tests", testMatch: /\.e2e\.ts/, use: { ...commonConfig.use, diff --git a/frontend/playwright.lib-ui.config.ts b/frontend/playwright.ladle.config.ts similarity index 92% rename from frontend/playwright.lib-ui.config.ts rename to frontend/playwright.ladle.config.ts index 1268ac29f..0e224122f 100644 --- a/frontend/playwright.lib-ui.config.ts +++ b/frontend/playwright.ladle.config.ts @@ -5,7 +5,7 @@ import commonConfig from "./playwright.common.config"; const config: PlaywrightTestConfig = defineConfig({ ...commonConfig, testDir: "./lib/ui", - outputDir: "./test-results/lib-ui", + outputDir: "./test-results/ladle", testMatch: /\.e2e\.ts/, use: { ...commonConfig.use, diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index ad1c388f7..763b6ffe0 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -36,9 +36,8 @@ "app/**/*", "lib/**/*", "scripts/**/*", - "playwright.app.config.ts", - "playwright.d2d.config.ts", - "playwright.lib-ui.config.ts", + "playwright.e2e.config.ts", + "playwright.ladle.config.ts", "vite.config.ts", "e2e-tests/**/*" ]