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

Add support for find by attribute and content #2965

Merged
merged 1 commit into from Sep 28, 2018
Merged

Add support for find by attribute and content #2965

merged 1 commit into from Sep 28, 2018

Conversation

gztomas
Copy link

@gztomas gztomas commented Sep 23, 2018

Proposed changes

Add support for selecting elements by attribute as well as content.
Before this change it was only possible to select some element by a given tag name, id or class and a certain content, like div#main*=Hello.
After this change it will be also possible to select by attribute, like div[data-test-name="main"]*=Hello

Motivation

In our project we are using data-test-name attributes for marking elements that will be consumed by our tests. Since we are using styled components which already generate random class names for elements, we avoid polluting the class attribute by using this specific attribute for tests element targeting.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

I have taken this as an opportunity for removing some repeated code, so now all the id class or attribute + content cases are handled by a single regular expression.

Reviewers: @webdriverio/technical-committee

@jsf-clabot
Copy link

jsf-clabot commented Sep 23, 2018

CLA assistant check
All committers have signed the CLA.

@gztomas gztomas changed the title webdriverio: add support for find by attribute and content Add support for find by attribute and content Sep 23, 2018
@codecov
Copy link

codecov bot commented Sep 23, 2018

Codecov Report

Merging #2965 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2965      +/-   ##
==========================================
- Coverage   95.34%   95.32%   -0.03%     
==========================================
  Files         111      111              
  Lines        2235     2223      -12     
  Branches      461      455       -6     
==========================================
- Hits         2131     2119      -12     
  Misses         94       94              
  Partials       10       10
Impacted Files Coverage Δ
packages/webdriverio/src/utils.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e04bf7...ca1f5e5. Read the comment docs.

@gztomas
Copy link
Author

gztomas commented Sep 25, 2018

@christian-bromann please let me know if you need anything from my side to move this forward.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@christian-bromann christian-bromann merged commit 7594a33 into webdriverio:master Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants