Commit fdbc6eb8 authored by alexpott's avatar alexpott

Issue #2830485 by klausi, michielnugter:...

Issue #2830485 by klausi, michielnugter: \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest fails randomly
parent a55b8ef1
......@@ -73,7 +73,7 @@ public function testBookOrdering() {
$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.');
......
......@@ -111,7 +111,7 @@ public function testBlocks() {
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 @@ public function testBlocks() {
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');
......
......@@ -45,9 +45,9 @@ protected function waitForOffCanvasToClose() {
* @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 @@ protected function getTray() {
* @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);
}
......
......@@ -39,12 +39,12 @@ public function testConsecutiveDialogRequests() {
$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 @@ public function testConsecutiveDialogRequests() {
$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');
}
......
......@@ -86,7 +86,7 @@ public function testMachineName() {
$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']);
......
......@@ -99,7 +99,7 @@ protected function assertElementNotVisible($css_selector, $message = '') {
* @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 @@ protected function assertElementNotVisible($css_selector, $message = '') {
*
* @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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment