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

Extend capability of Element #437

Open
MichalBryxi opened this issue Mar 3, 2021 · 1 comment
Open

Extend capability of Element #437

MichalBryxi opened this issue Mar 3, 2021 · 1 comment

Comments

@MichalBryxi
Copy link

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
@MichalBryxi
Copy link
Author

Notes for my future self:

maybe it could via the prototype chain of the class container?
or you could set it in the constructor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant