Skip to content

Commit

Permalink
Merge branch '4.6' into 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Mar 20, 2021
2 parents babc8a4 + 1cd8b76 commit acbcf46
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/behat/features/publish-a-page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ Feature: Publish a page

When I press the "Unpublish" button, confirming the dialog
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
And I should not see a "Published" button
And I should not see a "Publish" button
Expand Down
26 changes: 26 additions & 0 deletions tests/behat/src/FixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace SilverStripe\CMS\Tests\Behaviour;

use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Mink\Element\DocumentElement;
use Behat\Mink\Element\NodeElement;
use SilverStripe\BehatExtension\Context\BasicContext;
use SilverStripe\BehatExtension\Context\FixtureContext as BehatFixtureContext;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Model\SiteTree;
Expand All @@ -17,6 +19,18 @@
*/
class FixtureContext extends BehatFixtureContext
{
/**
* @var BasicContext
*/
protected $basicContext;


/** @BeforeScenario */
public function gatherContexts(BeforeScenarioScope $scope)
{
$this->basicContext = $scope->getEnvironment()->getContext(BasicContext::class);
}

protected function scaffoldDefaultFixtureFactory()
{
$factory = parent::scaffoldDefaultFixtureFactory();
Expand Down Expand Up @@ -81,6 +95,18 @@ public function iClickTheElement($selector)
$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$/
* @param $selector
Expand Down

0 comments on commit acbcf46

Please sign in to comment.