You are here

public function TestSubContext::waitForLivePreview in Drupal Commons 7.3

Wait until the live preview to finish.

@When I wait for live preview to finish

File

tests/steps/commons_test.behat.inc, line 320
Provide Behat step-definitions for generic Commons tests.

Class

TestSubContext

Code

public function waitForLivePreview() {

  // Make sure the live preview has triggered by bluring the current focus.
  $this
    ->getSession()
    ->executeScript("document.activeElement.blur()");
  $this
    ->getSession()
    ->wait(5000, 'typeof jQuery !== "undefined" && jQuery.active === 0 && jQuery("#panopoly-form-widget-preview").length > 0 && !jQuery("#panopoly-form-widget-preview").hasClass("panopoly-magic-loading")');
}