mirror of
https://github.com/nasa/openmct.git
synced 2025-01-05 04:44:14 +00:00
19 lines
561 B
JavaScript
19 lines
561 B
JavaScript
|
/**
|
||
|
* Wait for all animations within the given element and subtrees to finish
|
||
|
* See: https://github.com/microsoft/playwright/issues/15660#issuecomment-1184911658
|
||
|
* @param {import('@playwright/test').Locator} locator
|
||
|
*/
|
||
|
function waitForAnimations(locator) {
|
||
|
return locator
|
||
|
.evaluate((element) =>
|
||
|
Promise.all(
|
||
|
element
|
||
|
.getAnimations({ subtree: true })
|
||
|
.map((animation) => animation.finished)));
|
||
|
}
|
||
|
|
||
|
// eslint-disable-next-line no-undef
|
||
|
module.exports = {
|
||
|
waitForAnimations
|
||
|
};
|