Browse Source

feat(testing): Resolved flakyness

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
440d3dafde
  1. 6
      scripts/playwright/pages/Base.ts
  2. 3
      scripts/playwright/pages/Grid.ts

6
scripts/playwright/pages/Base.ts

@ -9,11 +9,11 @@ export class BasePage {
}
async toastWait({message}: {message: string}) {
const toast = await this.page.locator('.ant-message .ant-message-notice-content', {hasText: message}).last();
await toast.waitFor({state: 'visible'});
// const toast = await this.page.locator('.ant-message .ant-message-notice-content', {hasText: message}).last();
// await toast.waitFor({state: 'visible'});
// todo: text of toastr shows old one in the test assertion
await toast.last().textContent()
await this.page.locator('.ant-message .ant-message-notice-content', {hasText: message}).last().textContent()
.then((text) => expect(text).toContain(message));
}
}

3
scripts/playwright/pages/Grid.ts

@ -34,7 +34,8 @@ export class GridPage {
}
async verifyRowDoesNotExist({index}: {index: number}) {
return expect(await this.page.locator(`td[data-pw="cell-Title-${index}"]`)).toBeFalsy();
await this.page.locator(`td[data-pw="cell-Title-${index}"]`).waitFor({state: 'hidden'});
return expect(await this.page.locator(`td[data-pw="cell-Title-${index}"]`).count()).toBe(0);
}
async deleteRow(index: number) {

Loading…
Cancel
Save