-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add some utils for stabilize flaky (#6869)
Co-authored-by: taiga-family-bot <[email protected]>
- Loading branch information
1 parent
9a7dff9
commit f49763c
Showing
8 changed files
with
78 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Locator} from '@playwright/test'; | ||
|
||
export async function waitStableState(locator: Locator): Promise<void> { | ||
try { | ||
const handle = await locator.elementHandle(); | ||
|
||
// https://playwright.dev/docs/actionability#stable | ||
// element is Stable, as in not animating or completed animation | ||
// Element is considered stable when it has maintained | ||
// the same bounding box for at least two consecutive animation frames. | ||
await handle?.waitForElementState('stable'); | ||
|
||
// https://playwright.dev/docs/actionability#visible | ||
// Element is considered visible when it has non-empty bounding box | ||
await handle?.waitForElementState('visible'); | ||
} catch {} | ||
} |