diff --git a/src/Context/BasicContext.php b/src/Context/BasicContext.php index 1b3ae49..f043981 100644 --- a/src/Context/BasicContext.php +++ b/src/Context/BasicContext.php @@ -278,7 +278,7 @@ JS; public function closeModalDialog(AfterScenarioScope $event) { $expectsUnsavedChangesModal = $this->stepHasTag($event, 'unsavedChanges'); - + try { // Only for failed tests on CMS page if ($expectsUnsavedChangesModal || $event->getTestResult()->getResultCode() === TestResult::FAILED) { @@ -487,6 +487,18 @@ JS; $this->iDismissTheDialog(); } + /** + * @Given /^I click on the "([^"]+)" element$/ + * @param string $selector + */ + public function iClickOnTheElement($selector) + { + $page = $this->getMainContext()->getSession()->getPage(); + $element = $page->find('css', $selector); + assertNotNull($element, sprintf('Element %s not found', $selector)); + $element->click(); + } + /** * @Given /^I (click|double click) "([^"]*)" in the "([^"]*)" element$/ * @param string $clickType @@ -867,7 +879,7 @@ JS; $linkObj = $regionObj->findLink($link); if (empty($linkObj)) { - throw new \Exception(sprintf('The link "%s" was not found in the region "%s" + throw new \Exception(sprintf('The link "%s" was not found in the region "%s" on the page %s', $link, $region, $this->getSession()->getCurrentUrl())); } @@ -893,7 +905,7 @@ JS; $fieldObj = $regionObj->findField($field); if (empty($fieldObj)) { - throw new \Exception(sprintf('The field "%s" was not found in the region "%s" + throw new \Exception(sprintf('The field "%s" was not found in the region "%s" on the page %s', $field, $region, $this->getSession()->getCurrentUrl())); } @@ -1031,11 +1043,11 @@ JS; ); // Find tables by a