openmct/e2e/commonActions.js
Jesse Mazzella 413cb13edf
[e2e] Fix flaky exampleImagery zoom tests (#5517)
* extract zoom logic to functions and update test

* Refactor other tests to use new button zoom fns

* e2e:ci ++exampleImagery

* try polling

* try wait for animations

* code review comments

* fix syntax
2022-07-15 16:39:55 -07:00

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
};