Skip to content

Commit

Permalink
refactor(reduce e2e tests against deployed app) (#1586)
Browse files Browse the repository at this point in the history
Co-authored-by: Spencer Peace <47868304+Spencer6497@users.noreply.github.com>
Co-authored-by: chris <christoph.hohnerlein@digitalservice.bund.de>
  • Loading branch information
Spencer6497 and chohner authored Jan 10, 2025
1 parent ab18e5e commit 0107594
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages[''].devDependencies['@playwright/test'])")" >> $GITHUB_ENV

- name: Download Content File
if: inputs.e2e-target != 'preview'
uses: actions/download-artifact@v4
with:
name: content-file
Expand All @@ -60,7 +61,7 @@ jobs:
GERICHTSFINDER_ENCRYPTION_KEY: "${{ secrets.GERICHTSFINDER_ENCRYPTION_KEY }}"
E2E_BASE_URL: "${{ inputs.e2e-target == 'preview' && 'https://a2j-test.dev.ds4g.net/' || 'http://localhost:3000/' }}"
E2E_USE_EXISTING_SERVER: "${{ inputs.use-existing-server }}"
run: CMS=FILE npm run test:e2e -- --shard ${{ matrix.shard }}/${{ strategy.job-total }}
run: CMS=FILE npm run test:e2e -- ${{ inputs.e2e-target == 'preview' && '--project=critical' }} --shard ${{ matrix.shard }}/${{ strategy.job-total }}

- name: Upload Playwright blob report
if: always()
Expand Down
15 changes: 8 additions & 7 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,20 @@ export default defineConfig({

/* Configure projects for major browsers */
projects: [
{
name: "critical",
use: { ...devices["Desktop Chrome"] },
testMatch: ["**/critical/**.spec.ts"],
},
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
testIgnore: ["**/critical/**.spec.ts"],
},
{
name: "Mobile Android",
name: "mobile",
use: { ...devices["Galaxy S8"] },
// Already covered in primary device tests
testIgnore: [
"**/accessibilityScans.spec.ts",
"**/csrf.spec.ts",
"**/security.spec.ts",
],
testIgnore: ["**/critical/**.spec.ts"],
},
],

Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions tests/e2e/critical/datasubmission.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test, expect } from "@playwright/test";
import { CookieSettings } from "../domains/shared/CookieSettings";

test.describe("Data submission", () => {
test("radio group value is restored", async ({ page }) => {
await page.goto("/beratungshilfe/vorabcheck");
const cookieSettings = new CookieSettings(page);
await cookieSettings.acceptCookieBanner();

await page.getByLabel("Ja").click();
await page.getByText("Weiter").click();
await expect(
page.getByText("wahrscheinlich keine Beratungshilfe"),
).toBeVisible();
await page.getByRole("link", { name: "Zurück", exact: true }).click();
await expect(page.getByLabel("Ja")).toBeChecked();
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test";
import { footerLinks, headerLinks } from "./urlsToCheck";
import { footerLinks, headerLinks } from "../pages/urlsToCheck";
import { testPageToBeAccessible } from "../util/testPageToBeAccessible";

test.beforeEach(async ({ page }) => {
Expand Down
File renamed without changes.

0 comments on commit 0107594

Please sign in to comment.