Skip to content

Commit

Permalink
fix: wait for ui5
Browse files Browse the repository at this point in the history
- wait for ui5 till the timeout is reached and not the loading is finished
  • Loading branch information
Siolto committed Nov 30, 2022
1 parent cffa02e commit 02d7f58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/wdi5-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 02d7f58

Please # to comment.