public function MediaBrowserContext::completeSelection in Lightning Media 8
Same name and namespace in other branches
- 8.2 tests/contexts/MediaBrowserContext.behat.inc \Acquia\LightningExtension\Context\MediaBrowserContext::completeSelection()
- 8.3 tests/contexts/MediaBrowserContext.behat.inc \Acquia\LightningExtension\Context\MediaBrowserContext::completeSelection()
Completes the media browser selection.
@When I complete the media browser selection
File
- tests/
contexts/ MediaBrowserContext.behat.inc, line 73
Class
- MediaBrowserContext
- Contains step definitions for interacting with Lightning's media browser.
Namespace
Acquia\LightningExtension\ContextCode
public function completeSelection() {
$session = $this
->getSession();
// The iframe is destroyed after submitting it, so we need to switch back
// into the window context in order for the session to stay sane.
$session
->switchToWindow();
$frame = 'window.frames.entity_browser_iframe_media_browser';
$session
->executeScript("{$frame}.document.forms[0].elements.op.click()");
$this
->awaitExpression("!{$frame}");
$this
->awaitAjax();
$this
->awaitElement('form.entity-embed-dialog');
$session
->executeScript('document.querySelector("form.entity-embed-dialog").elements.op[1].click()');
$this
->awaitAjax();
}