You are here

public function EntityBrowserContext::submit in Lightning Media 8

Same name and namespace in other branches
  1. 8.2 tests/contexts/EntityBrowserContext.behat.inc \Acquia\LightningExtension\Context\EntityBrowserContext::submit()
  2. 8.3 tests/contexts/EntityBrowserContext.behat.inc \Acquia\LightningExtension\Context\EntityBrowserContext::submit()

Submits the entity browser.

@When I submit the entity browser

File

tests/contexts/EntityBrowserContext.behat.inc, line 111

Class

EntityBrowserContext
Contains step definitions for interacting with entity browser instances.

Namespace

Acquia\LightningExtension\Context

Code

public function submit() {
  $session = $this
    ->getSession();

  // The entity browser frame will be destroyed, so we need to switch into
  // the main window and reach into the frame to submit the form...ugh.
  $frame = $session
    ->evaluateScript('frameElement.name');
  $session
    ->switchToWindow();

  // @TODO: Make this smarter, because we can't be sure that #edit-submit
  // exists at all, or that it's the correct submit button.
  $session
    ->executeScript('frames["' . $frame . '"].document.forms[0].querySelector("#edit-submit").click()');
  sleep(10);
  $this
    ->awaitAjax();
}