MDL-61234 tool_usertours: Rewrite feature to work with all themes

This commit is contained in:
Andrew Nicols 2018-01-24 10:05:42 +08:00
parent 6d326e1179
commit 0b048da8c0
3 changed files with 40 additions and 20 deletions

View file

@ -62,7 +62,16 @@ class behat_tool_usertours extends behat_base {
public function i_add_steps_to_the_named_tour($tourname, TableNode $table) {
$this->execute('behat_tool_usertours::i_open_the_user_tour_settings_page');
$this->execute('behat_general::click_link', $this->escape($tourname));
$this->execute('behat_tool_usertours::i_add_steps_to_the_tour', $table);
}
/**
* Add new steps to the current user tour.
*
* @Given /^I add steps to the tour:$/
* @param TableNode $table
*/
public function i_add_steps_to_the_tour(TableNode $table) {
foreach ($table->getHash() as $step) {
$this->execute('behat_general::click_link', get_string('newstep', 'tool_usertours'));

View file

@ -85,3 +85,34 @@ Feature: Apply accessibility to a tour
Then the focused element is "Side panel" "button"
When I press shift tab
And the focused element is "End tour" "button" in the "Navigation" "dialogue"
@javascript
Scenario: Aria tags should not exist
Given I log in as "admin"
And I add a new user tour with:
| Name | First tour |
| Description | My first tour |
| Apply to URL match | FRONTPAGE |
| Tour is enabled | 1 |
And I add steps to the "First tour" tour:
| targettype | Title | Content |
| Display in middle of page | Welcome | Welcome to your course tour. |
And I add steps to the tour:
| targettype | targetvalue_selector | Title | Content |
| Selector | input,button | Page 2 | Next page |
And I add steps to the tour:
| targettype | Title | Content |
| Display in middle of page | Page 3 | Final page. |
And I am on site homepage
When I click on "Next" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should exist
And "input[tabindex],button[tabindex]" "css_element" should exist
When I click on "Next" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And "input[tabindex],button[tabindex]" "css_element" should not exist
When I click on "Previous" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should exist
And "input[tabindex],button[tabindex]" "css_element" should exist
When I click on "End tour" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And "input[tabindex],button[tabindex]" "css_element" should not exist

View file

@ -157,23 +157,3 @@ Feature: Apply tour filters to a tour
When I am on "Course 2" course homepage
And I wait until the page is ready
Then I should not see "Welcome to your course tour."
@javascript
Scenario: Aria tags should not exist
Given I log in as "admin"
And I open the User tour settings page
# Turn on default tour for boost theme.
And I click on "Enable" "link" in the "Boost - administrator" "table_row"
And I am on site homepage
When I click on "Next" "button"
Then "button[aria-describedby^='tour-step-tool_usertours']" "css_element" should exist
And "button[tabindex]" "css_element" should exist
When I click on "Next" "button"
Then "button[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And "button[tabindex]" "css_element" should not exist
When I click on "Previous" "button"
Then "button[aria-describedby^='tour-step-tool_usertours']" "css_element" should exist
And "button[tabindex]" "css_element" should exist
When I click on "End tour" "button"
Then "button[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And "button[tabindex]" "css_element" should not exist