Skip to content

Commit

Permalink
test: Improve tests speed (#6557)
Browse files Browse the repository at this point in the history
This change reduces the duration of the tests by approximately 3
minutes.
  • Loading branch information
avelad committed May 8, 2024
1 parent 61ce88b commit 309d7d4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/test/util/waiter.js
Expand Up @@ -109,7 +109,7 @@ shaka.test.Waiter = class {
* @return {!Promise}
*/
waitUntilPlayheadReaches(mediaElement, timeGoal) {
this.macPlaybackWorkaround_(mediaElement);
this.improveTestSpeed_(mediaElement);

// The name of what we're waiting for
const goalName = 'movement from ' + mediaElement.currentTime +
Expand Down Expand Up @@ -155,7 +155,7 @@ shaka.test.Waiter = class {
* @return {!Promise}
*/
waitForEnd(mediaElement) {
this.macPlaybackWorkaround_(mediaElement);
this.improveTestSpeed_(mediaElement);

// The name of what we're waiting for.
const goalName = 'end of media';
Expand Down Expand Up @@ -398,14 +398,14 @@ shaka.test.Waiter = class {
* @param {!HTMLMediaElement} mediaElement
* @private
*/
macPlaybackWorkaround_(mediaElement) {
if (shaka.util.Platform.isMac()) {
// Work around bizarre playback slowdowns that only seem to occur with
// WebDriver and only on Mac. Increasing the playback rate allows tests
// to complete without timing out.
if (mediaElement.playbackRate == 1) {
mediaElement.playbackRate = 2;
}
improveTestSpeed_(mediaElement) {
// Work around bizarre playback slowdowns that only seem to occur with
// WebDriver and only on Mac. Increasing the playback rate allows tests
// to complete without timing out.
// We also use it on all platforms (except Tizen) because it reduces the
// time it takes for tests to run.
if (mediaElement.playbackRate == 1 && !shaka.util.Platform.isTizen()) {
mediaElement.playbackRate = 2;
}
}
};

0 comments on commit 309d7d4

Please sign in to comment.