Skip to content

Commit

Permalink
test: Fix DOM autosetup test flake (#7448)
Browse files Browse the repository at this point in the history
The promise for DOM auto setup tests doesn't guarantee that load() is
complete, only that we started it. So checking video duration causes
flake, in particular on slow devices like Tizen. Instead, check for the
player to have an asset URI.
  • Loading branch information
joeyparrish committed Oct 21, 2024
1 parent d7338cc commit 978ff53
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/ui/ui_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ describe('UI', () => {
});

it('has loaded the video', () => {
expect(video.duration).not.toBeNaN();
expect(video.duration).not.toBe(0);
// The above promise for DOMAutoSetup() doesn't guarantee that load()
// is complete, only that we started it. So don't check duration or
// other things that require load() to complete.
const overlay = /** @type {!shaka.ui.Overlay} */(video['ui']);
const player = overlay.getControls().getPlayer();
expect(player.getAssetUri()).toBeTruthy();
});
});

Expand Down Expand Up @@ -119,8 +123,12 @@ describe('UI', () => {
});

it('has loaded the video', () => {
expect(video.duration).not.toBeNaN();
expect(video.duration).not.toBe(0);
// The above promise for DOMAutoSetup() doesn't guarantee that load()
// is complete, only that we started it. So don't check duration or
// other things that require load() to complete.
const overlay = /** @type {!shaka.ui.Overlay} */(video['ui']);
const player = overlay.getControls().getPlayer();
expect(player.getAssetUri()).toBeTruthy();
});
});

Expand Down

0 comments on commit 978ff53

Please sign in to comment.