Skip to content

Commit 8b5e284

Browse files
committed
fix: add proper proposal load page await
1 parent e2d8e4b commit 8b5e284

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export default class GovernanceActionsPage {
5555
async viewFirstProposalByGovernanceAction(
5656
governanceAction: GovernanceActionType
5757
): Promise<GovernanceActionDetailsPage> {
58-
const proposalCard = this.page
59-
.getByTestId(`govaction-${governanceAction}-card`)
60-
.first();
58+
const proposalCard = this.page
59+
.locator('[data-testid^="govaction-"][data-testid$="-card"]')
60+
.first();
6161

6262
const isVisible = await proposalCard.isVisible();
6363

@@ -76,6 +76,21 @@ export default class GovernanceActionsPage {
7676
}
7777
}
7878

79+
async getFirstProposal(
80+
governanceAction: GovernanceActionType
81+
) {
82+
await functionWaitedAssert(
83+
async () => {
84+
const proposalCard = this.page
85+
.locator('[data-testid^="govaction-"][data-testid$="-card"]')
86+
.first();
87+
88+
await expect(proposalCard
89+
.locator('[data-testid^="govaction-"][data-testid$="-view-detail"]')
90+
.first()).toBeVisible()
91+
}, { name: "Retrying to get the first proposal" });
92+
}
93+
7994
async viewVotedProposal(
8095
proposal: IProposal
8196
): Promise<GovernanceActionDetailsPage> {
@@ -122,7 +137,7 @@ export default class GovernanceActionsPage {
122137
expect(
123138
hasFilter,
124139
hasFilter == false &&
125-
`A proposal card does not contain any of the ${filters}`
140+
`A proposal card does not contain any of the ${filters}`
126141
).toBe(true);
127142
}
128143
}

tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,12 @@ test.describe("Logged in DReps", () => {
4242
timeout: 60_000,
4343
});
4444

45-
await expect(
46-
page.getByTestId("dRep-id-display-card-dashboard")
47-
).toContainText(dRep01Wallet.dRepId, { timeout: 60_000 });
48-
45+
4946
const governanceActionsPage = new GovernanceActionsPage(page);
50-
47+
5148
await governanceActionsPage.goto();
52-
53-
await expect(page.getByText(/info action/i).first()).toBeVisible({
54-
timeout: 60_000,
55-
});
56-
49+
50+
await governanceActionsPage.getFirstProposal(GovernanceActionType.InfoAction);
5751
const governanceActionDetailsPage =
5852
await governanceActionsPage.viewFirstProposalByGovernanceAction(
5953
GovernanceActionType.InfoAction

0 commit comments

Comments
 (0)