fix: update e2e tests for Terms of Service visibility and text consistency

- Modified the e2e tests for the Invoice Generator Page to ensure the Terms of Service text is consistent across mobile and desktop views.
- Updated the test assertions to reflect the revised text and structure for better clarity and accuracy.
- Changed the Playwright test reporter from 'list' to 'line' for improved output formatting.
This commit is contained in:
VladSez 2026-04-18 16:07:06 +02:00
parent 87760b5ae7
commit 79941e0eeb
2 changed files with 20 additions and 9 deletions

View file

@ -52,7 +52,8 @@ jobs:
SENTRY_ENABLED: false
NEXT_PUBLIC_SENTRY_ENABLED: false
continue-on-error: true
run: pnpm exec playwright test --reporter=html,list
# https://playwright.dev/docs/test-reporters#line-reporter
run: pnpm exec playwright test --reporter=html,line
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
name: 🎲 Upload Playwright report

View file

@ -178,11 +178,17 @@ test.describe("Invoice Generator Page", () => {
await expect(page.getByRole("tab", { name: "Edit Invoice" })).toBeVisible();
await expect(page.getByRole("tab", { name: "Preview PDF" })).toBeVisible();
const termsOfServiceLink = page.getByTestId("mobile-terms-of-service-link");
const termsOfServiceMobile = page.getByTestId(
"mobile-terms-of-service-link",
);
const termsOfServiceLinkMobile = termsOfServiceMobile.getByRole("link");
// Check that Terms of Service are displayed
await expect(termsOfServiceLink).toBeVisible();
await expect(termsOfServiceLink).toHaveText("Terms of Service apply");
await expect(termsOfServiceLink).toHaveAttribute("href", "/tos");
await expect(termsOfServiceMobile).toBeVisible();
await expect(termsOfServiceMobile).toHaveText(
"By using this tool, you agree to the Terms of Service",
);
await expect(termsOfServiceLinkMobile).toHaveAttribute("href", "/tos");
// Test desktop view
await page.setViewportSize({ width: 1280, height: 800 });
@ -191,13 +197,17 @@ test.describe("Invoice Generator Page", () => {
await expect(page.getByRole("tab", { name: "Edit Invoice" })).toBeHidden();
await expect(page.getByRole("tab", { name: "Preview PDF" })).toBeHidden();
const termsOfServiceLink2 = page.getByTestId(
const termsOfServiceDesktop = page.getByTestId(
"desktop-terms-of-service-link",
);
const termsOfServiceLinkDesktop = termsOfServiceDesktop.getByRole("link");
// Check that Terms of Service are displayed
await expect(termsOfServiceLink2).toBeVisible();
await expect(termsOfServiceLink2).toHaveText("Terms of Service apply");
await expect(termsOfServiceLink2).toHaveAttribute("href", "/tos");
await expect(termsOfServiceDesktop).toBeVisible();
await expect(termsOfServiceDesktop).toHaveText(
"By using this tool, you agree to the Terms of Service",
);
await expect(termsOfServiceLinkDesktop).toHaveAttribute("href", "/tos");
});
test("displays initial form state correctly", async ({ page }) => {