MNT Use behat-extension function for clicking elements

This commit is contained in:
Steve Boyd 2021-04-15 13:42:45 +12:00
parent acbcf4660c
commit d7570cb0e6
3 changed files with 3 additions and 30 deletions

View File

@ -33,9 +33,9 @@ Feature: Create a page
Scenario: I cannot add root level pages without permission
When I go to "/admin/settings"
And I click the "Access" CMS tab
And I click the "#Form_EditForm_CanCreateTopLevelType_OnlyTheseUsers" element
And I click on the "#Form_EditForm_CanCreateTopLevelType_OnlyTheseUsers" element
And I press the "Save" button
And I click the ".cms-login-status__logout-link" element
And I click on the ".cms-login-status__logout-link" element
When I am logged in with "AUTHOR" permissions
And I press the "Add new" button
Then I see the "Top level" radio button "disabled" attribute equals "1"

View File

@ -85,7 +85,7 @@ Feature: Publish a page
# 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 click on the "#Form_EditForm_action_archive" element, confirming the dialog
Then I should see a "Restore" button
And I should not see a "Published" button

View File

@ -80,33 +80,6 @@ class FixtureContext extends BehatFixtureContext
$obj->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
}
/**
* @When /^I click the "([^"]+)" element$/
* @param $selector
*/
public function iClickTheElement($selector)
{
/** @var DocumentElement $page */
$page = $this->getMainContext()->getSession()->getPage();
$element = $page->find('css', $selector);
assertNotNull($element, sprintf('Element %s not found', $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