You are here

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

#varbase : To Find an image with the title text attribute.

Example 1: Then I should see image with the "Flag Earth" title text

@Then /^I should see image with the "([^"]*)" title text$/

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iShouldSeeImageWithTheTitleText($titleText) {

  // Find an image with the title.
  $element = $this
    ->getSession()
    ->getPage()
    ->find('xpath', "//img[contains(@title, '{$titleText}')]");
  if (empty($element)) {
    throw new Exception('The page dose not have an image with the [ ' . $titleText . ' ] title text.');
  }
}