summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2017-02-02 12:38:38 (GMT)
committerNathaniel Catchpole2017-02-02 12:38:38 (GMT)
commita110314b0919cc2b142c0caef481873d906fe77c (patch)
treee88daddb551f2eee7f2760af40a3b4668fda3acc
parentbfdfe82ea2f073a2d0e5f05ba315972cfe16a42a (diff)
Issue #2848177 by michielnugter, tedbow: More \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest random fails
-rw-r--r--core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php14
-rw-r--r--core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php15
2 files changed, 8 insertions, 21 deletions
diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
index c39f2f8..04c6e70 100644
--- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
@@ -71,7 +71,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
$this->waitForNoElement("#toolbar-administration a.is-active");
}
$page->find('css', $toolbar_item)->click();
- $this->waitForElement("{$toolbar_item}.is-active");
+ $web_assert->waitForElementVisible('css', "{$toolbar_item}.is-active");
}
$this->toggleEditingMode();
if (isset($toolbar_item)) {
@@ -166,7 +166,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
* Enables Editing mode by pressing "Edit" button in the toolbar.
*/
protected function toggleEditingMode() {
- $this->waitForElement('div[data-contextual-id="block:block=powered:langcode=en|outside_in::langcode=en"] .contextual-links a', 10000);
+ $this->assertSession()->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();
@@ -235,7 +235,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
$this->drupalGet('node/' . $node->id());
// Waiting for Toolbar module.
// @todo Remove the hack after https://www.drupal.org/node/2542050.
- $this->waitForElement('.toolbar-fixed');
+ $web_assert->waitForElementVisible('css', '.toolbar-fixed');
// Waiting for Toolbar animation.
$web_assert->assertWaitOnAjaxRequest();
// The 2nd page load we should already be in edit mode.
@@ -244,7 +244,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
}
// In Edit mode clicking field should open QuickEdit toolbar.
$page->find('css', $body_selector)->click();
- $this->waitForElement($quick_edit_selector);
+ $web_assert->waitForElementVisible('css', $quick_edit_selector);
// Exit Edit mode.
$this->toggleEditingMode();
// Exiting Edit mode should close QuickEdit toolbar.
@@ -257,7 +257,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
$this->toggleEditingMode();
$this->openBlockForm($block_selector);
$page->find('css', $body_selector)->click();
- $this->waitForElement($quick_edit_selector);
+ $web_assert->waitForElementVisible('css', $quick_edit_selector);
// Offcanvas should be closed when opening QuickEdit toolbar.
$this->waitForOffCanvasToClose();
@@ -272,7 +272,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
$this->toggleEditingMode();
// Open QuickEdit toolbar before going into Edit mode.
$this->clickContextualLink('.node', "Quick edit");
- $this->waitForElement($quick_edit_selector);
+ $web_assert->waitForElementVisible('css', $quick_edit_selector);
// Open off-canvas and enter Edit mode via contextual link.
$this->clickContextualLink($block_selector, "Quick edit");
$this->waitForOffCanvasToOpen();
@@ -281,7 +281,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
// Open QuickEdit toolbar via contextual link while in Edit mode.
$this->clickContextualLink('.node', "Quick edit", FALSE);
$this->waitForOffCanvasToClose();
- $this->waitForElement($quick_edit_selector);
+ $web_assert->waitForElementVisible('css', $quick_edit_selector);
}
}
diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
index 48ba899..8cdeec0 100644
--- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
@@ -42,7 +42,7 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
protected function waitForOffCanvasToOpen() {
$web_assert = $this->assertSession();
$web_assert->assertWaitOnAjaxRequest();
- $this->waitForElement('#drupal-offcanvas');
+ $web_assert->waitForElementVisible('css', '#drupal-offcanvas');
}
/**
@@ -53,19 +53,6 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
}
/**
- * Waits for an element to appear on the page.
- *
- * @param string $selector
- * CSS selector.
- * @param int $timeout
- * (optional) Timeout in milliseconds, defaults to 10000.
- */
- protected function waitForElement($selector, $timeout = 10000) {
- $condition = "(jQuery('$selector').length > 0)";
- $this->assertJsCondition($condition, $timeout);
- }
-
- /**
* Gets the Off-Canvas tray element.
*
* @return \Behat\Mink\Element\NodeElement|null