Bug 1465077 - Part 2: Add a test which checks whether the scrubber never be located at negative position. r?pbro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Fri, 01 Jun 2018 00:20:20 +0900
changeset 802159 8d882d78a8146ac0793cd87ac0698ffc82bf7a2b
parent 802158 ca9a53e0db9ce5a480a94c3cabe2a7dcf5b89bd6
push id111842
push userbmo:dakatsuka@mozilla.com
push dateThu, 31 May 2018 15:20:55 +0000
reviewerspbro
bugs1465077
milestone62.0a1
Bug 1465077 - Part 2: Add a test which checks whether the scrubber never be located at negative position. r?pbro MozReview-Commit-ID: 1xeOzaJlYwH
devtools/client/inspector/animation/test/browser_animation_pause-resume-button_end-time.js
--- a/devtools/client/inspector/animation/test/browser_animation_pause-resume-button_end-time.js
+++ b/devtools/client/inspector/animation/test/browser_animation_pause-resume-button_end-time.js
@@ -21,27 +21,35 @@ add_task(async function() {
                   ["running", "finished", "finished"]);
   await clickOnCurrentTimeScrubberController(animationInspector, panel, 0);
 
   info("Check animations state after resuming without infinite animation");
   info("Remove infinite animation");
   await setClassAttribute(animationInspector, ".animated", "ball still");
   info("Make the current time of animation to be over its end time");
   await clickOnCurrentTimeScrubberController(animationInspector, panel, 1);
+  await clickOnPlaybackRateSelector(animationInspector, panel, 10);
   info("Resume animations");
   await clickOnPauseResumeButton(animationInspector, panel);
   assertPlayState(animationInspector.state.animations, ["running", "running"]);
   assertCurrentTimeLessThanDuration(animationInspector.state.animations);
+  assertScrubberPosition(panel);
 });
 
 function assertPlayState(animations, expectedState) {
   animations.forEach((animation, index) => {
     is(animation.state.playState, expectedState[index],
        `The playState of animation [${ index }] should be ${ expectedState[index] }`);
   });
 }
 
 function assertCurrentTimeLessThanDuration(animations) {
   animations.forEach((animation, index) => {
     ok(animation.state.currentTime < animation.state.duration,
-       "The current time of animation[${ index }] should be less than its duration");
+       `The current time of animation[${ index }] should be less than its duration`);
   });
 }
+
+function assertScrubberPosition(panel) {
+  const scrubberEl = panel.querySelector(".current-time-scrubber");
+  const translateX = parseFloat(scrubberEl.style.transform.match(/-?\d+(\.\d+)?/)[0]);
+  ok(translateX >= 0, "The translateX of scrubber position should be zero or more");
+}