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

Test selection attribute #5001

Closed
spalger opened this issue Sep 22, 2015 · 9 comments
Closed

Test selection attribute #5001

spalger opened this issue Sep 22, 2015 · 9 comments
Labels

Comments

@spalger
Copy link
Contributor

spalger commented Sep 22, 2015

We need to choose a way to support selecting elements from with tests. Currently we do this with a combination of CSS selectors and id's, but those have well established issues. In order to circuvent those
issues @epixa suggested we use data attributes (see) to select the elements.

@Bargs suggested we stick with the data-* prefix but pick a name that obviously maps the attribute to it's intended purpose: providing selectors for tests.

Thoughts? Please extend the lists below or comment and a contributor will add your suggestion to the list.

Goals of the selector:

  • portray "test selectors" to keep it decoupled from all other uses
  • supports multiple values (space separated like class)
  • values are not globally unique

Options:

  • data-tselect
  • data-testselect
  • data-purpose
  • purpose
  • data-test-roles
  • data-test-subject
  • data-test-subj
@spalger
Copy link
Contributor Author

spalger commented Sep 22, 2015

I'm currently leaning towards data-test-roles

@BigFunger
Copy link
Contributor

If you're leaning toward data-test-roles, should that be singular? (similar to the class attribute)

@spalger
Copy link
Contributor Author

spalger commented Sep 22, 2015

I'm open to that, but as I'm starting to use it in a test I don't really like how it looks as a helper function: $.findTestRoles('link appLink')

@BigFunger
Copy link
Contributor

@spalger / @LeeDr would it be beneficial to mock up an example?

@spalger
Copy link
Contributor Author

spalger commented Sep 22, 2015

I'm working it into a pr right now

@Bargs
Copy link
Contributor

Bargs commented Sep 22, 2015

data-test-subject?

e.g. $.findTestSubjects('link appLink')

@spalger
Copy link
Contributor Author

spalger commented Sep 22, 2015

I like subject, maybe we can abbreviate?

@simianhacker
Copy link
Member

+1 on data-test-subject

@cjcenizal
Copy link
Contributor

Closing this because we're using [data-test-subj].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants