action #169096
closedcandidate needles menu sporadically not found in t/ui/18-tests-details.t
0%
Description
Motivation¶
While working on #134840, i've noticed t/ui/18-tests-details.t sporadically failing, throwing the error
isElementEnabled: stale element reference: stale element not found in the current frame
It seems to not find the candidate needles menu
ok 19 - test candidate list
isElementEnabled: stale element reference: stale element not found in the current frame at /home/rrichardson/Code/oqa/basedir/repos/openQA/t/ui/../lib/OpenQA/SeleniumTest.pm:78 at /home/rrichardson/Code/oqa/basedir/repos/openQA/t/ui/../lib/OpenQA/SeleniumTest.pm line 81.
OpenQA::SeleniumTest::__ANON__(Test::Selenium::Chrome=HASH(0x55c65bc554e8), "Error while executing command: isElementEnabled: stale elemen"..., HASH(0x55c65cf74b08)) called at /usr/lib/perl5/vendor_perl/5.40.0/Selenium/Remote/Driver.pm line 356
Selenium::Remote::Driver::catch {...} ("Error while executing command: isElementEnabled: stale elemen"...) called at /usr/lib/perl5/vendor_perl/5.40.0/Try/Tiny.pm line 123
Try::Tiny::try(CODE(0x55c65cee6a68), Try::Tiny::Catch=REF(0x55c65cc8ac20)) called at /usr/lib/perl5/vendor_perl/5.40.0/Selenium/Remote/Driver.pm line 361
Selenium::Remote::Driver::__ANON__(CODE(0x55c65b7dc240), Test::Selenium::Chrome=HASH(0x55c65bc554e8), HASH(0x55c65cf74b08)) called at (eval 1617) line 1
Selenium::Remote::Driver::__ANON__(Test::Selenium::Chrome=HASH(0x55c65bc554e8), HASH(0x55c65cf74b08)) called at (eval 1619) line 2
Selenium::Remote::Driver::_execute_command(Test::Selenium::Chrome=HASH(0x55c65bc554e8), HASH(0x55c65cf74b08)) called at (eval 1589) line 17
Selenium::Remote::WebElement::_execute_command(Test::Selenium::Remote::WebElement=HASH(0x55c65cf13988), HASH(0x55c65cf74b08)) called at /usr/lib/perl5/vendor_perl/5.40.0/Selenium/Remote/WebElement.pm line 180
Selenium::Remote::WebElement::is_enabled(Test::Selenium::Remote::WebElement=HASH(0x55c65cf13988)) called at t/ui/18-tests-details.t line 84
main::find_candidate_needles() called at t/ui/18-tests-details.t line 612
main::test_with_error(0, 0, ARRAY(0x55c65cdd6e28), HASH(0x55c65cea2b10), "100%, 100%") called at t/ui/18-tests-details.t line 635
main::__ANON__() called at /usr/lib/perl5/5.40.0/Test/Builder.pm line 374
eval {...} called at /usr/lib/perl5/5.40.0/Test/Builder.pm line 374
Test::Builder::subtest(Test::Builder=HASH(0x55c6525d2a90), "test candidate list", CODE(0x55c65c763540)) called at /usr/lib/perl5/5.40.0/Test/More.pm line 831
Test::More::subtest("test candidate list", CODE(0x55c65c763540)) called at t/ui/18-tests-details.t line 664
ok 20 - no (unexpected) warnings (via END block)
# Tests were run but no plan was declared and done_testing() was not seen.
Dubious, test returned 254 (wstat 65024, 0xfe00)
All 20 subtests passed
Test Summary Report
-------------------
t/ui/18-tests-details.t (Wstat: 65024 (exited 254) Tests: 20 Failed: 0)
Non-zero exit status: 254
Parse errors: No plan found in TAP output
Files=1, Tests=20, 20 wallclock secs ( 0.07 usr 0.01 sys + 3.78 cusr 0.38 csys = 4.24 CPU)
Result: FAIL
make[1]: *** [Makefile:229: test-unit-and-integration] Error 1
make[1]: Leaving directory '/home/rrichardson/Code/oqa/basedir/repos/openQA'
make: *** [Makefile:224: test-with-database] Error 2
To reproduce the issue, simply run the test in a loop until the failure occurs.
make test RETRY=50 STABILITY_TEST=1 OPENQA_TEST_TIMEOUT_DISABLE=1 EXTRA_PROVE_ARGS="-v" TESTS=t/ui/18-tests-details.t
(If it succeeds, bump the RETRY counter and run again, the failure should show up after a while)
Files
Updated by tinita about 2 months ago
I am able to reproduce it sometimes, now that I updated my leap container to 15.6.
I added
$driver->capture_screenshot('candidates.png');
before line 84, and it seems that with this line it happens less often, but I now reproduced it once and attached the screenshot.
To me the screenshot looks fine.
Updated by tinita about 2 months ago
I now made a screenshot after the error like this:
my $enabled = eval { $candidates_menu->is_enabled };
if (my $err = $@) {
$driver->capture_screenshot('candidates.png');
die $err;
}
return {} unless $enabled;
but I get the same screenshot. The menu is there.
Updated by tinita about 2 months ago · Edited
Hm, I notice that we call disable_timeout
in find_candidate_needles
at the top, and at the end we call enable_timeout
.
But sometimes we return earlier and never enable the timeout again...
But still, the element was returned by wait_for_element(selector => '#candidatesMenu', is_displayed => 1)
, so I don't know how the missing timeout could be responsible for that.
edit: calling enable_timeout
in case of the early return didn't fix it. It now fails already in wait_for_element
at the $elements[0]->is_displayed
.
Updated by tinita about 2 months ago · Edited
Now testing this patch:
diff --git a/t/ui/18-tests-details.t b/t/ui/18-tests-details.t
index b16c6062f..4490235d6 100644
--- a/t/ui/18-tests-details.t
+++ b/t/ui/18-tests-details.t
@@ -81,7 +81,10 @@ sub find_candidate_needles {
# save implicit waiting time as long as we are only looking for elements
# that should be visible already
disable_timeout;
- return {} unless $candidates_menu->is_enabled;
+ unless ($candidates_menu->is_enabled) {
+ enable_timeout;
+ return {};
+ }
$candidates_menu->click;
# read the tags/needles from the HTML structure
@@ -609,6 +612,7 @@ sub test_with_error {
# check whether candidates are displayed as expected
my $random_number = int(rand(100000));
$driver->get("/tests/99946?prevent_caching=$random_number#step/yast2_lan/1");
+ wait_for_ajax(msg => 'step of test module loaded');
is_deeply(find_candidate_needles, $expect, $test_name // 'candidates displayed as expected');
}
@@ -643,6 +647,7 @@ subtest 'test candidate list' => sub {
\%expected_candidates, 'needles appear twice, each time under different tag');
$driver->get('/tests/99946#step/installer_timezone/1');
+ wait_for_ajax(msg => 'step of installer_timezone test module loaded');
my $clicks = 0;
wait_for_element(
selector => '#needlediff_selector .show-needle-info',
edit: added another wait_for_ajax
call
Updated by tinita about 2 months ago
- Status changed from New to In Progress
- Assignee set to tinita
Updated by tinita about 2 months ago
https://github.com/os-autoinst/openQA/pull/6040 t: Fix sporadic stale element failures in t/ui/18-tests-details.t
Updated by tinita about 2 months ago
- Status changed from In Progress to Feedback