summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-12-01 12:19:48 (GMT)
committerAlex Pott2016-12-01 12:19:48 (GMT)
commitfdbc6eb8a2f49ac44a6598d694532bb0ddc0bd50 (patch)
tree8d44ac056a2161412ca13212f6e8f0c75f66b625
parenta55b8ef19eb243d383ea93fa6fd3c4ebce97cf03 (diff)
Issue #2830485 by klausi, michielnugter: \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest fails randomly
-rw-r--r--core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php2
-rw-r--r--core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php4
-rw-r--r--core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php8
-rw-r--r--core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php10
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php2
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php4
6 files changed, 15 insertions, 15 deletions
diff --git a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
index e895b68..d8d406b 100644
--- a/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
+++ b/core/modules/book/tests/src/FunctionalJavascript/BookJavascriptTest.php
@@ -73,7 +73,7 @@ class BookJavascriptTest extends JavascriptTestBase {
$dragged->dragTo($target);
// Give javascript some time to manipulate the DOM.
- $this->getSession()->wait(1000, 'jQuery(".tabledrag-changed-warning").is(":visible")');
+ $this->assertJsCondition('jQuery(".tabledrag-changed-warning").is(":visible")');
// Check that the 'unsaved changes' text appeared in the message area.
$this->assertSession()->pageTextContains('You have unsaved changes.');
diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
index e0b4ce13..d104049 100644
--- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
@@ -111,7 +111,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
if (isset($block['new_page_text'])) {
$page->pressButton($block['button_text']);
// Make sure the changes are present.
- $this->getSession()->wait(500);
+ $this->assertSession()->assertWaitOnAjaxRequest();
$web_assert->pageTextContains($block['new_page_text']);
}
@@ -141,7 +141,7 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
protected function toggleEditingMode() {
$this->waitForElement('div[data-contextual-id="block:block=powered:langcode=en|outside_in::langcode=en"] .contextual-links a');
- $this->waitForElement('#toolbar-bar', 3000);
+ $this->waitForElement('#toolbar-bar');
$edit_button = $this->getSession()->getPage()->find('css', '#toolbar-bar div.contextual-toolbar-tab button');
diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
index ab7cf59..fe8fcf4 100644
--- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInJavascriptTestBase.php
@@ -45,9 +45,9 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
* @param string $selector
* CSS selector.
* @param int $timeout
- * (optional) Timeout in milliseconds, defaults to 1000.
+ * (optional) Timeout in milliseconds, defaults to 10000.
*/
- protected function waitForElement($selector, $timeout = 1000) {
+ protected function waitForElement($selector, $timeout = 10000) {
$condition = "(jQuery('$selector').length > 0)";
$this->assertJsCondition($condition, $timeout);
}
@@ -69,9 +69,9 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
* @param string $selector
* CSS selector.
* @param int $timeout
- * (optional) Timeout in milliseconds, defaults to 1000.
+ * (optional) Timeout in milliseconds, defaults to 10000.
*/
- protected function waitForNoElement($selector, $timeout = 1000) {
+ protected function waitForNoElement($selector, $timeout = 10000) {
$condition = "(jQuery('$selector').length == 0)";
$this->assertJsCondition($condition, $timeout);
}
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
index fc98e87..4cf51d5 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
@@ -39,12 +39,12 @@ class LibraryCachingTest extends JavascriptTestBase {
$add_link = $page->findById('views-add-field');
$this->assertTrue($add_link->isVisible(), 'Add fields button found.');
$add_link->click();
- $this->getSession()->wait(5000, "jQuery('.ui-dialog-titlebar').length > 0");
+ $this->assertJsCondition("jQuery('.ui-dialog-titlebar').length > 0");
// Close the dialog and open it again. No no libraries will be loaded, but a
// cache entry will be made for not loading any libraries.
$page->pressButton('Close');
$add_link->click();
- $this->getSession()->wait(5000, "jQuery('.ui-dialog-titlebar').length > 0");
+ $this->assertJsCondition("jQuery('.ui-dialog-titlebar').length > 0");
$page->pressButton('Close');
// Reload the page.
@@ -55,14 +55,14 @@ class LibraryCachingTest extends JavascriptTestBase {
$preview = $page->findById('preview-submit');
// The first click will load all the libraries.
$preview->click();
- $this->getSession()->wait(5000, "jQuery('.ajax-progress').length === 0");
+ $this->assertJsCondition("jQuery('.ajax-progress').length === 0");
// The second click will not load any new libraries.
$preview->click();
- $this->getSession()->wait(5000, "jQuery('.ajax-progress').length === 0");
+ $this->assertJsCondition("jQuery('.ajax-progress').length === 0");
// Check to see if the dialogs still open.
$add_link = $page->findById('views-add-field');
$add_link->click();
- $this->getSession()->wait(5000, "jQuery('.ui-dialog-titlebar').length > 0");
+ $this->assertJsCondition("jQuery('.ui-dialog-titlebar').length > 0");
$page->pressButton('Close');
}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
index 23c2f0b..10aa88e 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
@@ -86,7 +86,7 @@ class MachineNameTest extends JavascriptTestBase {
$title_1->setValue($test_info['input']);
// Wait the set timeout for fetching the machine name.
- $this->getSession()->wait(1000, 'jQuery("#edit-machine-name-1-label-machine-name-suffix .machine-name-value").html() == "' . $test_info['expected'] . '"');
+ $this->assertJsCondition('jQuery("#edit-machine-name-1-label-machine-name-suffix .machine-name-value").html() == "' . $test_info['expected'] . '"');
// Validate the generated machine name.
$this->assertEquals($test_info['expected'], $machine_name_1_value->getHtml(), $test_info['message']);
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
index eecafb0..d5156ee 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php
@@ -99,7 +99,7 @@ abstract class JavascriptTestBase extends BrowserTestBase {
* @param string $condition
* JS condition to wait until it becomes TRUE.
* @param int $timeout
- * (Optional) Timeout in milliseconds, defaults to 1000.
+ * (Optional) Timeout in milliseconds, defaults to 10000.
* @param string $message
* (optional) A message to display with the assertion. If left blank, a
* default message will be displayed.
@@ -108,7 +108,7 @@ abstract class JavascriptTestBase extends BrowserTestBase {
*
* @see \Behat\Mink\Driver\DriverInterface::evaluateScript()
*/
- protected function assertJsCondition($condition, $timeout = 1000, $message = '') {
+ protected function assertJsCondition($condition, $timeout = 10000, $message = '') {
$message = $message ?: "Javascript condition met:\n" . $condition;
$result = $this->getSession()->getDriver()->wait($timeout, $condition);
$this->assertTrue($result, $message);