web: Wait until the player is fully ready, for tests

This commit is contained in:
Nathan Adams 2024-05-28 22:41:24 +02:00
parent dda7411589
commit 1712cd61e5
1 changed files with 7 additions and 2 deletions

View File

@ -74,8 +74,13 @@ export async function playAndMonitor(
await browser.waitUntil( await browser.waitUntil(
async () => async () =>
(await hasError(browser)) || (await hasError(browser)) ||
// @ts-expect-error TS2341 (await browser.execute(
(await browser.execute((player) => player.instance, player)), (player) =>
// https://github.com/webdriverio/webdriverio/issues/6486
// TODO: How can we import ReadyState enum?
(player as unknown as RufflePlayer).readyState === 2,
player,
)),
{ {
timeoutMsg: "Expected player to have initialized", timeoutMsg: "Expected player to have initialized",
}, },