Skip to content

Commit

Permalink
šŸ› Fix flaky test in amp-story-audio-sticker as a result of using `sā€¦
Browse files Browse the repository at this point in the history
ā€¦etTimeout` (#38952)
  • Loading branch information
danielrozenberg committed May 15, 2023
1 parent fd1b7f2 commit 4130d5e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {Deferred} from '#core/data-structures/promise';
import * as Preact from '#core/dom/jsx';
import {closestAncestorElementBySelector} from '#core/dom/query';
import {computedStyle} from '#core/dom/style';
Expand Down Expand Up @@ -129,7 +130,8 @@ describes.realWin(
storeService.dispatch(Action.TOGGLE_MUTED, true);
await nextTick();

// Wait until the animation is finished to check the opacitiy value.
// Wait until the animation is finished to check the opacity value.
const deferred = new Deferred();
setTimeout(() => {
doc
.querySelectorAll('.i-amphtml-amp-story-audio-sticker-tap-hint')
Expand All @@ -138,7 +140,8 @@ describes.realWin(
'1'
)
);
}, 500);
deferred.resolve();
}, 750);

doc.querySelectorAll('amp-story-audio-sticker-pretap').forEach((el) => {
expect(computedStyle(win, el).getPropertyValue('opacity')).equal('1');
Expand All @@ -150,6 +153,7 @@ describes.realWin(
'0'
)
);
return deferred.promise;
});
});

Expand Down

0 comments on commit 4130d5e

Please sign in to comment.