-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: validate selectorPriority configuration #18573
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
.and.include('`Cypress.SelectorPlayground.defaults()` called with invalid `selectorPriority` property. It must be one of: `data-*`, `id`, `class`, `tag`, `attributes`, `nth-child`. You passed: `name`') | ||
}) | ||
|
||
it('throws if selector:playground:priority if selectorPriority contains an unsupported priority that contains a valid priority', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these test names flipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to say 'idIsNotValid' contains the substring 'id' to demonstrate we're testing the full word and not just starts with. I'm open to better ways of saying that. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhh maybe
throws selector:playground:priority if selectorPriority has an unsupported priority that contains a substring of a valid priority
Co-authored-by: Emily Rohrbough <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nitpicks. Otherwise looks great.
packages/driver/cypress/integration/cypress/selector_playground_spec.js
Outdated
Show resolved
Hide resolved
packages/driver/cypress/integration/cypress/selector_playground_spec.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Chris Breiding <[email protected]>
Cypress.SelectorPlayground.defaults - selectorPriority
breaks the Selector Playground #7745User facing changelog
This introduces validation for the
selectorPriority
configuration option. Previously any values were accepted, but any values other thandata-*
,id
,class
,tag
,attribute
, ornth-child
would cause the selector playground to error out in the cypress app.Additional details
We use a fork of the unique-selector package to generate the selectors for the playground. The unique-selector package only supports the following 'priorities':
data-*
id
class
attributes
nth-child
tag
Adding the
name
priority causes the getAllSelectors function to blow up because it doesn't have a function to create a selector for that attribute.How has the user experience changed?
The app will now display an exception if the selectorPriority configuration has been setup with unsupported values. This is preferable to having the selector playground cease functioning.
PR Tasks