Custom action for sap/fe/test/ObjectPage
Closed this issue · 2 comments
Describe the bug
The doco suggests you can add your own custom action to a page object
// custom action in own page object
await ListReportPage.iShouldSeeCustomFieldsInDialog()
however i cannot find an example
when I try the following like what i would do in opa
module.exports = {
ObjectPage: [{
appId: "com.apress.beershop", // MANDATORY: sap.app.id in manifest.json
componentId: "BeersObject", // MANDATORY: sap.ui5.routing.targets.id in manifest.json
entitySet: "Beers", // MANDATORY: entityset in manifest.json
},{ // CustomPageDefinitions
actions: {
iGetInputValue: async (sId) => {
return await browser.asControl({
selector: {
id: sId,
viewName: this._viewName,
interaction: {
idSuffix: "inner"
}
}
}).getValue()
}
},
assertions: {}
}]
};
The bridge code
window.bridge
.waitForUI5(window.wdi5.waitForUI5Options)
.then(() => {
const pageConfig = {}
Object.keys(pageObjectConfig).map((pageKey) => {
Object.keys(pageObjectConfig[pageKey]).forEach((className) => {
const options = pageObjectConfig[pageKey][className]
pageConfig[pageKey] = new window.fe_bridge[className](options)
})
})
calls the test template function and only sends the page definitions and not the additional page definitions also
https://ui5.sap.com/resources/sap/fe/test/ObjectPage.js
function ObjectPage(oPageDefinition, _aAdditionalPageDefinitions)
[className](options) options maps to oPageDefintion sa an array
[{appid ...},{ actions: ...}] and not two arguments meaning no additional page actions
can we have an example of how to populate the addtionPageDefintions for a page template?
or a way to apply arguments instead of one object
window.fe_bridge[className].apply(options)
Cheers
John P
When something can not be covered with the testLibrary you have to use standard wdi5. You don't have to extend anything. Just create your own page object like here
thanks i was reading it wrong
test library functions within the FioriElementsFacade and your test functions outside.
i thought it was suggesting you can do within
cheers
jsp