faltest
faltest copied to clipboard
Extend capability of Element
I tried to define custom element that inherits faltest Element:
const { Element: _Element } = require('@faltest/page-objects');
class Element extends _Element {
async foo() {
await super.click();
await ...;
}
}
And then I tried to use it in my code:
...
button: create(
'[data-test-my-button]',
),
...
click: async() => {
await pageObject.button.foo();
}
...
But this ends with:
TypeError: pageObject.button.foo is not a function
Notes for my future self:
maybe it could via the prototype chain of the class container? or you could set it in the constructor?