Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/govtool-frontend/playwright/lib/helpers/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\/([^\/]+)$/;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/govtool-frontend/playwright/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export type ProposedGovAction = {
attributes: {
proposal_id: string;
prop_name: string;
createdAt: string;
};
};
creator: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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)) {
Expand Down
Loading