Skip to content

Commit

Permalink
MNT Add new behat function to allow deleting gridfield rows
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 23, 2023
1 parent 0022498 commit bf52ace
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/behat/src/CmsFormsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\BehatExtension\Utility\StepHelper;
use Symfony\Component\DomCrawler\Crawler;
use Behat\Mink\Element\NodeElement;
use Facebook\WebDriver\WebDriverExpectedCondition;
use SilverStripe\SiteConfig\SiteConfig;

/**
Expand Down Expand Up @@ -445,6 +446,23 @@ public function stepIClickTheGridFieldButtonForRow($buttonLabel, $gridFieldName,
$button->click();
}

/**
* @When /^I click the "([^"]*)" button in the "([^"]*)" gridfield for the "([^"]*)" row, confirming the dialog$/
* @param string $buttonLabel
* @param string $gridFieldName
* @param string $rowName
*/
public function stepIClickTheGridFieldButtonForRowConfirmingDialog($buttonLabel, $gridFieldName, $rowName)
{
$this->stepIClickTheGridFieldButtonForRow($buttonLabel, $gridFieldName, $rowName);
$session = $this->getSession()->getDriver()->getWebDriver();
$session->wait()->until(
WebDriverExpectedCondition::alertIsPresent(),
"Alert is expected"
);
$session->switchTo()->alert()->accept();
}

/**
* Finds a button in the gridfield row
*
Expand Down

0 comments on commit bf52ace

Please sign in to comment.