Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Test case and fix for NoSuchElementError in visibilityOf #3777 #3958

Merged
merged 2 commits into from
Jan 12, 2017
Merged

Test case and fix for NoSuchElementError in visibilityOf #3777 #3958

merged 2 commits into from
Jan 12, 2017

Conversation

tilmanschweitzer
Copy link
Contributor

Test case for #3777

I'll add the fix after a build failed to show the test case is correct.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@tilmanschweitzer
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@tilmanschweitzer
Copy link
Contributor Author

Test is failing as it should

https://circleci.com/gh/angular/protractor/453

… a race condition (#3777)

Handle NoSuchElementError in the expected condition visibilityOf, which occurred when
an element disappears between the isPresent() and isDisplayed() check.
@tilmanschweitzer tilmanschweitzer changed the title Adding test case to show visibilityOf problem with race condition (#3… Test case and fix for #3777 Jan 11, 2017
@tilmanschweitzer tilmanschweitzer changed the title Test case and fix for #3777 Test case and fix for NoSuchElementError in visibilityOf #3777 Jan 11, 2017
@heathkit heathkit self-requested a review January 12, 2017 19:55
@heathkit
Copy link
Contributor

Thanks for including a test case!

@heathkit heathkit merged commit 528338c into angular:master Jan 12, 2017
@heathkit heathkit removed their request for review January 12, 2017 19:57
@heathkit heathkit self-assigned this Jan 12, 2017
sjelin added a commit to sjelin/protractor that referenced this pull request Jan 13, 2017
…lements

Expected conditions used `presenceOf` and `visibilityOf` to check that it's
referencing elements which actually exist on the page, but there is a race
condition with this strategy: an element could disappear after the
`presenceOf`/`visibilityOf` check but before other checks, causing an error
to be thrown.  This PR handles this race condition in two ways:

1. `ElementFinder`'s `isEnabled`, `isDisplayed`, and `isSelected` functions now
   return false if no such element exists, rahter than throwing an error
2. `ExpectedConditions`'s `textToBePresent` and `textToBePresentInElementValue`
   now check for errors and also return false in those cases

This is a general solution to the problem referenced in
angular#3777 and
angular#3958.
sjelin added a commit to sjelin/protractor that referenced this pull request Jan 13, 2017
…lements

Expected conditions used `presenceOf` and `visibilityOf` to check that it's
referencing elements which actually exist on the page, but there is a race
condition with this strategy: an element could disappear after the
`presenceOf`/`visibilityOf` check but before other checks, causing an error
to be thrown.  This PR handles this race condition in two ways:

1. `ElementFinder`'s `isEnabled`, `isDisplayed`, and `isSelected` functions now
   return false if no such element exists, rahter than throwing an error
2. `ExpectedConditions`'s `textToBePresent` and `textToBePresentInElementValue`
   now check for errors and also return false in those cases

This is a general solution to the problem referenced in
angular#3777 and
angular#3958.
@peterbraden-amana
Copy link

Is this released yet?

@heathkit
Copy link
Contributor

This fix went out in 5.1.0

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

Successfully merging this pull request may close these issues.

4 participants