diff -u b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php --- b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php @@ -37,6 +37,7 @@ */ public function testVerticalTabChildVisibility() { $session = $this->getSession(); + $web_assert = $this->assertSession(); // Request the group vertical tabs testing page with a fragment identifier // to the second element. @@ -60,15 +61,15 @@ // inactive vertical tab. $session->executeScript("jQuery('').insertAfter('h1')[0].click()"); - // Assert that the child in the first vertical tab is visible. - $this->assertTrue($child_1->isVisible(), 'Child 1 is visible after a fragment link click'); + // Assert that the child in the first vertical tab becomes visible. + $web_assert->waitForElementVisible('css', $child_1_selector, 50); // Trigger a URI fragment change (hashchange) to show the second vertical // tab again. $session->executeScript("location.replace('$child_2_selector')"); - // Assert that the child in the second vertical tab is visible again. - $this->assertTrue($child_2->isVisible(), 'Child 2 is visible after a fragment change'); + // Assert that the child in the second vertical tab becomes visible again. + $web_assert->waitForElementVisible('css', $child_2_selector, 50); $tab_link_1->click(); @@ -86,6 +87,7 @@ */ public function testDetailsChildVisibility() { $session = $this->getSession(); + $web_assert = $this->assertSession(); // Store reusable JavaScript code to remove the current URI fragment and // close all details. @@ -108,8 +110,8 @@ // elements of the child. $session->executeScript("location.replace('$child_selector')"); - // Assert that the child is visible again. - $this->assertTrue($child->isVisible(), 'Child became visible after a fragment change'); + // Assert that the child becomes visible again after a hash change. + $web_assert->waitForElementVisible('css', $child_selector, 50); $session->executeScript($reset_js); @@ -117,8 +119,8 @@ // details element. $session->executeScript("jQuery('').insertAfter('h1')[0].click()"); - // Assert that the child is visible again. - $this->assertTrue($child->isVisible(), 'Child became visible after a fragment link click'); + // Assert that the child is visible again after a fragment link click. + $web_assert->waitForElementVisible('css', $child_selector, 50); // Find the summary belonging to the closest details element. $summary = $page->find('css', '#edit-meta > summary');