Skip to content

Commit

Permalink
✅ [Story player] Fix animation unit test flakiness (ampproject#34382)
Browse files Browse the repository at this point in the history
* added animation options

* Removed animation from behaviordef

* Added newline on player

* Added documentation on options

* Use next to toggle animation

* Use transitionend

* Using classes for CSS

* Reverted requestAnimationFrame promise

* Added tests

* Apply suggestions from code review

Co-authored-by: Enrique Marroquin <5449100+Enriqe@users.noreply.github.com>

* Use true instead of property

Co-authored-by: Enrique Marroquin <5449100+Enriqe@users.noreply.github.com>

* Removed trailing whitespace

* Fixed linting

* Wait for transitionend

Co-authored-by: Enrique Marroquin <5449100+Enriqe@users.noreply.github.com>
  • Loading branch information
2 people authored and rochapablo committed Aug 30, 2021
1 parent a6f9485 commit 702582d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/unit/test-amp-story-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {AmpStoryPlayer} from '../../src/amp-story-player/amp-story-player-impl';
import {Messaging} from '@ampproject/viewer-messaging';
import {PageScroller} from '../../src/amp-story-player/page-scroller';
import {expect} from 'chai';
import {listenOncePromise} from '../../src/event-helper';
import {macroTask} from '../../testing/yield';

describes.realWin('AmpStoryPlayer', {amp: false}, (env) => {
let win;
Expand Down Expand Up @@ -1499,7 +1501,8 @@ describes.realWin('AmpStoryPlayer', {amp: false}, (env) => {
.querySelector('.i-amphtml-story-player-main-container');

// Wait for event dispatched to be listened
await new Promise((resolve) => setTimeout(() => resolve(), 50));
await listenOncePromise(playerEl, 'transitionend');
await macroTask();

expect(
rootEl.classList.contains(
Expand Down

0 comments on commit 702582d

Please sign in to comment.