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
Can't call overridden method #20
Comments
Seems that i've found the root of the problem. export default class ElementDecorator extends ElementFinder {
|
@voropa This patching seems to be applied AFTER instance is created, so it override your declared methods in I will take a look how this can be fixed on protractor-element-extend level. Thanks for bug report! For now, as a workaround i can suggest to not override methods:
|
Sure. And I've found another workaround but it is not stable and depends on elementArrayFinder realization. |
Anyway protractor and native selenium action methods are protected from overriding by default. |
@voropa Can you please test with And also i fixed same issue for BaseArrayFragment also |
@Xotabu4 And then i'm getting TypeError when trying to run the test using this element wrapper: |
@voropa angular/protractor#5328 |
Hello. Any updates on this issue? I wrap my own classes so its not really nice to see methods |
@Skidush Hello, unfortunately i can't fix this on library side. Protractor uses monkey patching after constructor was called, so all methods from this list
are patched after extended component is created so this overrides methods back to default. I will ask protractor team again to merge PR and release a new version. |
Wow that was quick. Thanks for the response! Great library btw! |
Hi!
I have tried to extend ElemetFinder and override it's "click" method, but when i call element.click() in my test scenario default ElementFinder click() event is fired. Here is the example of my code below.
`export default class ElementDecorator extends BaseFragment {
protected logger = CustomLogger.get('ElementDecorator');
constructor(elementFinder: ElementFinder) {
super(elementFinder);
}
public async click(): Promise {
this.logger.info('my click');
await this.scrollIntoView();
await WaitUtils.waitForClickable(this);
await super.click();
}
}
export default class MyPageObjectClass {
private myButton: ElementDecorator;
constructor() {
this.myButton= new ElementDecorator($(#button));
}
public async clickMyButton() {
this.logger.info('Clicking my button');
await this.myButton.click();
}
}`
The text was updated successfully, but these errors were encountered: