Skip to content

Commit

Permalink
chore: add some timeouts for prevent flaky (#5722)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Oct 23, 2023
1 parent 726bc9b commit c481347
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ describe(`TablePagination`, () => {

cy.get(`@linesPerPageSelect`).click();
waitForCheckmarkIcon();
cy.get(`@tablePagination`).matchImageSnapshot(`0-[size]-dropdown-base`, {
padding: [0, 0, 150, 0],
});
cy.get(`@tablePagination`)
.tuiWaitBeforeScreenshot()
.matchImageSnapshot(`0-[size]-dropdown-base`, {
padding: [0, 0, 150, 0],
});
});

it(`With very long option name`, () => {
Expand All @@ -25,12 +27,11 @@ describe(`TablePagination`, () => {

cy.get(`@linesPerPageSelect`).click();
waitForCheckmarkIcon();
cy.get(`@tablePagination`).matchImageSnapshot(
`1-[size]-dropdown-long-option-name`,
{
cy.get(`@tablePagination`)
.tuiWaitBeforeScreenshot()
.matchImageSnapshot(`1-[size]-dropdown-long-option-name`, {
padding: [0, 0, 100, 0],
},
);
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ describe(`DataList`, () => {
.type(`{rightarrow}`)
.type(`{downarrow}`.repeat(2));

cy.get(`tui-doc-page`).matchImageSnapshot(`3-#submenu`, {
capture: `viewport`,
});
cy.get(`tui-doc-page`)
.tuiWaitBeforeScreenshot()
.matchImageSnapshot(`3-#submenu`, {
capture: `viewport`,
});
});

it(`Form control`, () => {
cy.get(`#control [automation-id=${tuiEnsureDocExample()}] tui-hosted-dropdown`)
.tuiScrollIntoView()
.click();

cy.get(`tui-dropdown`).should(`be.visible`).matchImageSnapshot(`4-#control`);
cy.get(`tui-dropdown`)
.should(`be.visible`)
.tuiWaitBeforeScreenshot()
.matchImageSnapshot(`4-#control`);
});

it(`Complex`, {responseTimeout: 30_000}, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ test.describe(`MobileCalendar`, () => {
.first();

await chooseDateButton.click();
await page.waitForTimeout(2000);

await expect(example).toHaveScreenshot(`01-mobile-calendar.png`);
});

Expand All @@ -20,6 +22,8 @@ test.describe(`MobileCalendar`, () => {
const {apiPageExample} = new TuiDocumentationPagePO(page);

await apiPageExample.scrollIntoViewIfNeeded();
await page.waitForTimeout(2000);

await expect(page).toHaveScreenshot(`01-mobile-calendar-disabled.png`, {
mask: [page.locator(`tui-mobile-calendar`)],
});
Expand All @@ -30,6 +34,8 @@ test.describe(`MobileCalendar`, () => {
const {apiPageExample} = new TuiDocumentationPagePO(page);

await apiPageExample.scrollIntoViewIfNeeded();
await page.waitForTimeout(2000);

await expect(page).toHaveScreenshot(`01-mobile-calendar-enabled.png`, {
mask: [page.locator(`tui-mobile-calendar`)],
});
Expand Down

0 comments on commit c481347

Please sign in to comment.