From b9f1240ce2a8b359304f822902e408408478746d Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 23 Aug 2022 15:49:07 -0700
Subject: [PATCH] Issue #3268678 by bnjmnm: [random test failure] Restore
 ContentPreviewToggleTest::testContentPreviewToggle()

(cherry picked from commit dcf0fd3bf999406a081594221fd02092a39accd6)
---
 .../src/FunctionalJavascript/ContentPreviewToggleTest.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php
index 6d74dfbf01bb..bc584fd57bab 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/ContentPreviewToggleTest.php
@@ -5,6 +5,7 @@
 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
 use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay;
 use Drupal\Tests\contextual\FunctionalJavascript\ContextualLinkClickTrait;
+use Drupal\Tests\system\Traits\OffCanvasTestTrait;
 
 /**
  * Tests toggling of content preview.
@@ -15,7 +16,7 @@ class ContentPreviewToggleTest extends WebDriverTestBase {
 
   use ContextualLinkClickTrait;
   use LayoutBuilderSortTrait;
-
+  use OffCanvasTestTrait;
   /**
    * {@inheritdoc}
    */
@@ -24,6 +25,7 @@ class ContentPreviewToggleTest extends WebDriverTestBase {
     'block',
     'node',
     'contextual',
+    'off_canvas_test',
   ];
 
   /**
@@ -53,7 +55,6 @@ protected function setUp(): void {
    * Tests the content preview toggle.
    */
   public function testContentPreviewToggle() {
-    $this->markTestSkipped();
     $assert_session = $this->assertSession();
     $page = $this->getSession()->getPage();
     $links_field_placeholder_label = '"Links" field';
@@ -89,7 +90,6 @@ public function testContentPreviewToggle() {
     $this->getSession()->reload();
     $this->assertNotEmpty($assert_session->waitForElement('css', '.layout-builder-block__content-preview-placeholder-label'));
     $assert_session->pageTextNotContains($content_preview_body_text);
-    $this->markTestSkipped('Temporarily skipped due to random failures.');
     $this->assertContextualLinks();
 
     // Confirm repositioning blocks works with content preview disabled.
@@ -130,7 +130,7 @@ protected function assertContextualLinks(): void {
     $assert_session = $this->assertSession();
 
     $this->clickContextualLink('.block-field-blocknodebundle-for-this-particular-testbody', 'Configure');
-    $this->assertNotEmpty($assert_session->waitForElement('css', "#drupal-off-canvas"));
+    $this->waitForOffCanvasArea();
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->assertNotEmpty($this->assertSession()->waitForButton('Close'));
     $page->pressButton('Close');
-- 
GitLab