From 1b920b29666dca8b326482036883ffc5b67d339c Mon Sep 17 00:00:00 2001
From: Lauri Eskola <lauri.eskola@acquia.com>
Date: Wed, 16 Aug 2023 20:40:51 +0300
Subject: [PATCH] Issue #3368509 by Spokje, Wim Leers, quietone: [Random test
 failure] Random failure in
 CKEditor5AllowedTagsTest::testMediaElementAllowedTags

---
 .../src/FunctionalJavascript/CKEditor5AllowedTagsTest.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
index 7b5a444041bf..db6ee3bc4441 100644
--- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
+++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
@@ -350,8 +350,6 @@ public function testMediaElementAllowedTags() {
     $page = $this->getSession()->getPage();
     $assert_session = $this->assertSession();
 
-    $this->createNewTextFormat($page, $assert_session);
-
     EntityViewMode::create([
       'id' => 'media.view_mode_1',
       'targetEntityType' => 'media',
@@ -366,6 +364,9 @@ public function testMediaElementAllowedTags() {
       'enabled' => TRUE,
       'label' => 'View Mode 2',
     ])->save();
+
+    $this->createNewTextFormat($page, $assert_session);
+
     // Allowed HTML field is readonly and its wrapper has a form-disabled class.
     $this->assertNotEmpty($assert_session->waitForElement('css', '.js-form-item-filters-filter-html-settings-allowed-html.form-disabled'));
     $allowed_html_field = $assert_session->fieldExists('filters[filter_html][settings][allowed_html]');
@@ -382,10 +383,9 @@ public function testMediaElementAllowedTags() {
     $this->assertNotNull($assert_session->waitForElementVisible('css', '[data-drupal-selector=edit-filters-media-embed-settings]', 0));
 
     $page->clickLink('Embed media');
-    $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();
 
     $allowed_with_media = $this->allowedElements . ' <drupal-media data-entity-type data-entity-uuid alt data-view-mode>';
     $allowed_with_media_without_view_mode = $this->allowedElements . ' <drupal-media data-entity-type data-entity-uuid alt>';
-- 
GitLab