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 Dec 17, 2023
1 parent 3d64eac commit 2cafba2
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 2cafba2

Please sign in to comment.