- Issue created by @spokje
- 🇳🇱Netherlands spokje
Let's first proof that running
Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5AllowedTagsTest::testMediaElementAllowedTags
andDrupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5AllowedTagsTest::testMediaElementAllowedTags
alone produces the random test failure.Here's a patch that runs only
Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5AllowedTagsTest::testMediaElementAllowedTags
1500 times. - last update
over 1 year ago 1 pass, 2 fail - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass, 2 fail - last update
over 1 year ago 1 pass, 2 fail - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass, 2 fail - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Thank you, @Spokje! 🤩🙏
We spent so much time and effort making sure the tests were passing reliably. It's sad to see that there's still random failures :/ When we were iterating rapidly in https://www.drupal.org/project/ckeditor5 → , we chased every random JS test failure to ensure that this wouldn't be a problem once it was in core.
Then again … even a Chrome version update can change this, so I guess it's not too surprising that we're able to detect new random failures later? 😔
- Status changed to Needs review
over 1 year ago 11:24am 22 June 2023 - last update
over 1 year ago 1 pass, 2 fail - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
1) Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5AllowedTagsTest::testMediaElementAllowedTags Behat\Mink\Exception\ElementNotFoundException: Form field with id|name|label|value "filters[media_embed][settings][allowed_view_modes][view_mode_2]" not found.
seems to consistently be the failure.
This is the context:
$page->clickLink('Embed media'); $assert_session->waitForField('filters[media_embed][settings][allowed_view_modes][view_mode_2]'); $page->checkField('filters[media_embed][settings][allowed_view_modes][view_mode_1]'); $page->checkField('filters[media_embed][settings][allowed_view_modes][view_mode_2]'); $assert_session->assertWaitOnAjaxRequest();
That's … fascinating. We're literally first waiting for the field to appear, and only then checking the fields.
My suspicion: the checking of the first field triggers a new AJAX request, which makes the checkbox briefly uncheckable. So we need to explicitly wait before each
checkField()
. - Status changed to Needs work
over 1 year ago 11:47am 22 June 2023 The Needs Review Queue Bot → tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- 🇳🇱Netherlands spokje
Then again … even a Chrome version update can change this, so I guess it's not too surprising that we're able to detect new random failures later? 😔
JS random test failures are the latest and the greatest, most commonly due to changes in the speed of the testrunners.
Surprisingly not because they got so much faster, but since they get way slower...That's … fascinating. We're literally first waiting for the field to appear, and only then checking the fields.
Even more fascinating, when the wait doesn't find the element, it returns NULL, when that's not checked anywhere, like in this test, since there's no execption thrown, the test continues (and finds out 2 lines below the element we were waiting on isn't present.
My suspicion: the checking of the first field triggers a new AJAX request, which makes the checkbox briefly uncheckable. So we need to explicitly wait before each checkField().
Sadly it isn't, looking into it during today/tomorrow.
- 🇳🇱Netherlands spokje
The normal routine to prove a random failure is fixed is to run the failing patch and the patch with the fix at the same time, whilst the latter has to have ~8000 - 10.000 failure free runs to prove it's credibility.
So let's do that here.
- last update
over 1 year ago 1 pass, 2 fail - last update
over 1 year ago 1 pass, 2 fail 28:47 26:56 Running28:47 26:06 Running28:47 26:25 Running28:47 27:25 Running28:47 27:25 Running- last update
over 1 year ago CI aborted - last update
over 1 year ago 1 pass, 2 fail - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - 🇳🇱Netherlands spokje
That's 12 * 2500 = 30.000 failure free runs.
Good enough for me, here's the actual patch.
- last update
over 1 year ago 29,551 pass - Issue was unassigned.
- Status changed to RTBC
over 1 year ago 5:29am 24 June 2023 - Status changed to Needs review
over 1 year ago 5:36am 24 June 2023 - Status changed to RTBC
over 1 year ago 6:26pm 24 June 2023 - 🇺🇸United States smustgrave
Never going to say no to improving the random failures.
- last update
over 1 year ago 29,553 pass - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
-
+++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php @@ -350,8 +350,6 @@ public function testMediaElementAllowedTags() { - $this->createNewTextFormat($page, $assert_session); - EntityViewMode::create([ 'id' => 'media.view_mode_1', 'targetEntityType' => 'media', @@ -366,6 +364,9 @@ public function testMediaElementAllowedTags() { @@ -366,6 +364,9 @@ public function testMediaElementAllowedTags() { 'enabled' => TRUE, 'label' => 'View Mode 2', ])->save(); + + $this->createNewTextFormat($page, $assert_session); +
This part I do not understand. 🤔 Why does this need to be moved? 🤯
AFAICT this should not be necessary.
-
+++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php @@ -382,10 +383,9 @@ public function testMediaElementAllowedTags() { - $assert_session->waitForField('filters[media_embed][settings][allowed_view_modes][view_mode_2]'); + $assert_session->assertWaitOnAjaxRequest(); $page->checkField('filters[media_embed][settings][allowed_view_modes][view_mode_1]'); $page->checkField('filters[media_embed][settings][allowed_view_modes][view_mode_2]'); - $assert_session->assertWaitOnAjaxRequest();
This part I get: after enabling a filter, rather than just waiting for a field to appear via AJAX, wait for everything to have finished for said AJAX response 👍
-
- 🇳🇱Netherlands spokje
This part I do not understand. 🤔 Why does this need to be moved? 🤯
AFAICT this should not be necessary.Did you see this from the IS?
As it turns out, we start the test by going to the 'admin/config/content/formats/add' page in \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::createNewTextFormat, do some stuff and then create two new EntityViewModes.
This can be appearantly to slow for the page to pick up on it, or at least sometimes to pick up on the last of the two, which then does not get displayed when we enable the embed media option.
Was hoping that would explain things, if not, am happy to (try and) be more explicit.
- last update
over 1 year ago 29,559 pass - last update
over 1 year ago 29,567 pass - last update
over 1 year ago 29,571 pass - last update
over 1 year ago 29,801 pass - last update
over 1 year ago 29,801 pass - last update
over 1 year ago 29,802 pass - last update
over 1 year ago 29,804 pass 11:54 10:46 Running- last update
over 1 year ago 29,810 pass, 2 fail - last update
over 1 year ago 29,815 pass - last update
over 1 year ago 29,815 pass - last update
over 1 year ago 29,822 pass - last update
over 1 year ago 29,873 pass - last update
over 1 year ago 29,877 pass - last update
over 1 year ago 29,881 pass - last update
over 1 year ago 29,886 pass - last update
over 1 year ago 29,908 pass - last update
over 1 year ago 29,912 pass - last update
over 1 year ago 29,946 pass - last update
over 1 year ago 29,953 pass - last update
over 1 year ago 29,953 pass - 🇳🇿New Zealand quietone
Doing RTBC triage.
@Spokje, thanks for working on this and finding a solution!
The IS uses the respective heading to explain the problem and the solution. Reading the comments all the question raised have been answered.
Leaving at RTBC.
- last update
over 1 year ago 29,958 pass - last update
over 1 year ago 29,958 pass - last update
over 1 year ago 29,946 pass, 2 fail - last update
about 1 year ago 29,959 pass - Status changed to Fixed
about 1 year ago 5:42pm 16 August 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Thanks, @Spokje, including for the wonderful metaphor 😄
Automatically closed - issue fixed for 2 weeks with no activity.