-
-
Notifications
You must be signed in to change notification settings - Fork 153
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 pydantic style of PageObjects | opinionated POM implementation in Selene #505
Comments
Pay attention to difference between init and class attributes |
It will not, because they are not class attributes. In both python dataclasses and pydantic-based classes – the attributes that you define on the class level – are not class attributes – they are instance attributes. This is the main idea of such type of DSL. |
Hm, seems like we even not need full pydantic style of complete class kitchen DSL-based implementation. With simple python descriptors we already can achieve the following analog of the previous code example:
Where each Element object passed in context of "descriptor" will check fo existance of context self attribute, and if yes - use it as a root instead of a browser, otherwise – user selene shared browser. |
While self.open can be still implemented explicitely ;) No need to build a complete POM DSL around it... |
... via descriptor.within(context) + add test example
... via descriptor.within(context) + add test example
... to allow to define postponed context resolution
... built on top of other ones, that were not accessed yet
…tities... this way the API of descriptors will be easier to learn (because of similarity, and consistency), and less different from future version when we make descriptors built into selene.Entities... But... might confuse if we fail to make them built in:D Let's see...
... where first from "sub-" ones has no name
... where first from "sub-" ones has no name + TODO: should not we set attrs on instance, not lru_cache __get__ result?
... to fix tests on CI + TODO: seems like general timeout becomes 0.5 in some test, and stayed so mutated... find and consider fixing it...
... for lesser interference with selene.Element, etc.
... not descriptor (even via lru_cache)
+ DOCS: FAQ: How to simplify search by Test IDs? + [#505] TEST: utilize config.selector_to_by_strategy in pom example
+ DOCS: FAQ: How to simplify search by Test IDs? + [#505] TEST: utilize config.selector_to_by_strategy in pom example
+ TODO: implement pom-descriptor-like decorators to name objects returned from methods
+ TODO: implement pom-descriptor-like decorators to name objects returned from methods
Example:
as a shortcut to
consider also simplifying
container = selene.PageModel.Element('#ContinuousSlider+*')
tocontainer = selene.Element('#ContinuousSlider+*')
P.S. related to #439
The text was updated successfully, but these errors were encountered: