ui5-typescript
ui5-typescript copied to clipboard
`@sapui5/ts-types-esm` - `PageObjectDefinition.actions` & `assertions` function types should have a `this` parameter
export type PageObjectDefinition = {
//...
actions?: Record<string, (this: Opa5) => void>;
assertions?: Record<string, (this: Opa5) => void>;
}
otherwise this example won't compile bcause the this type is not defined:
Opa5.createPageObjects({
onTheAppPage: {
actions: {},
assertions: {
iShouldSeeTheApp: function () {
// error: Cannot invoke an object which is possibly 'undefined'
this.waitFor({
id: 'myButton',
actions: function () {},
success: function () {},
})
},
},
},
})
Same like #306 - testing related code wasn't in focus of TS API support so far.