Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

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

VladSez79941e0eeb05
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index af59371..ffdbc9c 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -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
diff --git a/e2e/invoice-form.test.ts b/e2e/invoice-form.test.ts
index 7bc3baf..e315c98 100644
--- a/e2e/invoice-form.test.ts
+++ b/e2e/invoice-form.test.ts
@@ -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 }) => {