You are here

public function VarbaseContext::iClickInThePanelRegion in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 9.0.x

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

Click on the text in the selected panel region.

Using the code name of the panel region. or the html id. Varbase Context #varbase.

Example #1: When I click "Add new pane" in the "center" panel region Example #2: When I click "Region style" in the "left" panel region Example #3: And I click "Add new pane" in the "panels-ipe-regionid-center" panel region.

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

File

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

Class

VarbaseContext
Defines application features from the specific context.

Code

public function iClickInThePanelRegion($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 . '".');
  }
  $element
    ->click();
}