Skip to content

Commit 36c3635

Browse files
authored
Merge pull request #3139 from IntersectMBO/fix/report-344-flaky-test
Fix: Report 344 flaky/failing test
2 parents f19a964 + a7e043b commit 36c3635

File tree

17 files changed

+88
-71
lines changed

17 files changed

+88
-71
lines changed

tests/govtool-frontend/playwright/lib/forms/dRepForm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default class DRepForm {
174174
.getByTestId(formErrors.paymentAddress)
175175
.isVisible();
176176

177-
expect(await this.objectivesInput.textContent(), {
177+
expect(await this.objectivesInput.textContent({ timeout: 60_000 }), {
178178
message:
179179
objectivesInputText !== dRepInfo.objectives &&
180180
`${dRepInfo.objectives} is not equal to ${await this.objectivesInput.textContent()}`,
@@ -255,7 +255,7 @@ export default class DRepForm {
255255
message:
256256
!isPaymentAddressErrorVisible &&
257257
`${dRepInfo.paymentAddress} is a valid paymentAddress`,
258-
}).toBeVisible();
258+
}).toBeVisible({ timeout: 60_000 });
259259

260260
expect(await this.objectivesInput.textContent(), {
261261
message:

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export default class DRepDirectoryPage {
4545

4646
constructor(private readonly page: Page) {}
4747

48+
get currentPage(): Page {
49+
return this.page;
50+
}
51+
4852
async goto() {
4953
await this.page.goto(
5054
`${environments.frontendUrl}/connected/drep_directory`
@@ -184,7 +188,7 @@ export default class DRepDirectoryPage {
184188
}
185189

186190
async getAllListedDReps() {
187-
await expect(this.searchInput).toBeVisible({ timeout: 10_000 });
191+
await expect(this.searchInput).toBeVisible({ timeout: 60_000 });
188192

189193
await waitedLoop(async () => {
190194
return (

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,17 @@ export default class ProposalDiscussionPage {
131131
const proposalCards = await this.getAllProposals();
132132

133133
for (const proposalCard of proposalCards) {
134-
const type = await proposalCard
135-
.getByTestId("governance-action-type")
136-
.textContent();
137-
const hasFilter = await validateFunction(proposalCard, filters);
138-
if (!hasFilter) {
139-
const errorMessage = `A governance action type ${type} does not contain on ${filters}`;
140-
throw errorMessage;
134+
if (await proposalCard.isVisible()) {
135+
const type = await proposalCard
136+
.getByTestId("governance-action-type")
137+
.textContent();
138+
const hasFilter = await validateFunction(proposalCard, filters);
139+
if (!hasFilter) {
140+
const errorMessage = `A governance action type ${type} does not contain on ${filters}`;
141+
throw errorMessage;
142+
}
143+
expect(hasFilter).toBe(true);
141144
}
142-
expect(hasFilter).toBe(true);
143145
}
144146
});
145147
}

tests/govtool-frontend/playwright/lib/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ export interface outcomeProposal {
291291
}
292292

293293
export interface outcomeMetadata {
294-
authors: any[];
295-
hashAlgorithm: string;
296-
body: outcomeMetadataBody;
294+
metadataStatus: string;
295+
metadataValid: boolean;
296+
data: outcomeMetadataBody;
297297
}
298298

299299
interface outcomeMetadataBody {

tests/govtool-frontend/playwright/tests/2-delegation/delegation.loggedin.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ test.describe("DRep dependent tests", () => {
9292
await page.getByTestId(`${dRepId}-delegate-button`).click();
9393

9494
await expect(dRepDirectoryPage.delegationErrorModal).toBeVisible({
95-
timeout: 10_000,
95+
timeout: 60_000,
9696
});
9797
await expect(dRepDirectoryPage.delegationErrorModal).toHaveText(
9898
/UTxO Balance Insufficient/
@@ -102,7 +102,7 @@ test.describe("DRep dependent tests", () => {
102102
test("2I. Should check validity of DRep Id", async () => {
103103
await dRepDirectoryPage.searchInput.fill(dRepId);
104104
await expect(dRepDirectoryPage.getDRepCard(dRepId)).toBeVisible({
105-
timeout: 20_000,
105+
timeout: 60_000,
106106
});
107107

108108
const wallet = await ShelleyWallet.generate();

tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ test.describe("DRep dependent tests", () => {
215215
await dRepDirectoryPage.searchInput.fill(dRepId);
216216
await page.getByTestId(`${dRepId}-copy-id-button`).click();
217217
await expect(page.getByText("Copied to clipboard")).toBeVisible({
218-
timeout: 10_000,
218+
timeout: 60_000,
219219
});
220220
const copiedTextDRepDirectory = await page.evaluate(() =>
221221
navigator.clipboard.readText()

tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test.describe("Delegate to others", () => {
5959
.getByTestId(`${dRepId}-delegated-card`)
6060
.getByTestId(`${dRepId}-copy-id-button`)
6161
).toHaveCount(1, {
62-
timeout: 20_000,
62+
timeout: 60_000,
6363
});
6464

6565
// Verify dRepId in dashboard
@@ -103,7 +103,7 @@ test.describe("Change delegation", () => {
103103
page
104104
.getByTestId(`${dRepIdFirst}-delegated-card`)
105105
.getByTestId(`${dRepIdFirst}-copy-id-button`)
106-
).toHaveText(`(CIP-105) ${dRepIdFirst}`, { timeout: 20_000 });
106+
).toHaveText(`(CIP-105) ${dRepIdFirst}`, { timeout: 60_000 });
107107

108108
// verify delegation
109109
await dRepDirectoryPage.delegateToDRep(dRepIdSecond);
@@ -114,7 +114,7 @@ test.describe("Change delegation", () => {
114114
page
115115
.getByTestId(`${dRepIdSecond}-delegated-card`)
116116
.getByTestId(`${dRepIdSecond}-copy-id-button`)
117-
).toHaveText(`(CIP-105) ${dRepIdSecond}`, { timeout: 20_000 });
117+
).toHaveText(`(CIP-105) ${dRepIdSecond}`, { timeout: 60_000 });
118118
});
119119
});
120120

@@ -145,13 +145,13 @@ test.describe("Register DRep state", () => {
145145
await dRepPage.getByTestId("continue-button").click();
146146
await expect(
147147
dRepPage.getByTestId("registration-transaction-submitted-modal")
148-
).toBeVisible({ timeout: 15_000 });
148+
).toBeVisible({ timeout: 60_000 });
149149
await dRepPage.getByTestId("confirm-modal-button").click();
150150
await waitForTxConfirmation(dRepPage);
151151

152152
// Checks in dashboard
153153
await expect(dRepPage.getByText("You are a Direct Voter")).toBeVisible({
154-
timeout: 20_000,
154+
timeout: 60_000,
155155
});
156156
await expect(
157157
dRepPage.getByTestId("register-as-sole-voter-button")
@@ -168,11 +168,11 @@ test.describe("Register DRep state", () => {
168168
await dRepPage.getByTestId("continue-button").click();
169169
await expect(
170170
dRepPage.getByTestId("registration-transaction-submitted-modal")
171-
).toBeVisible({ timeout: 15_000 });
171+
).toBeVisible({ timeout: 60_000 });
172172
await dRepPage.getByTestId("confirm-modal-button").click();
173173
await waitForTxConfirmation(dRepPage);
174174
await expect(dRepPage.getByText("You are a Direct Voter")).toBeVisible({
175-
timeout: 20_000,
175+
timeout: 60_000,
176176
});
177177

178178
const dRepDirectoryPage = new DRepDirectoryPage(dRepPage);
@@ -183,12 +183,11 @@ test.describe("Register DRep state", () => {
183183

184184
await expect(
185185
dRepPage.getByText("You Have Retired as a Direct")
186-
).toBeVisible({ timeout: 20_000 });
186+
).toBeVisible({ timeout: 60_000 });
187187
});
188188
});
189189

190190
test("2G. Should delegate to myself", async ({ page, browser }, testInfo) => {
191-
test.skip();
192191
test.setTimeout(testInfo.timeout + environments.txTimeOut);
193192

194193
const wallet = await walletManager.popWallet("registeredDRep");
@@ -207,14 +206,13 @@ test("2G. Should delegate to myself", async ({ page, browser }, testInfo) => {
207206
await dRepDirectoryPage.delegateToDRep(dRepId);
208207

209208
await expect(
210-
dRepPage.getByTestId(`${dRepId}-delegate-button')`)
211-
).not.toBeVisible();
212-
await expect(dRepPage.getByTestId(`${dRepId}-copy-id-button`)).toHaveCount(
213-
1,
214-
{
215-
timeout: 20_000,
216-
}
217-
);
209+
dRepDirectoryPage.currentPage.getByTestId(`${dRepId}-delegate-button`)
210+
).not.toBeVisible({ timeout: 60_000 });
211+
await expect(
212+
dRepDirectoryPage.currentPage.getByTestId(`${dRepId}-copy-id-button`)
213+
).toHaveCount(1, {
214+
timeout: 60_000,
215+
});
218216
});
219217

220218
test.describe("Multiple delegations", () => {
@@ -233,14 +231,14 @@ test.describe("Multiple delegations", () => {
233231

234232
await page.getByTestId(`${dRep01Wallet.dRepId}-delegate-button`).click();
235233
await expect(page.getByTestId("alert-warning")).toHaveText(/in progress/i, {
236-
timeout: 15_000,
234+
timeout: 60_000,
237235
});
238236

239237
await dRepDirectoryPage.searchInput.fill(dRep02Wallet.dRepId);
240238
await page.getByTestId(`${dRep02Wallet.dRepId}-delegate-button`).click();
241239

242240
await expect(page.getByTestId("transaction-inprogress-modal")).toBeVisible({
243-
timeout: 15_000,
241+
timeout: 60_000,
244242
});
245243
});
246244
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ test("3F. Should create proper DRep registration request, when registered with d
196196
await dRepRegistrationPage.registerWithoutTxConfirmation({ name: "Test" });
197197
await expect(
198198
page.getByTestId("registration-transaction-error-modal")
199-
).toBeVisible({ timeout: 10_000 });
199+
).toBeVisible({ timeout: 60_000 });
200200
});
201201

202202
test("3O. Should reject invalid dRep registration metadata", async ({

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test.describe("Validation of edit dRep Form", () => {
7373
const editDRepPage = new EditDRepPage(page);
7474
await editDRepPage.goto();
7575

76-
await expect(editDRepPage.nameInput).toBeVisible({ timeout: 20_000 }); // assert to wait for the page to load
76+
await expect(editDRepPage.nameInput).toBeVisible({ timeout: 60_000 }); // assert to wait for the page to load
7777

7878
for (let i = 0; i < 100; i++) {
7979
await editDRepPage.inValidateForm({

tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test.describe("Logged in DRep", () => {
4545

4646
await expect(page.getByTestId("voting-power-chips-value")).toHaveText(
4747
`₳ ${lovelaceToAda(votingPower)}`,
48-
{ timeout: 20_000 }
48+
{ timeout: 60_000 }
4949
);
5050
});
5151

@@ -57,7 +57,7 @@ test.describe("Logged in DRep", () => {
5757

5858
// assert to wait until the loading button is hidden
5959
await expect(page.getByTestId("to-vote-tab")).toBeVisible({
60-
timeout: 20_000,
60+
timeout: 60_000,
6161
});
6262

6363
govActionDetailsPage = (await isBootStrapingPhase())

0 commit comments

Comments
 (0)