You are here

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

#varbase: To find an element with a selected index having the first attribute, and check if it's have the second one.

Example #1: Then I should see the "1" "wrapper" with "align2right" class

@Then I should see the :nth :arg1 with :arg2 class

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iShouldSeeTheElementWithTheIndexHavingTheAttribute($index, $wrapper, $position) {
  $items = $this
    ->getSession()
    ->getPage()
    ->findAll('css', '.' . $wrapper);
  $item = $items[$index]
    ->find('css', '.' . $wrapper . '.' . $position);
  if (!$item) {
    throw new Exception("The image position is wrong");
  }
}