test: Fix DOM autosetup test flake (#7448)

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.
This commit is contained in:
Joey Parrish
2024-10-21 00:05:16 -07:00
committed by GitHub
parent e883fedd69
commit 072fe75e69
+12 -4
View File
@@ -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();
});
});
@@ -118,8 +122,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();
});
});