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

CSS Selector Playground - allow configuration? #1135

Closed
zth opened this issue Dec 27, 2017 · 3 comments
Closed

CSS Selector Playground - allow configuration? #1135

zth opened this issue Dec 27, 2017 · 3 comments
Assignees
Labels
pkg/runner This is due to an issue in the packages/runner directory topic: selector playground 🚸 type: enhancement Requested enhancement of existing feature
Milestone

Comments

@zth
Copy link

zth commented Dec 27, 2017

Hi!

This is a follow up to the launch of the CSS Selector Playground feature, and in reference to this comment: #917 (comment).

A use case I have is the following:
We always set a unique data-testid on all of our elements used in E2E tests. It'd be really cool if the CSS Selector Playground was configurable so that it would prefer (or even enforce) selectors using the data-testid-convention. In addition to that, it'd be cool if it could also somehow highlight all elements with data-testid's on the page right now.

Any thoughts/comments?

@jennifer-shehane jennifer-shehane added stage: proposal 💡 No work has been done of this issue type: enhancement Requested enhancement of existing feature labels Dec 28, 2017
@jennifer-shehane jennifer-shehane added the pkg/runner This is due to an issue in the packages/runner directory label Dec 28, 2017
@brian-mann
Copy link
Member

@chrisbreiding let's go with the comment here: #1212 (comment)

data-test and data-cy.

We need to support those as the preferred selector.

We also need to provide a callback function to enable you to control what selector you want returned... something like this..

// something like this
Cypress.SelectorPlayground.defaults({
  selectorPriority: ['data-cy', 'data-test', 'id', 'class', 'nth-child'],
  onElement: ($el) => {
    // return something here which will override the default attributes we search for
  })
})

@brian-mann
Copy link
Member

After doing this, we need to provide docs for the API, we need to write a guide (to show you how to use the playground) and likely a best practice for naming your elements.

@brian-mann
Copy link
Member

Released in 2.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/runner This is due to an issue in the packages/runner directory topic: selector playground 🚸 type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

4 participants