diff --git a/backup/util/ui/tests/behat/duplicate_activities.feature b/backup/util/ui/tests/behat/duplicate_activities.feature index 099a4981680..8fe100c84dd 100644 --- a/backup/util/ui/tests/behat/duplicate_activities.feature +++ b/backup/util/ui/tests/behat/duplicate_activities.feature @@ -21,14 +21,18 @@ Feature: Duplicate activities And I add a "Database" to section "1" and I fill the form with: | Name | Test database name | | Description | Test database description | - And I click on "Actions" "link" in the "Test database name" activity + And I open "Test database name" actions menu When I click on "Duplicate" "link" in the "Test database name" activity - And I press "Continue" - And I press "Edit the new copy" + And I click on "Edit settings" "link" in the "Test database name" activity + And I fill the moodle form with: + | Name | Original database name | + And I press "Save and return to course" + And I open "Test database name" actions menu + And I click on "Edit settings" "link" in the "Test database name" activity And I fill the moodle form with: | Name | Duplicated database name | | Description | Duplicated database description | And I press "Save and return to course" - Then I should see "Test database name" in the "#section-1" "css_element" + Then I should see "Original database name" in the "#section-1" "css_element" And I should see "Duplicated database name" in the "#section-1" "css_element" - And "Test database name" "link" should appear before "Duplicated database name" "link" + And "Original database name" "link" should appear before "Duplicated database name" "link" diff --git a/backup/util/ui/tests/behat/restore_moodle2_courses.feature b/backup/util/ui/tests/behat/restore_moodle2_courses.feature index 0ce2779a5c6..8d68ffdd79d 100644 --- a/backup/util/ui/tests/behat/restore_moodle2_courses.feature +++ b/backup/util/ui/tests/behat/restore_moodle2_courses.feature @@ -40,7 +40,7 @@ Feature: Restore Moodle 2 course backups Then I should see "Course 1 restored in a new course" And I should see "Community finder" in the "Community finder" "block" And I should see "Test forum name" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I expand all fieldsets And the "id_format" field should match "Topics format" value And the "Number of sections" field should match "15" value @@ -85,7 +85,7 @@ Feature: Restore Moodle 2 course backups When I restore "test_backup.mbz" backup into a new course using this options: Then I should see "Topic 1" And I should see "Test forum name" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I expand all fieldsets And the "id_format" field should match "Topics format" value And I fill the moodle form with: @@ -96,14 +96,14 @@ Feature: Restore Moodle 2 course backups And I press "Save changes" And I should see "1 January - 7 January" And I should see "Test forum name" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I expand all fieldsets And the "id_format" field should match "Weekly format" value And I fill the moodle form with: | id_format | Social format | And I press "Save changes" And I should see "An open forum for chatting about anything you want to" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I expand all fieldsets And the "id_format" field should match "Social format" value And I press "Cancel" @@ -120,7 +120,7 @@ Feature: Restore Moodle 2 course backups | Filename | test_backup.mbz | And I restore "test_backup.mbz" backup into "Course 2" course using this options: | Overwrite course configuration | Yes | - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I expand all fieldsets Then the "id_format" field should match "Topics format" value And the "Number of sections" field should match "15" value diff --git a/blocks/tests/behat/configure_block_throughout_site.feature b/blocks/tests/behat/configure_block_throughout_site.feature index e0070185a79..af2bc33c4df 100644 --- a/blocks/tests/behat/configure_block_throughout_site.feature +++ b/blocks/tests/behat/configure_block_throughout_site.feature @@ -18,6 +18,7 @@ Feature: Add and configure blocks throughout the site And I log in as "manager1" And I follow "Turn editing on" And I add the "Comments" block + And I click on "Actions" "link" in the "Comments" "block" And I follow "Configure Comments block" And I fill the moodle form with: | Page contexts | Display throughout the entire site | @@ -26,6 +27,7 @@ Feature: Add and configure blocks throughout the site Then I should see "Comments" in the "Comments" "block" And I should see "Save comment" in the "Comments" "block" And I am on homepage + And I click on "Actions" "link" in the "Comments" "block" And I follow "Configure Comments block" And I fill the moodle form with: | Default weight | -10 (first) | diff --git a/blocks/tests/behat/return_block_original_state.feature b/blocks/tests/behat/return_block_original_state.feature index 07baab86d15..8605ccc5881 100644 --- a/blocks/tests/behat/return_block_original_state.feature +++ b/blocks/tests/behat/return_block_original_state.feature @@ -15,6 +15,7 @@ Feature: The context of a block can always be returned to it's original state. And I add the "Tags" block Then I should see "Tags" in the "Tags" "block" And I click on "Participants" "link" in the "//li[p/span[contains(normalize-space(string(.)), 'Current course')]]" "xpath_element" + And I click on "Actions" "link" in the "Tags" "block" And I follow "Configure Tags block" And I fill the moodle form with: | Display on page types | Any page | @@ -24,6 +25,7 @@ Feature: The context of a block can always be returned to it's original state. | Assignment name | Assignment1 | | Description | Description | And I follow "Assignment1" + And I click on "Actions" "link" in the "Tags" "block" And I follow "Configure Tags block" And I fill the moodle form with: | Display on page types | Any assignment module page | @@ -39,6 +41,7 @@ Feature: The context of a block can always be returned to it's original state. | Description | Description | And I follow "Assignment2" And I should see "Tags" in the "Tags" "block" + And I click on "Actions" "link" in the "Tags" "block" And I follow "Configure Tags block" And I fill the moodle form with: | Display on page types | Any page | diff --git a/completion/tests/behat/enable_manual_complete_mark.feature b/completion/tests/behat/enable_manual_complete_mark.feature index 5d9eee19980..a14b9b9a1ce 100644 --- a/completion/tests/behat/enable_manual_complete_mark.feature +++ b/completion/tests/behat/enable_manual_complete_mark.feature @@ -25,7 +25,7 @@ Feature: Allow students to manually mark an activity as complete And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Enable completion tracking | Yes | And I press "Save changes" diff --git a/completion/tests/behat/restrict_section_availability.feature b/completion/tests/behat/restrict_section_availability.feature index 03505dc66ea..50688011a02 100644 --- a/completion/tests/behat/restrict_section_availability.feature +++ b/completion/tests/behat/restrict_section_availability.feature @@ -27,7 +27,7 @@ Feature: Restrict sections availability through completion or grade conditions Given I log in as "teacher1" And I follow "Course 1" And I turn editing mode on - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Enable completion tracking | Yes | And I press "Save changes" @@ -93,4 +93,4 @@ Feature: Restrict sections availability through completion or grade conditions And I log in as "student1" And I follow "Course 1" And "Test page name" activity should be visible - And I should not see "Not available until you achieve a required score in Grade assignment" \ No newline at end of file + And I should not see "Not available until you achieve a required score in Grade assignment" diff --git a/course/tests/behat/activities_group_icons.feature b/course/tests/behat/activities_group_icons.feature index 65abea5d721..055cb1a0cf9 100644 --- a/course/tests/behat/activities_group_icons.feature +++ b/course/tests/behat/activities_group_icons.feature @@ -21,7 +21,7 @@ Feature: Toggle activities groups mode from the course page And I add a "Forum" to section "1" and I fill the form with: | Forum name | Test forum name | | Description | Test forum description | - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Group mode | No groups | | Force group mode | No | diff --git a/course/tests/behat/activities_visibility_icons.feature b/course/tests/behat/activities_visibility_icons.feature index 6ef447f075d..fdcdb617a9c 100644 --- a/course/tests/behat/activities_visibility_icons.feature +++ b/course/tests/behat/activities_visibility_icons.feature @@ -24,7 +24,8 @@ Feature: Toggle activities visibility from the course page | Forum name | Test forum name | | Description | Test forum description | | Visible | Show | - When I click on "Hide" "link" in the "Test forum name" activity + When I open "Test forum name" actions menu + And I click on "Hide" "link" in the "Test forum name" activity Then "Test forum name" activity should be hidden And I click on "Show" "link" in the "Test forum name" activity And "Test forum name" activity should be visible diff --git a/course/tests/behat/add_activities.feature b/course/tests/behat/add_activities.feature index 40359164c90..db8879cb06f 100644 --- a/course/tests/behat/add_activities.feature +++ b/course/tests/behat/add_activities.feature @@ -30,7 +30,7 @@ Feature: Add activities to courses And I turn editing mode off Then I should not see "Adding a new" And I follow "Test name" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I expand all fieldsets And the "Name" field should match "Test name" value And the "Entries required for completion" field should match "9" value diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index eba484263de..c950c7e61a7 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -327,6 +327,11 @@ class behat_course extends behat_base { // Non-JS browsers can not click on img elements. if ($this->running_javascript()) { + + // Expanding the actions menu. + $actionsmenu = $this->find('css', "a[role='menuitem']", false, $activity); + $actionsmenu->click(); + // To check that the visibility is not clickable we check the funcionality rather than the applied style. $visibilityiconnode = $this->find('css', 'a.editing_show img', false, $activity); $visibilityiconnode->click(); @@ -527,7 +532,6 @@ class behat_course extends behat_base { // Adding chr(10) to save changes. $activity = $this->escape($activityname); return array( - new Given('I open "' . $activity . '" actions menu'), new Given('I click on "' . get_string('edittitle') . '" "link" in the "' . $activity .'" activity'), new Given('I fill in "title" with "' . $this->escape($newactivityname) . chr(10) . '"'), new Given('I wait "2" seconds') @@ -555,7 +559,7 @@ class behat_course extends behat_base { return; } - return new Given('I click on "' . get_string('actions', 'moodle') . '" "link" in the "' . $this->escape($activityname) . '" activity'); + return new Given('I click on "a[role=\'menuitem\']" "css_element" in the "' . $this->escape($activityname) . '" activity'); } /** @@ -654,8 +658,13 @@ class behat_course extends behat_base { $steps[] = new Given('I open "' . $activity . '" actions menu'); } $steps[] = new Given('I click on "' . get_string('duplicate') . '" "link" in the "' . $activity . '" activity'); - $steps[] = new Given('I press "' . get_string('continue') .'"'); - $steps[] = new Given('I press "' . get_string('duplicatecontcourse') .'"'); + if ($this->running_javascript()) { + // Temporary wait until MDL-41030 lands. + $steps[] = new Given('I wait "4" seconds'); + } else { + $steps[] = new Given('I press "' . get_string('continue') .'"'); + $steps[] = new Given('I press "' . get_string('duplicatecontcourse') .'"'); + } return $steps; } @@ -668,14 +677,31 @@ class behat_course extends behat_base { * @return Given[] */ public function i_duplicate_activity_editing_the_new_copy_with($activityname, TableNode $data) { + $steps = array(); + $activity = $this->escape($activityname); + if ($this->running_javascript()) { - $steps[] = new Given('I open "' . $activity . '" actions menu'); + $steps[] = new Given('I duplicate "' . $activity . '" activity'); + + // Determine the future new activity xpath from the former one. + $activityliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($activityname); + $duplicatedxpath = "//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')][contains(., $activityliteral)]" . + "/following-sibling::li"; + $duplicatedactionsmenuxpath = $duplicatedxpath . "/descendant::a[@role='menuitem']"; + + // The next sibling of the former activity will be the duplicated one, so we click on it from it's xpath as, at + // this point, it don't even exists in the DOM (the steps are executed when we return them). + $steps[] = new Given('I click on "' . $this->escape($duplicatedactionsmenuxpath) . '" "xpath_element"'); + + // We force the xpath as otherwise mink tries to interact with the former one. + $steps[] = new Given('I click on "' . get_string('editsettings') . '" "link" in the "' . $this->escape($duplicatedxpath) . '" "xpath_element"'); + } else { + $steps[] = new Given('I click on "' . get_string('duplicate') . '" "link" in the "' . $activity . '" activity'); + $steps[] = new Given('I press "' . get_string('continue') .'"'); + $steps[] = new Given('I press "' . get_string('duplicatecontedit') . '"'); } - $steps[] = new Given('I click on "' . get_string('duplicate') . '" "link" in the "' . $activity . '" activity'); - $steps[] = new Given('I press "' . get_string('continue') .'"'); - $steps[] = new Given('I press "' . get_string('duplicatecontedit') . '"'); $steps[] = new Given('I fill the moodle form with:', $data); $steps[] = new Given('I press "' . get_string('savechangesandreturntocourse') . '"'); return $steps; diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index 2550d7f93b7..283346e2bd5 100644 --- a/course/tests/behat/course_controls.feature +++ b/course/tests/behat/course_controls.feature @@ -56,7 +56,7 @@ Feature: Course activity controls works as expected And I indent left "Test forum name 1" activity And "#section-2" "css_element" exists And I open "Test forum name 1" actions menu - And I click on "Update" "link" in the "Test forum name 1" activity + And I click on "Edit settings" "link" in the "Test forum name 1" activity And I should see "Updating Forum" And I should see "Display description on course page" And I press "Save and return to course" @@ -128,7 +128,7 @@ Feature: Course activity controls works as expected And "#section-2" "css_element" exists And I indent left "Test forum name 1" activity And "#section-2" "css_element" exists - And I click on "Update" "link" in the "Test forum name 1" activity + And I click on "Edit settings" "link" in the "Test forum name 1" activity And I should see "Updating Forum" And I should see "Display description on course page" And I press "Save and return to course" diff --git a/course/tests/behat/edit_settings.feature b/course/tests/behat/edit_settings.feature index 7b2f7fcba1e..f2a811586fa 100644 --- a/course/tests/behat/edit_settings.feature +++ b/course/tests/behat/edit_settings.feature @@ -17,7 +17,7 @@ Feature: Edit course settings | teacher1 | C1 | editingteacher | And I log in as "teacher1" And I follow "Course 1" - When I follow "Edit settings" + When I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Course full name | Edited course fullname | | Course short name | Edited course shortname | @@ -28,7 +28,7 @@ Feature: Edit course settings And I should not see "C1" And I should see "Edited course fullname" And I should see "Edited course shortname" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And the "Course full name" field should match "Edited course fullname" value And the "Course short name" field should match "Edited course shortname" value And the "Course summary" field should match "Edited course summary" value diff --git a/course/tests/behat/force_group_mode.feature b/course/tests/behat/force_group_mode.feature index 59cc3219878..0964f83fd47 100644 --- a/course/tests/behat/force_group_mode.feature +++ b/course/tests/behat/force_group_mode.feature @@ -20,7 +20,7 @@ Feature: Force group mode in a course And I add a "Chat" to section "1" and I fill the form with: | Name of this chat room | Chat room | | Description | Chat description | - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" @javascript Scenario: Forced group mode using separate groups @@ -29,10 +29,7 @@ Feature: Force group mode in a course | Force group mode | Yes | When I press "Save changes" Then "//a/child::img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists - And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should exists - And I click on "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" in the "li.activity.chat" "css_element" - And "//a/child::img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists - And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should exists + And "//img[contains(@alt, 'Separate groups (forced mode)')]" "xpath_element" should not exists @javascript Scenario: Forced group mode using visible groups @@ -41,10 +38,7 @@ Feature: Force group mode in a course | Force group mode | Yes | And I press "Save changes" Then "//a/child::img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists - And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should exists - And I click on "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" in the "li.activity.chat" "css_element" - And "//a/child::img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists - And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should exists + And "//img[contains(@alt, 'Visible groups (forced mode)')]" "xpath_element" should not exists @javascript Scenario: Forced group mode without groups @@ -53,8 +47,5 @@ Feature: Force group mode in a course | Force group mode | Yes | And I press "Save changes" Then "//a/child::img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists - And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should exists - And I click on "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" in the "li.activity.chat" "css_element" - And "//a/child::img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists - And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should exists + And "//img[contains(@alt, 'No groups (forced mode)')]" "xpath_element" should not exists diff --git a/course/tests/behat/move_activities.feature b/course/tests/behat/move_activities.feature index 6f2e56e5070..4ebee75b625 100644 --- a/course/tests/behat/move_activities.feature +++ b/course/tests/behat/move_activities.feature @@ -33,7 +33,7 @@ Feature: Activities can be moved between sections And I should not see "Test forum name" in the "#section-1" "css_element" Scenario: Move activities in the course home with Javascript disabled using paged mode - Given I follow "Edit settings" + Given I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Course layout | Show one section per page | And I press "Save changes" @@ -42,7 +42,7 @@ Feature: Activities can be moved between sections And I should not see "Test forum name" in the "#section-1" "css_element" Scenario: Move activities in a course section with Javascript disabled using paged mode - Given I follow "Edit settings" + Given I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Course layout | Show one section per page | And I press "Save changes" diff --git a/course/tests/behat/move_sections.feature b/course/tests/behat/move_sections.feature index 9ac3ecff036..00574b06986 100644 --- a/course/tests/behat/move_sections.feature +++ b/course/tests/behat/move_sections.feature @@ -28,7 +28,7 @@ Feature: Sections can be moved And I should see "Test forum name" in the "#section-1" "css_element" Scenario: Move up and down a section with Javascript disabled in the course home of a course using paged mode - Given I follow "Edit settings" + Given I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Course layout | Show one section per page | And I press "Save changes" @@ -41,7 +41,7 @@ Feature: Sections can be moved And I should see "Test forum name" in the "#section-1" "css_element" Scenario: Sections can not be moved with Javascript disabled in a section page of a course using paged mode - Given I follow "Edit settings" + Given I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Course layout | Show one section per page | And I press "Save changes" diff --git a/course/tests/behat/rename_roles.feature b/course/tests/behat/rename_roles.feature index d543da0a6ed..7e32a9edbb4 100644 --- a/course/tests/behat/rename_roles.feature +++ b/course/tests/behat/rename_roles.feature @@ -21,7 +21,7 @@ Feature: Rename roles within a course | student1 | C1 | student | And I log in as "teacher1" And I follow "Course 1" - When I follow "Edit settings" + When I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Your word for 'Non-editing teacher' | Tutor | | Your word for 'Student' | Learner | @@ -33,7 +33,7 @@ Feature: Rename roles within a course And the "roleid" select box should contain "Tutor" And the "roleid" select box should contain "Learner" And the "roleid" select box should not contain "Student" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Your word for 'Non-editing teacher' | | | Your word for 'Student' | | diff --git a/enrol/guest/tests/behat/guest_access.feature b/enrol/guest/tests/behat/guest_access.feature index bb0e13bc39d..24ac17f570c 100644 --- a/enrol/guest/tests/behat/guest_access.feature +++ b/enrol/guest/tests/behat/guest_access.feature @@ -21,7 +21,7 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al And I add a "Forum" to section "1" and I fill the form with: | Forum name | Test forum name | | Description | Test forum description | - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" @javascript Scenario: Allow guest access without password diff --git a/mod/assign/tests/behat/group_submission.feature b/mod/assign/tests/behat/group_submission.feature index 665ea12cc9e..62675ce3232 100644 --- a/mod/assign/tests/behat/group_submission.feature +++ b/mod/assign/tests/behat/group_submission.feature @@ -44,7 +44,7 @@ Feature: Group assignment submissions And I fill the moodle form with: | Group mode | Separate groups | And I press "Save and return to course" - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Group mode | Separate groups | And I press "Save changes" diff --git a/mod/forum/tests/behat/completion_condition_number_discussions.feature b/mod/forum/tests/behat/completion_condition_number_discussions.feature index 06729835189..94e3daa8057 100644 --- a/mod/forum/tests/behat/completion_condition_number_discussions.feature +++ b/mod/forum/tests/behat/completion_condition_number_discussions.feature @@ -25,7 +25,7 @@ Feature: Set a certain number of discussions as a completion condition for a for And I log in as "teacher1" And I follow "Course 1" And I turn editing mode on - And I follow "Edit settings" + And I click on "Edit settings" "link" in the "Administration" "block" And I fill the moodle form with: | Enable completion tracking | Yes | And I press "Save changes"