-
Notifications
You must be signed in to change notification settings - Fork 213
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
Fix sporadic test failure in t/ui/10-tests_overview.t
#6268
Conversation
This test sometimes runs into: ``` getElementText: stale element reference: stale element not found at /home/squamata/project/t/ui/../lib/OpenQA/SeleniumTest.pm:77 at /home/squamata/project/t/ui/../lib/OpenQA/SeleniumTest.pm line 80. OpenQA::SeleniumTest::__ANON__(Test::Selenium::Chrome=HASH(0x561a52552560), "Error while executing command: getElementText: stale element "..., HASH(0x561a528c1030)) called at /usr/lib/perl5/vendor_perl/5.26.1/Selenium/Remote/Driver.pm line 356 Selenium::Remote::Driver::catch {...} ("Error while executing command: getElementText: stale element "...) called at /usr/lib/perl5/vendor_perl/5.26.1/Try/Tiny.pm line 123 … Selenium::Remote::WebElement::_execute_command(Test::Selenium::Remote::WebElement=HASH(0x561a528b82b0), HASH(0x561a528c1030)) called at /usr/lib/perl5/vendor_perl/5.26.1/Selenium/Remote/WebElement.pm line 358 Selenium::Remote::WebElement::get_text(Test::Selenium::Remote::WebElement=HASH(0x561a528b82b0)) called at t/ui/10-tests_overview.t line 460 … Test::Builder::subtest(Test::Builder=HASH(0x561a46ef9a28), "filter for specific machine", CODE(0x561a528b5b00)) called at /usr/lib/perl5/5.26.1/Test/More.pm line 807 Test::More::subtest("filter for specific machine", CODE(0x561a528b5b00)) called at t/ui/10-tests_overview.t line 463 … Test::Builder::subtest(Test::Builder=HASH(0x561a46ef9a28), "filtering by machine", CODE(0x561a52888920)) called at /usr/lib/perl5/5.26.1/Test/More.pm line 807 Test::More::subtest("filtering by machine", CODE(0x561a52888920)) called at t/ui/10-tests_overview.t line 464 ``` There is no AJAX or dynamic loading of these elements at play. So the problem is perhaps that the `wait_for_element` still finds the element before the reload is done and then accessing the text of the element is no longer possible when the page has actually reloaded. If this is true then simply reordering the `wait_for_element` calls will help as the test now looks for the element that is not present before reloading first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6268 +/- ##
=======================================
Coverage 99.00% 99.00%
=======================================
Files 398 398
Lines 40057 40057
=======================================
Hits 39660 39660
Misses 397 397 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Yes, now the check for whether the element is displayed is failing:
So the theory mentioned in this PR's description is maybe still correct but the change is not sufficient. Maybe we can just catch that exception and treat the case when the exception occurs as "element does not exist at all" and continue waiting until it does. I'll come up with another PR tomorrow. EDIT: This actually failed in a different place than the place this PR tries to fix - but for a similar reason. So maybe it helps to apply a similar approach to other places in this test: #6277 |
This test sometimes runs into:
There is no AJAX or dynamic loading of these elements at play. So the
problem is perhaps that the
wait_for_element
still finds the elementbefore the reload is done and then accessing the text of the element is no
longer possible when the page has actually reloaded. If this is true then
simply reordering the
wait_for_element
calls will help as the test nowlooks for the element that is not present before reloading first.