Motivation
The idea behind the library is to provide a convenient way for defining Cypress selectors declaratively.
You can find the list of possible ways for dealing with selectors in Cypress in the article on Medium.
Here is a brief breakdown of how you can work with selectors:
#
Hardcode 'em all ๐คชThe easiest and probably not the best way.
#
Store in constants and then reuse ๐คBetter than hardcoding but not convenient to define child-parent relationship.
#
Define a custom action for selecting elements ๐งcypress/support/commands.ts
cypress/integration/test.ts
Even better since it unifies the way of querying elements and hides some of the complexity.
#
Define selectors declaratively ๐ปSeems to be the most optimal approach since:
- it allows to define selectors declaratively and concisely (no more constants / selector functions / custom actions / e.t.c)
- it makes it easy to access and reuse selectors - just access your selectors by reference and the lib will do querying for you
- it makes it easy to specify child-parent relationship
The API is inspired by Selenium selectors.