You are here

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

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

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

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

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

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iShouldNotSeeTextUnderTheeEitorMediaBrowser($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);
}