diff --git a/tests/govtool-frontend/playwright/lib/helpers/transaction.ts b/tests/govtool-frontend/playwright/lib/helpers/transaction.ts index 1cd3e914c..ce22f0278 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/transaction.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/transaction.ts @@ -77,7 +77,7 @@ export async function waitForTxConfirmation( .getByTestId("alert-warning") .getByText("Transaction in progress", { exact: false }) ).toBeVisible({ - timeout: 60_000, + timeout: 90_000, }); const url = (await transactionStatusPromise).url(); const regex = /\/transaction\/status\/([^\/]+)$/; @@ -90,7 +90,7 @@ export async function waitForTxConfirmation( await pollTransaction(transactionHash); await expect( page.getByText("In Progress", { exact: true }).first() //FIXME: Only one element needs to be displayed - ).not.toBeVisible({ timeout: 60_000 }); + ).not.toBeVisible({ timeout: 90_000 }); } } catch (error) { Logger.fail(error.message); diff --git a/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts b/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts index 571d0688a..76b1187b0 100644 --- a/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts @@ -174,7 +174,11 @@ export default class BudgetDiscussionPage { // API validation for (let i = 0; i <= proposals.length - 2; i++) { const isValid = validationFn(proposals[i], proposals[i + 1]); - expect(isValid).toBe(true); + expect(isValid, { + message: + !isValid && + `Failed on sorting ${type} with proposals: ${proposals[i].id} and ${proposals[i + 1].id}`, + }).toBe(true); } } diff --git a/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts b/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts index c2c301c39..231ee041a 100644 --- a/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts @@ -183,7 +183,11 @@ export default class ProposalDiscussionPage { // API validation for (let i = 0; i <= proposals.length - 2; i++) { const isValid = validationFn(proposals[i], proposals[i + 1]); - expect(isValid).toBe(true); + expect(isValid, { + message: + !isValid && + `Failed on sorting ${type} with proposals: ${proposals[i].id} and ${proposals[i + 1].id}`, + }).toBe(true); } } diff --git a/tests/govtool-frontend/playwright/lib/types.ts b/tests/govtool-frontend/playwright/lib/types.ts index 2ffdac42c..8f223240d 100644 --- a/tests/govtool-frontend/playwright/lib/types.ts +++ b/tests/govtool-frontend/playwright/lib/types.ts @@ -210,6 +210,7 @@ export type ProposedGovAction = { attributes: { proposal_id: string; prop_name: string; + createdAt: string; }; }; creator: { diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts index 4cf3b5fb3..81954b640 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts @@ -108,6 +108,7 @@ test.describe("Budget proposal list manipulation", () => { }); test("11B_3. Should sort budget proposals", async () => { + test.slow(); const sortOptions = { Oldest: (p1: ProposedGovAction, p2: ProposedGovAction) => p1.attributes.createdAt <= p2.attributes.createdAt, @@ -120,21 +121,35 @@ test.describe("Budget proposal list manipulation", () => { p1.attributes.prop_comments_number <= p2.attributes.prop_comments_number, "Name A-Z": (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.bd_proposal_detail.data.attributes.proposal_name.localeCompare( - p2.attributes.bd_proposal_detail.data.attributes.proposal_name - ) <= 0, + p1.attributes.bd_proposal_detail.data.attributes.proposal_name + .replace(/ /g, "") + .localeCompare( + p2.attributes.bd_proposal_detail.data.attributes.proposal_name.replace( + / /g, + "" + ) + ) <= 0, "Name Z-A": (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.bd_proposal_detail.data.attributes.proposal_name.localeCompare( - p2.attributes.bd_proposal_detail.data.attributes.proposal_name - ) >= 0, + p1.attributes.bd_proposal_detail.data.attributes.proposal_name + .replace(/ /g, "") + .localeCompare( + p2.attributes.bd_proposal_detail.data.attributes.proposal_name.replace( + / /g, + "" + ) + ) >= 0, "Proposer A-Z": (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.creator.data.attributes.govtool_username.localeCompare( - p2.attributes.creator.data.attributes.govtool_username - ) <= 0, + p1.attributes.creator.data.attributes.govtool_username + .replace(/ /g, "") + .localeCompare( + p2.attributes.creator.data.attributes.govtool_username + ) <= 0, "Proposer Z-A": (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.creator.data.attributes.govtool_username.localeCompare( - p2.attributes.creator.data.attributes.govtool_username - ) >= 0, + p1.attributes.creator.data.attributes.govtool_username + .replace(/ /g, "") + .localeCompare( + p2.attributes.creator.data.attributes.govtool_username + ) >= 0, }; for (const [option, validationFn] of Object.entries(sortOptions)) { diff --git a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts index a895ecfa5..37cd34c43 100644 --- a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts +++ b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts @@ -69,11 +69,14 @@ test.describe("Filter and sort proposals", () => { }); test("8B_2. Should sort the list of proposed governance actions.", async () => { + test.slow(); const sortOptions = { Oldest: (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.createdAt <= p2.attributes.createdAt, + p1.attributes.content.attributes.createdAt <= + p2.attributes.content.attributes.createdAt, Newest: (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.createdAt >= p2.attributes.createdAt, + p1.attributes.content.attributes.createdAt >= + p2.attributes.content.attributes.createdAt, "Most likes": (p1: ProposedGovAction, p2: ProposedGovAction) => p1.attributes.prop_likes >= p2.attributes.prop_likes, "Least likes": (p1: ProposedGovAction, p2: ProposedGovAction) => @@ -89,13 +92,17 @@ test.describe("Filter and sort proposals", () => { p1.attributes.prop_comments_number <= p2.attributes.prop_comments_number, "Name A-Z": (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.content.attributes.prop_name.localeCompare( - p2.attributes.content.attributes.prop_name - ) <= 0, + p1.attributes.content.attributes.prop_name + .replace(/ /g, "") + .localeCompare( + p2.attributes.content.attributes.prop_name.replace(/ /g, "") + ) <= 0, "Name Z-A": (p1: ProposedGovAction, p2: ProposedGovAction) => - p1.attributes.content.attributes.prop_name.localeCompare( - p2.attributes.content.attributes.prop_name - ) >= 0, + p1.attributes.content.attributes.prop_name + .replace(/ /g, "") + .localeCompare( + p2.attributes.content.attributes.prop_name.replace(/ /g, "") + ) >= 0, }; for (const [sortOption, sortFunction] of Object.entries(sortOptions)) {