From 02d7f583ca7796af4b22879fd2286d8a44fef4f5 Mon Sep 17 00:00:00 2001 From: scoen Date: Wed, 30 Nov 2022 15:37:33 +0100 Subject: [PATCH] fix: wait for ui5 - wait for ui5 till the timeout is reached and not the loading is finished --- src/lib/wdi5-bridge.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/wdi5-bridge.ts b/src/lib/wdi5-bridge.ts index 85ac0069..147d7b08 100644 --- a/src/lib/wdi5-bridge.ts +++ b/src/lib/wdi5-bridge.ts @@ -134,10 +134,10 @@ export async function injectUI5(config: wdi5Config, browserInstance) { export async function checkForUI5Page(browserInstance) { // wait till the loading finished and the state is "completed" await browserInstance.waitUntil(async () => { - const state = await browserInstance.executeAsync((done) => { - done(document.readyState) + const checkState = await browserInstance.executeAsync((done) => { + done({ state: document.readyState, sapReady: !!window.sap }) }) - return state === "complete" + return checkState.state === "complete" && checkState.sapReady }) // sap in global window namespace denotes (most likely :) ) that ui5 is present return await browserInstance.executeAsync((done) => {