-
Notifications
You must be signed in to change notification settings - Fork 90
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
Consider string as a scope #408
Comments
While the proposal feels ergonomic to me, unfortunately it's not a forward compatible change. If we accept the proposal then on the page object creation phase we need to guard if a found string is neither a |
After thinking about it more, I think we can achieve this. For now, we support 2 string properies on a page object definition. So in order achieve string scopes, we now have to guard if the key is not equal to I believe there is no any point to store on a definition any strings other than DOM query related. So probably we can isolate all of such props under some conventional key, and dissalow any strings other than const definition = {
// shorthand to describe "withAStringScope" component with a ".scope" scope
withAStringScope: '.scope',
// classic withAScope component with a ".scope" scope
withAScope: {
scope: '.scope'
},
compWithAComplexQuery: {
// any props contributing to the final CSS selector should be placed in ther
scope { // maybe "query" would be a more precise name?
selector '.scope',
testContainer: '.testContainer'
// `resetScope` and `at`?
}
}
} |
in order to unlock any strings to be considered as a scope(san650#408) in v2.
in order to unlock any strings to be considered as a scope(san650#408) in v2.
in order to unlock any strings to be considered as a scope(#408) in v2.
This is a feature request to slightly improve ergonomic of the Page Object Components definition.
Currently the shortest form of a component definition would look something like:
When I define few components on a page object it gets a bit noisy because we need to define an object with a
scope
option to create a component. For me the most used building blocks of the Page Object are Components. I think it's great to have a shorthand syntax for component definitions like we do have for collections, e.gcollection('items-selector')
.I propose to consider all the string values of a page object definition as a component selectors, so the minimal syntax to define a page object would look something like:
This change might break some existing page objects but honestly I can't imagine a use case for the need to store string values in the page object definition 🤔 Probably the feature (if)should be included in v2.
Would appreciate any thoughts.
The text was updated successfully, but these errors were encountered: