mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2642 from creative-commoners/pulls/4.6/fix/behat
MNT Fix archive button behat test
This commit is contained in:
commit
1cd8b76426
@ -82,9 +82,11 @@ Feature: Publish a page
|
|||||||
|
|
||||||
When I press the "Unpublish" button, confirming the dialog
|
When I press the "Unpublish" button, confirming the dialog
|
||||||
And I click "More options" in the "#ActionMenus" element
|
And I click "More options" in the "#ActionMenus" element
|
||||||
Then I should see an "Archive" button
|
# Use a css-selector instead of the the "Archive" button otherwise it will get confused with
|
||||||
|
# the "Archive" model admin
|
||||||
|
Then I see the "#Form_EditForm_action_archive" element
|
||||||
|
When I click the "#Form_EditForm_action_archive" element, confirming the dialog
|
||||||
|
|
||||||
When I press the "Archive" button, confirming the dialog
|
|
||||||
Then I should see a "Restore" button
|
Then I should see a "Restore" button
|
||||||
And I should not see a "Published" button
|
And I should not see a "Published" button
|
||||||
And I should not see a "Publish" button
|
And I should not see a "Publish" button
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace SilverStripe\CMS\Tests\Behaviour;
|
namespace SilverStripe\CMS\Tests\Behaviour;
|
||||||
|
|
||||||
|
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||||
use Behat\Mink\Element\DocumentElement;
|
use Behat\Mink\Element\DocumentElement;
|
||||||
use Behat\Mink\Element\NodeElement;
|
use Behat\Mink\Element\NodeElement;
|
||||||
|
use SilverStripe\BehatExtension\Context\BasicContext;
|
||||||
use SilverStripe\BehatExtension\Context\FixtureContext as BehatFixtureContext;
|
use SilverStripe\BehatExtension\Context\FixtureContext as BehatFixtureContext;
|
||||||
use SilverStripe\CMS\Model\RedirectorPage;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
@ -17,6 +19,18 @@ use SilverStripe\Versioned\Versioned;
|
|||||||
*/
|
*/
|
||||||
class FixtureContext extends BehatFixtureContext
|
class FixtureContext extends BehatFixtureContext
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var BasicContext
|
||||||
|
*/
|
||||||
|
protected $basicContext;
|
||||||
|
|
||||||
|
|
||||||
|
/** @BeforeScenario */
|
||||||
|
public function gatherContexts(BeforeScenarioScope $scope)
|
||||||
|
{
|
||||||
|
$this->basicContext = $scope->getEnvironment()->getContext(BasicContext::class);
|
||||||
|
}
|
||||||
|
|
||||||
protected function scaffoldDefaultFixtureFactory()
|
protected function scaffoldDefaultFixtureFactory()
|
||||||
{
|
{
|
||||||
$factory = parent::scaffoldDefaultFixtureFactory();
|
$factory = parent::scaffoldDefaultFixtureFactory();
|
||||||
@ -81,6 +95,18 @@ class FixtureContext extends BehatFixtureContext
|
|||||||
$element->click();
|
$element->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Needs to be in single command to avoid "unexpected alert open" errors in Selenium.
|
||||||
|
*
|
||||||
|
* @When /^I click the "([^"]+)" element, confirming the dialog$/
|
||||||
|
* @param $selector
|
||||||
|
*/
|
||||||
|
public function iClickTheElementConfirmingTheDialog($selector)
|
||||||
|
{
|
||||||
|
$this->iClickTheElement($selector);
|
||||||
|
$this->basicContext->iConfirmTheDialog();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^I see the "([^"]+)" element$/
|
* @When /^I see the "([^"]+)" element$/
|
||||||
* @param $selector
|
* @param $selector
|
||||||
|
Loading…
Reference in New Issue
Block a user