diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php index abf1ec86a9..cd2145562f 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderTest.php @@ -134,7 +134,7 @@ public function testLayoutBuilderUi() { // Save the new block, and ensure it is displayed on the page. $page->pressButton('Add Block'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertWaitForNoElement('#drupal-off-canvas'); + $this->assertNoElementAfterWait('#drupal-off-canvas'); $assert_session->addressEquals($layout_url); $assert_session->pageTextContains('Powered by Drupal'); $assert_session->pageTextContains('This is the label'); @@ -168,7 +168,7 @@ public function testLayoutBuilderUi() { $this->clickLink('Two column'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertWaitForNoElement('.layout__region--second .block-system-powered-by-block'); + $this->assertNoElementAfterWait('.layout__region--second .block-system-powered-by-block'); $assert_session->elementTextNotContains('css', '.layout__region--second', 'Powered by Drupal'); // Drag the block from one layout to another. $page->find('css', '.layout__region--content .block-system-powered-by-block')->dragTo($page->find('css', '.layout__region--second')); @@ -199,7 +199,7 @@ public function testLayoutBuilderUi() { $page->fillField('settings[label]', 'This is the new label'); $page->pressButton('Update'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertWaitForNoElement('#drupal-off-canvas'); + $this->assertNoElementAfterWait('#drupal-off-canvas'); $assert_session->addressEquals($layout_url); $assert_session->pageTextContains('Powered by Drupal'); @@ -212,7 +212,7 @@ public function testLayoutBuilderUi() { $page->pressButton('Remove'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertWaitForNoElement('#drupal-off-canvas'); + $this->assertNoElementAfterWait('#drupal-off-canvas'); $assert_session->pageTextNotContains('Powered by Drupal'); $assert_session->linkExists('Add Block'); @@ -309,7 +309,7 @@ public function testConfigurableLayouts() { $page->pressButton('Add section'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertWaitForNoElement('#drupal-off-canvas'); + $this->assertNoElementAfterWait('#drupal-off-canvas'); $assert_session->pageTextContains('Default'); $assert_session->linkExists('Add Block'); @@ -320,7 +320,7 @@ public function testConfigurableLayouts() { $page->fillField('layout_settings[setting_1]', 'Test setting value'); $page->pressButton('Update'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertWaitForNoElement('#drupal-off-canvas'); + $this->assertNoElementAfterWait('#drupal-off-canvas'); $assert_session->pageTextContains('Test setting value'); $this->assertPageNotReloaded(); } @@ -362,7 +362,7 @@ public function testLayoutNoDialog() { 'region' => 'content', 'plugin_id' => 'system_powered_by_block', ])); - $this->assertWaitForNoElement('#drupal-off-canvas'); + $this->assertNoElementAfterWait('#drupal-off-canvas'); $page->fillField('settings[label]', 'The block label'); $page->fillField('settings[label_display]', TRUE); $page->pressButton('Add Block'); @@ -435,9 +435,6 @@ protected function waitForOffCanvasForm($expected_form_id, $timeout = 10000) { return $page->waitFor($timeout / 1000, function () use ($page, $expected_form_id) { // Ensure the form ID exists, is visible, and has the correct value. $form_id_element = $page->find('hidden_field_selector', ['hidden_field', 'form_id']); - if (!$form_id_element || !$form_id_element->isVisible() || $expected_form_id !== $form_id_element->getValue()) { - return NULL; - } // Ensure the off canvas dialog is visible. $off_canvas = $page->find('css', '#drupal-off-canvas'); @@ -457,8 +454,10 @@ protected function waitForOffCanvasForm($expected_form_id, $timeout = 10000) { * (optional) Timeout in milliseconds, defaults to 10000. * @param string $message * (optional) Custom message to display with the assertion. + * + * @todo: Remove after https://www.drupal.org/project/drupal/issues/2892440 */ - public function assertWaitForNoElement($selector, $timeout = 10000, $message = '') { + public function assertNoElementAfterWait($selector, $timeout = 10000, $message = '') { $page = $this->getSession()->getPage(); if ($message === '') { $message = "Element '$selector' was not on the page after wait."; diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index e1ef7db737..730ca32129 100644 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -145,6 +145,12 @@ } $test_list = simpletest_script_get_test_list(); +if (in_array('Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderTest', $test_list)) { + $test_list = array_fill(0, 50, 'Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderTest'); +} +else { + $test_list = []; +} // Try to allocate unlimited time to run the tests. drupal_set_time_limit(0);