MNT Add new behat function to allow deleting gridfield rows

This commit is contained in:
Guy Sartorelli 2023-11-22 17:03:28 +13:00
parent 3d64eac129
commit 2cafba2bd5
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A

View File

@ -12,6 +12,7 @@ use SilverStripe\BehatExtension\Context\MainContextAwareTrait;
use SilverStripe\BehatExtension\Utility\StepHelper;
use Symfony\Component\DomCrawler\Crawler;
use Behat\Mink\Element\NodeElement;
use Facebook\WebDriver\WebDriverExpectedCondition;
use SilverStripe\SiteConfig\SiteConfig;
/**
@ -445,6 +446,23 @@ JS;
$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
*