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

Improve handling of xpath locators with round brackets #1870

Merged
merged 2 commits into from Sep 6, 2019

Conversation

@nitschSB
Copy link
Contributor

commented Sep 2, 2019

After #1829 the locator functions .at(i), .first() and .last() create xpath locators with round brackets. This may lead to "is not a valid XPath expression" exceptions (see #1866).

The changes of this PR

  • "allows xpath locators to start with round brackets" for the isXPath()-method
  • "prevents round brackets for nested selectors" by refactoring the old six times used removePrefix((new Locator(locator, 'css')).toXPath())) expression to a new method called convertToSubSelector(locator) which also throws a specific error if the locator isXPathStartingWithRoundBrackets
@codacy-bot

This comment has been minimized.

Copy link

commented Sep 2, 2019

Codacy Here is an overview of what got changed by this pull request:

Clones added
============
- test/unit/locator_test.js  2
         

See the complete overview on Codacy

@DavertMik

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

Thanks!

@DavertMik DavertMik merged commit e5d669c into Codeception:master Sep 6, 2019

5 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
Hound No violations found. Woof!
ci/circleci: docker Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
@nitschSB

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2019

This improvement is needed due to #1829 which is controversial. You should have a look at my latest comment in #1866 . We need a decision that is recorded in the documentation.

@nitschSB nitschSB deleted the nitschSB:improve-1829 branch Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.