You are here

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

#varbase: To check if we do have the text in the selected panel region. using the code name of the panel region. or the html id.

Example 1: Then I should see "Add new pane" in the "Center" panel region Example 2: Then I should see "custom pane title" in the "Right side" panel region Example 3: Then I should see "Add new pane" in the "panels-ipe-regionid-center" panel region

@Then /^I should see "(?P<text>[^"]*)" in the "(?P<panleRegion>[^"]*)" panel region$/

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iShouldSeeInThePanelRegion($text, $panleRegion) {
  if (strpos($panleRegion, "panels-ipe-regionid-")) {
    $panleRegionId = $panleRegion;
  }
  else {
    $panleRegionId = "panels-ipe-regionid-" . str_replace(' ', '-', strtolower($panleRegion));
  }
  $elementPanelRegion = $this
    ->getSession()
    ->getPage()
    ->find('xpath', "//*[contains(@id, '{$panleRegionId}')]");
  if (empty($elementPanelRegion)) {
    throw new Exception('The panle region [ ' . $panleRegion . ' ] is not in the page.');
  }
  $element = $this
    ->getSession()
    ->getPage()
    ->find('xpath', "//*[contains(@id, '{$panleRegionId}')]//*[text()='{$text}']");
  if (empty($element)) {
    throw new Exception('The panle region "' . $panleRegion . '" dose not have "' . $text . '" in it.');
  }
}