public function VarbaseContext::iClickInThePanelRegion in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.4
Same name and namespace in other branches
- 8.8 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickInThePanelRegion()
- 8.5 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickInThePanelRegion()
- 8.6 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickInThePanelRegion()
- 8.7 tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickInThePanelRegion()
- 9.0.x tests/features/bootstrap/VarbaseContext.php \VarbaseContext::iClickInThePanelRegion()
#varbase: To click on the text in the selected panel region. using the code name of the panel region. or the html id.
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: When 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 1005
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();
}