private function EntityBrowserTrait::waitForEntityBrowser in Lightning Media 8.4
Same name and namespace in other branches
- 8.3 tests/src/Traits/EntityBrowserTrait.php \Drupal\Tests\lightning_media\Traits\EntityBrowserTrait::waitForEntityBrowser()
Waits for an entity browser frame to load.
Parameters
string $id: The machine name of the entity browser.
bool $switch: (optional) Whether to switch into the entity browser's frame once it has loaded. Defaults to TRUE.
2 calls to EntityBrowserTrait::waitForEntityBrowser()
- ImageBrowserCardinalityTest::openImageBrowser in modules/
lightning_media_image/ tests/ src/ FunctionalJavascript/ ImageBrowserCardinalityTest.php - Opens a modal image browser.
- ImageBrowserTest::testUpload in tests/
src/ FunctionalJavascript/ ImageBrowserTest.php - Tests uploading an image in the image browser.
File
- tests/
src/ Traits/ EntityBrowserTrait.php, line 29
Class
- EntityBrowserTrait
- Contains methods for interacting with entity browsers in frames.
Namespace
Drupal\Tests\lightning_media\TraitsCode
private function waitForEntityBrowser($id, $switch = TRUE) {
$frame = 'entity_browser_iframe_' . $id;
$this
->assertJsCondition("window.{$frame} !== undefined");
$this
->assertJsCondition("window.{$frame}.document.readyState === 'complete'");
if ($switch) {
$this
->getSession()
->switchToIFrame($frame);
$this->currentEntityBrowser = $id;
}
}