Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: FE testLibrary initialization #286

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions client-side-js/injectUI5.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ async function clientSide_injectUI5(config, waitForUI5Timeout) {
// known side effect this call triggers the back to node scope, the other sap.ui.require continue to run in background in browser scope
done(true)
})
// see also /client-side-js/testLibrary.js
sap.ui.require(
["sap/fe/test/ListReport", "sap/fe/test/ObjectPage", "sap/fe/test/Shell"],
(ListReport, ObjectPage, Shell) => {
window.fe_bridge.ListReport = ListReport
window.fe_bridge.ObjectPage = ObjectPage
window.fe_bridge.Shell = Shell
// logs for the FE Testlib responses
window.fe_bridge.Log = []
}
)

// make sure the resources are required
// TODO: "sap/ui/test/matchers/Sibling",
sap.ui.require(
Expand Down
19 changes: 18 additions & 1 deletion client-side-js/testLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,25 @@ async function addToQueue(type, target, aMethods) {
)
}

async function loadFELibraries() {
return await browser.executeAsync((done) => {
sap.ui.require(
["sap/fe/test/ListReport", "sap/fe/test/ObjectPage", "sap/fe/test/Shell"],
(ListReport, ObjectPage, Shell) => {
window.fe_bridge.ListReport = ListReport
window.fe_bridge.ObjectPage = ObjectPage
window.fe_bridge.Shell = Shell
// logs for the FE Testlib responses
window.fe_bridge.Log = []
done()
}
)
})
}

module.exports = {
emptyQueue,
initOPA,
addToQueue
addToQueue,
loadFELibraries
}
3 changes: 2 additions & 1 deletion src/lib/wdi5-fe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { initOPA, addToQueue, emptyQueue } from "../../client-side-js/testLibrary"
import { initOPA, addToQueue, emptyQueue, loadFELibraries } from "../../client-side-js/testLibrary"
import { Logger as _Logger } from "./Logger"
const Logger = _Logger.getInstance()

Expand All @@ -25,6 +25,7 @@ function createProxy(myObj: any, type: string, methodCalls: any[], pageKeys: str
export class WDI5FE {
constructor(private appConfig: any) {}
static async initialize(appConfig) {
await loadFELibraries()
await initOPA(appConfig)
return new WDI5FE(appConfig)
}
Expand Down