Skip to content

Commit

Permalink
Merge branch '4.3' into 4
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 15, 2021
2 parents fc93151 + bcecdab commit d732141
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/Context/BasicContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public function takeScreenshotAfterFailedStep(AfterStepScope $event)
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) {
Expand Down Expand Up @@ -487,6 +487,18 @@ public function stepIPressTheButtonDismissingTheDialog($button)
$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
Expand Down Expand Up @@ -867,7 +879,7 @@ public function iFollowInTheRegion($link, $region)

$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()));
}

Expand All @@ -893,7 +905,7 @@ public function iFillinTheRegion($field, $value, $region)

$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()));
}

Expand Down Expand Up @@ -1031,11 +1043,11 @@ protected function getTable($selector)
);

// Find tables by a <caption> field
$candidates += $page->findAll('xpath', "//table//caption[contains(normalize-space(string(.)),
$candidates += $page->findAll('xpath', "//table//caption[contains(normalize-space(string(.)),
$selector)]/ancestor-or-self::table[1]");

// Find tables by a .title node
$candidates += $page->findAll('xpath', "//table//*[contains(concat(' ',normalize-space(@class),' '), ' title ') and contains(normalize-space(string(.)),
$candidates += $page->findAll('xpath', "//table//*[contains(concat(' ',normalize-space(@class),' '), ' title ') and contains(normalize-space(string(.)),
$selector)]/ancestor-or-self::table[1]");

// Some tables don't have a visible title, so look for a fieldset with data-name instead
Expand Down

0 comments on commit d732141

Please sign in to comment.