Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / outside_in / tests / src / FunctionalJavascript / OutsideInJavascriptTestBase.php
index 2dcc40fb44b4e7c9bc8d6ecf96bddce4a8a8ac09..129aaec7ec2d8c1f42ea1f048698d728d647d87f 100644 (file)
@@ -42,7 +42,7 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
   protected function waitForOffCanvasToOpen() {
     $web_assert = $this->assertSession();
     $web_assert->assertWaitOnAjaxRequest();
-    $web_assert->waitForElementVisible('css', '#drupal-off-canvas');
+    $this->assertElementVisibleAfterWait('css', '#drupal-off-canvas');
   }
 
   /**
@@ -125,7 +125,7 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
     $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');
+    $this->assertElementVisibleAfterWait('css', '.toolbar-fixed');
     // Waiting for Toolbar animation.
     $web_assert->assertWaitOnAjaxRequest();
   }
@@ -140,4 +140,19 @@ abstract class OutsideInJavascriptTestBase extends JavascriptTestBase {
     return ['bartik', 'stark', 'classy', 'stable'];
   }
 
+  /**
+   * Asserts the specified selector is visible after a wait.
+   *
+   * @param string $selector
+   *   The selector engine name. See ElementInterface::findAll() for the
+   *   supported selectors.
+   * @param string|array $locator
+   *   The selector locator.
+   * @param int $timeout
+   *   (Optional) Timeout in milliseconds, defaults to 10000.
+   */
+  protected function assertElementVisibleAfterWait($selector, $locator, $timeout = 10000) {
+    $this->assertNotEmpty($this->assertSession()->waitForElementVisible($selector, $locator, $timeout));
+  }
+
 }