From ef4c3e6e6079489df5d5e48e1f228dc09354a6f4 Mon Sep 17 00:00:00 2001 From: xjm Date: Wed, 24 Aug 2022 15:16:02 -0500 Subject: [PATCH] Issue #3304901 by bnjmnm, nod_: Fix intermittently failing Settings Tray Functional Javascript tests (cherry picked from commit 2b3f1b960eb45ad78e302497a3a0a87c35134c69) --- .../SettingsTrayBlockFormTest.php | 2 +- .../src/FunctionalJavascript/OffCanvasTestBase.php | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php index 97dc2febc6c..3cbb80e96e5 100644 --- a/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php +++ b/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php @@ -21,6 +21,7 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase { 'node', 'search', 'settings_tray_test', + 'off_canvas_test', ]; /** @@ -241,7 +242,6 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase { case 'contextual_link': $this->clickContextualLink($this->getBlockSelector($block), "Quick edit"); $this->waitForOffCanvasToOpen(); - $this->markTestSkipped("Skipped temporarily for random fails."); $this->assertEditModeEnabled(); break; diff --git a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php index 352dd45423f..ef19a8b3272 100644 --- a/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php +++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php @@ -3,18 +3,22 @@ namespace Drupal\Tests\system\FunctionalJavascript; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; +use Drupal\Tests\system\Traits\OffCanvasTestTrait; /** * Base class contains common test functionality for the Off-canvas dialog. */ abstract class OffCanvasTestBase extends WebDriverTestBase { + use OffCanvasTestTrait; + /** * {@inheritdoc} */ protected static $modules = [ // @todo Remove this in https://www.drupal.org/node/3219959 'block', + 'off_canvas_test', ]; /** @@ -75,14 +79,9 @@ abstract class OffCanvasTestBase extends WebDriverTestBase { * @throws \Behat\Mink\Exception\ElementNotFoundException */ protected function waitForOffCanvasToOpen($position = 'side') { - $web_assert = $this->assertSession(); - // Wait just slightly longer than the off-canvas dialog CSS animation. - // @see core/misc/dialog/off-canvas.motion.css - $this->getSession()->wait(800); - $web_assert->assertWaitOnAjaxRequest(); - $this->assertElementVisibleAfterWait('css', '#drupal-off-canvas'); + $this->waitForOffCanvasArea(); // Check that the canvas is positioned on the side. - $web_assert->elementExists('css', '.ui-dialog-position-' . $position); + $this->assertSession()->elementExists('css', '.ui-dialog-position-' . $position); } /**