Issue #2870146 by droplet, Lendude, michielnugter: Even more random fails in \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest
parent
0db6843c24
commit
13e8aca2c8
|
|
@ -182,6 +182,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
||||||
*/
|
*/
|
||||||
protected function enableEditMode() {
|
protected function enableEditMode() {
|
||||||
$this->pressToolbarEditButton();
|
$this->pressToolbarEditButton();
|
||||||
|
$this->waitForToolbarToLoad();
|
||||||
$this->assertEditModeEnabled();
|
$this->assertEditModeEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,6 +191,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
||||||
*/
|
*/
|
||||||
protected function disableEditMode() {
|
protected function disableEditMode() {
|
||||||
$this->pressToolbarEditButton();
|
$this->pressToolbarEditButton();
|
||||||
|
$this->waitForToolbarToLoad();
|
||||||
$this->assertEditModeDisabled();
|
$this->assertEditModeDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,6 +215,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
||||||
* A css selector selects the block or an element within it.
|
* A css selector selects the block or an element within it.
|
||||||
*/
|
*/
|
||||||
protected function openBlockForm($block_selector) {
|
protected function openBlockForm($block_selector) {
|
||||||
|
$this->waitForToolbarToLoad();
|
||||||
$this->click($block_selector);
|
$this->click($block_selector);
|
||||||
$this->waitForOffCanvasToOpen();
|
$this->waitForOffCanvasToOpen();
|
||||||
$this->assertOffCanvasBlockFormIsValid();
|
$this->assertOffCanvasBlockFormIsValid();
|
||||||
|
|
@ -249,11 +252,9 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
||||||
// Load the same page twice.
|
// Load the same page twice.
|
||||||
foreach ([1, 2] as $page_load_times) {
|
foreach ([1, 2] as $page_load_times) {
|
||||||
$this->drupalGet('node/' . $node->id());
|
$this->drupalGet('node/' . $node->id());
|
||||||
// Waiting for Toolbar module.
|
|
||||||
// @todo Remove the hack after https://www.drupal.org/node/2542050.
|
$this->waitForToolbarToLoad();
|
||||||
$web_assert->waitForElementVisible('css', '.toolbar-fixed');
|
|
||||||
// Waiting for Toolbar animation.
|
|
||||||
$web_assert->assertWaitOnAjaxRequest();
|
|
||||||
// The 2nd page load we should already be in edit mode.
|
// The 2nd page load we should already be in edit mode.
|
||||||
if ($page_load_times == 1) {
|
if ($page_load_times == 1) {
|
||||||
$this->enableEditMode();
|
$this->enableEditMode();
|
||||||
|
|
@ -363,18 +364,13 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
||||||
* Press the toolbar Edit button provided by the contextual module.
|
* Press the toolbar Edit button provided by the contextual module.
|
||||||
*/
|
*/
|
||||||
protected function pressToolbarEditButton() {
|
protected function pressToolbarEditButton() {
|
||||||
$this->assertSession()
|
$this->assertSession()->waitForElement('css', '[data-contextual-id] .contextual-links a');
|
||||||
->waitForElementVisible('css', 'div[data-contextual-id="block:block=powered:langcode=en|outside_in::langcode=en"] .contextual-links a', 10000);
|
|
||||||
// Waiting for QuickEdit icon animation.
|
|
||||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
|
||||||
|
|
||||||
$edit_button = $this->getSession()
|
$edit_button = $this->getSession()
|
||||||
->getPage()
|
->getPage()
|
||||||
->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR);
|
->find('css', static::TOOLBAR_EDIT_LINK_SELECTOR);
|
||||||
|
|
||||||
$edit_button->press();
|
$edit_button->press();
|
||||||
// Waiting for Toolbar animation.
|
|
||||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -118,4 +118,16 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
|
||||||
$this->getSession()->executeScript("jQuery('{$selector} .contextual .trigger').toggleClass('visually-hidden');");
|
$this->getSession()->executeScript("jQuery('{$selector} .contextual .trigger').toggleClass('visually-hidden');");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits for Toolbar to load.
|
||||||
|
*/
|
||||||
|
protected function waitForToolbarToLoad() {
|
||||||
|
$web_assert = $this->assertSession();
|
||||||
|
// Waiting for Toolbar module.
|
||||||
|
// @todo Remove the hack after https://www.drupal.org/node/2542050.
|
||||||
|
$web_assert->waitForElementVisible('css', '.toolbar-fixed');
|
||||||
|
// Waiting for Toolbar animation.
|
||||||
|
$web_assert->assertWaitOnAjaxRequest();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue