Skip to content

Commit de5de08

Browse files
test(e2e): resolve flaky tour tests
1 parent 61d8b93 commit de5de08

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

playwright/e2e/element-examples/si-tour.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,29 @@ test.describe('si-tour', () => {
1111
const nextClick = (): Promise<any> =>
1212
page.locator('si-tour button', { hasText: 'Next' }).click();
1313

14+
const waitForTourStep = async (hasArrow = true): Promise<void> => {
15+
await expect(page.locator('si-tour .tour-content.show')).toBeVisible();
16+
if (hasArrow) {
17+
await expect(page.locator('si-tour .popover-arrow')).toBeVisible();
18+
}
19+
};
20+
1421
await si.visitExample(example);
15-
await expect(page.locator('.tour-content')).toBeVisible();
22+
await waitForTourStep();
1623
await si.runVisualAndA11yTests('first-step');
1724

1825
await nextClick();
19-
await expect(page.locator('.tour-content')).toBeVisible();
26+
await waitForTourStep();
2027
await si.runVisualAndA11yTests('second-step');
2128

2229
await nextClick();
2330
await nextClick();
2431
await nextClick();
2532
await nextClick();
26-
await expect(page.locator('.tour-content')).toBeVisible();
33+
await waitForTourStep();
2734
await si.runVisualAndA11yTests('open-menu');
2835
await nextClick();
29-
await expect(page.locator('.tour-content')).toBeVisible();
36+
await waitForTourStep(false);
3037
await si.runVisualAndA11yTests('last-step');
3138
});
3239
});

0 commit comments

Comments
 (0)