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

[Feature] Define Page.click options typing #5821

Closed
dipasqualew opened this issue Mar 14, 2021 · 4 comments
Closed

[Feature] Define Page.click options typing #5821

dipasqualew opened this issue Mar 14, 2021 · 4 comments

Comments

@dipasqualew
Copy link

Hi everyone,

Thanks for the fantastic library. Loving it.

I am working with the Page Object Model paradigm and I am creating a method to handle different combinations of mouse clicks. My method should accept an identifier (a string that will be used to identify what we are going to click) and an option object to specify what kind of click it will be (single? double? with CTRL? with SHIFT?).

I noticed that Page.click second parameter (options) is not typed as an interface that can be wrapped, as in Partial<MouseClickOptions>. Is there interest in adding similar types?

I am happy to create a PR in case.

Cheers

@pavelfeldman
Copy link
Member

This is something we considered, but never managed to commit to. It becomes a part of our semver api and we'd like to keep it minimal. Could you define them locally, next to your POM instead? Typescript will tolerate if objects match by shape.

@dipasqualew
Copy link
Author

That's what I am doing at the moment, so I do have a workaround, thanks!

I am curious on why you would prefer to keep the typing of an option parameter outside of the library, could you explain a bit more the reasoning behind it?

@pavelfeldman
Copy link
Member

If we expose MouseClickOptions, we would want to use it in Frame.click, Page.click, ElementHandle.click, maybe Mouse.down. But should these diverge for some reason (for example Page.click gains crossFrame option to support cross-frame), we would need to do MouseClick & PageClickSupplement. That way we commit to more maintenance work.

Mouse click is conservative enough to commit to it, but some other options are not, so we can't commit to maintaining 100 additional types across versions.

@dipasqualew
Copy link
Author

Thanks @pavelfeldman, I will close this issue in that case 🙂

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

2 participants