You are here

public function VarbaseContext::iShouldSeeTextUnderTheEditorMediaBrowser 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::iShouldSeeTextUnderTheEditorMediaBrowser()
  2. 8.4 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iShouldSeeTextUnderTheEditorMediaBrowser()
  3. 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iShouldSeeTextUnderTheEditorMediaBrowser()
  4. 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iShouldSeeTextUnderTheEditorMediaBrowser()
  5. 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iShouldSeeTextUnderTheEditorMediaBrowser()

#varbase : To check if we can see a text under the editor media browser.

Example 1: Then I should see "this text" under editor media browser Example 2: Then I should see "this text" under the editormedia browser modal window

@Then /^I should see "([^"]*)" under (?:|the )editor media browser(?:| modal window)$/

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iShouldSeeTextUnderTheEditorMediaBrowser($text) {

  // Switch to the "entity_browser_iframe_editor_media_browser" iframe.
  $this
    ->getSession()
    ->switchToIFrame('entity_browser_iframe_editor_media_browser');
  $actual = $this
    ->getSession()
    ->getPage()
    ->getText();
  $actual = preg_replace('/\\s+/u', ' ', $actual);
  $regex = '/' . preg_quote($text, '/') . '/ui';
  if (!preg_match($regex, $actual)) {
    throw new Exception(sprintf('The text "%s" was not found anywhere in the text of the current page.', $text));
  }

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