diff --git a/tests/govtool-frontend/playwright/lib/_mock/index.ts b/tests/govtool-frontend/playwright/lib/_mock/index.ts index 0ce7b3d8..234f772d 100644 --- a/tests/govtool-frontend/playwright/lib/_mock/index.ts +++ b/tests/govtool-frontend/playwright/lib/_mock/index.ts @@ -2,8 +2,10 @@ import { faker } from "@faker-js/faker"; import { generateExactLengthText } from "@helpers/string"; export const invalid = { - url: () => { - const choice = faker.number.int({ min: 1, max: 2 }); + url: (isSupportedGreaterThan128Words = true) => { + const choice = isSupportedGreaterThan128Words + ? 1 + : faker.number.int({ min: 1, max: 2 }); if (choice === 1) { const invalidSchemes = ["ftp", "unsupported", "unknown-scheme"]; const invalidCharacters = "<>@!#$%^&*()"; diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts index 509e38d8..21afc870 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts @@ -156,7 +156,7 @@ test.describe("Validation of dRep Registration Form", () => { await dRepRegistrationPage.registerBtn.click(); for (let i = 0; i < 100; i++) { - const invalidUrl = mockInvalid.url(); + const invalidUrl = mockInvalid.url(false); await dRepRegistrationPage.metadataUrlInput.fill(invalidUrl); if (invalidUrl.length <= 128) { diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts index 1454a005..95a90f0e 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts @@ -127,7 +127,7 @@ test.describe("Validation of edit dRep Form", () => { await editDRepPage.registerBtn.click(); for (let i = 0; i < 100; i++) { - const invalidUrl = mockInvalid.url(); + const invalidUrl = mockInvalid.url(false); await editDRepPage.metadataUrlInput.fill(invalidUrl); if (invalidUrl.length <= 128) { await expect(page.getByTestId("invalid-url-error")).toBeVisible(); diff --git a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts index 1c4999a2..b96e5e2d 100644 --- a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts @@ -261,7 +261,7 @@ test.describe("Proposal created logged state", () => { }) => { test.slow(); // Brute-force testing with 100 random data for (let i = 0; i < 50; i++) { - await proposalSubmissionPage.metadataUrlInput.fill(invalid.url()); + await proposalSubmissionPage.metadataUrlInput.fill(invalid.url(false)); await expect(page.getByTestId("url-input-error-text")).toBeVisible(); }