You are here

public function VarbaseContext::iSelectTheFileUnderTheEditorMediaBrowser in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.5

Same name and namespace in other branches
  1. 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iSelectTheFileUnderTheEditorMediaBrowser()
  2. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iSelectTheFileUnderTheEditorMediaBrowser()
  3. 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iSelectTheFileUnderTheEditorMediaBrowser()
  4. 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iSelectTheFileUnderTheEditorMediaBrowser()
  5. 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iSelectTheFileUnderTheEditorMediaBrowser()

#varbase : select the file under the editor media browser.

Example 1: When I click on the "Flag Earth" file under the editor media browser

@When /^I select (?:|the )"([^"]*)" file under (?:|the )editor media browser$/

File

tests/features/bootstrap/VarbaseContext.php, line 323

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iSelectTheFileUnderTheEditorMediaBrowser($text) {

  // Switch to the "entity_browser_iframe_editor_media_browser" iframe.
  $this
    ->getSession()
    ->switchToIFrame('entity_browser_iframe_editor_media_browser');

  // Find the file by text.
  $element = $this
    ->getSession()
    ->getPage()
    ->find('xpath', "//div[contains(@class, 'media-item') and contains(@title, '{$text}')]");
  if (empty($element)) {
    throw new Exception('The editor media browser dose not have [ ' . $text . ' ] file.');
  }
  $element
    ->click();

  // Switch back too the page from the "entity_browser_iframe_editor_media_browser" iframe.
  $this
    ->getSession()
    ->switchToIFrame(null);
}