Active
Project:
Drupal core
Version:
main
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Jan 2018 at 06:47 UTC
Updated:
27 Mar 2026 at 01:55 UTC
Jump to comment: Most recent
There are instances where JavascriptTestBase tests need a waitForElement (or other waitFor method) after a normal page (re)load to prevent intermittent fails
See:
#2934997: Intermittent failure in MediaUiJavascriptTest
#2864177: Random failure in FormErrorHandlerCKEditorTest
We need to find out why and when this is needed to prevent further intermittent fails from being introduced.
Comments
Comment #2
benjifisherThe steps in #2934997: Intermittent failure in MediaUiJavascriptTest that lead to the failure (before the patch on that test) are
So the problem is the normal page load triggered by
pressButton(), not the page load fromdrupalGet().Comment #4
Anonymous (not verified) commentedTrying to solve a similar error in the #2924201-21: Resolve random failure in LayoutBuilderTest so that it can be added to HEAD, I spent a tone of strength, but could not determine the source :(
Waiting elements on page - it did not help (#2934064-8: Random fail in JS-tests due to unstable pressButton() has fail with testing fix from #2934997: Intermittent failure in MediaUiJavascriptTest)
It seems to me that the problem is only in
pressButton()method. Sometimes with it, the page simply does not reloading.But
'submit'trigger occured. Becausemisc/form.js::onFormSubmit()works, and works correctly (I checked this through local runs).So, perhaps something with phantomjs, or gastonjs, or mink-phantomjs-driver?
Comment #5
Anonymous (not verified) commented#4: my bad. Fix from #2934997: Intermittent failure in MediaUiJavascriptTest works perfect. I just checked the wrong part of it. See #11 (fix) / #12 (test-only). Thanks @benjifisher for hint.
So we have to wait after
pressButton(), press(), clickLink(), click(). Because they (in rare cases) do not guarantee a reload of the page.As I said, in these cases we can get a page on which all js-scripts worked, but the sending event itself did not have time to happen, and hence page not reload.
I still suspect third-part in this.
Comment #6
Anonymous (not verified) commentedGood news! Looks like with #2775653: JavascriptTests with webDriver this problem becomes obsolete. See #2934064-15: Random fail in JS-tests due to unstable pressButton().
Comment #7
lendude@vaplas I was secretly hoping that would be the case, nice research! the evidence in #2934064: Random fail in JS-tests due to unstable pressButton() that we can mark this as 'outdated' is pretty strong.
Comment #10
krzysztof domańskiRandom test failure that probably related to the problem with
pressButton()inMediaStandardProfileTest.php:#3045612: Random test failure in MediaStandardProfileTest::testMediaSources
Comment #15
dwwCautiously optimistic that this would be solved by #3032275: Create a fault-tolerant method for interacting with links and fields in Javascript tests
Comment #20
mstrelan commentedThis seems much worse since #3471113: Update to selenium/standalone-chrome:134+
Comment #22
donquixote commentedThe reason could be javascript validation scripts that need to complete before the page actually submits.
And overall we should not assume it to be instant.
I created a possible solution here, #3576262: [random test failure] MediaSourceFileTest::testMediaFileSource
https://git.drupalcode.org/project/drupal/-/merge_requests/15230