From e00da7e8848eb416bb60d9aa1bcb651e203c1ee0 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Sun, 10 Oct 2021 23:23:09 +0800 Subject: [PATCH] MDL-72287 behat: Update behat tests --- badges/tests/behat/award_badge.feature | 21 ++++++++++++------- badges/tests/behat/award_badge_groups.feature | 3 ++- course/tests/behat/course_controls.feature | 20 +++++++++--------- course/tests/behat/edit_settings.feature | 4 ++++ mod/forum/tests/behat/advanced_search.feature | 18 ++++++++-------- .../tests/behat/contentbank_link.feature | 4 +++- report/log/tests/behat/user_log.feature | 2 +- 7 files changed, 43 insertions(+), 29 deletions(-) diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature index 6394a5f825d..e780e812982 100644 --- a/badges/tests/behat/award_badge.feature +++ b/badges/tests/behat/award_badge.feature @@ -60,14 +60,16 @@ Feature: Award badges And I press "Save" And I press "Enable access" And I press "Continue" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 1" And I follow "Recipients (0)" And I press "Award badge" # Award course badge 1 to student 1. And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)" When I press "Award badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 1" And I follow "Recipients (1)" Then I should see "Recipients (1)" @@ -185,7 +187,8 @@ Feature: Award badges And I press "Award badge" And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)" When I press "Award badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge" Then I should see "Recipients (2)" And I log out @@ -286,7 +289,8 @@ Feature: Award badges # Award course badge 1 to student 1. And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)" When I press "Award badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 1" And I follow "Recipients (1)" Then I should see "Recipients (1)" @@ -311,7 +315,8 @@ Feature: Award badges # Award course badge 2 to student 2. And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)" When I press "Award badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge 2" And I follow "Recipients (1)" Then I should see "Recipients (1)" @@ -352,7 +357,8 @@ Feature: Award badges And I press "Award badge" And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)" When I press "Award badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge" Then I should see "Recipients (2)" And I follow "Recipients (2)" @@ -361,6 +367,7 @@ Feature: Award badges And I press "Revoke badge" And I set the field "existingrecipients[]" to "Student 1 (student1@example.com)" When I press "Revoke badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge" Then I should see "Recipients (0)" diff --git a/badges/tests/behat/award_badge_groups.feature b/badges/tests/behat/award_badge_groups.feature index a8db60274f7..98dab1ec6f5 100644 --- a/badges/tests/behat/award_badge_groups.feature +++ b/badges/tests/behat/award_badge_groups.feature @@ -69,7 +69,8 @@ Feature: Award badges with separate groups # Non-editing teacher can award the badge And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)" And I press "Award badge" - And I follow "Manage badges" + And I am on "Course 1" course homepage + And I navigate to "Badges > Manage badges" in current page administration And I follow "Course Badge" And I should see "Recipients (1)" And I log out diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature index 835dd275392..625eca8a8cd 100644 --- a/course/tests/behat/course_controls.feature +++ b/course/tests/behat/course_controls.feature @@ -28,7 +28,7 @@ Feature: Course activity controls works as expected | teacher1 | C1 | editingteacher | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - When I follow the breadcrumb + When I click on "link" in the "region-main" "region" And I add the "Recent activity" block And I open the action menu in "Recent activity" "block" And I click on "Delete Recent activity block" "link" @@ -76,12 +76,12 @@ Feature: Course activity controls works as expected Examples: | courseformat | coursedisplay | targetpage | should_see_other_sections | should_see_other_sections_following_block_sections_links | belowpage | - | topics | 0 | "C1" | should | should | "Topic 2" | + | topics | 0 | "General" | should | should | "Topic 2" | | topics | 1 | "Topic 1" | should not | should not | "Topic 2" | - | topics | 1 | "C1" | should | should not | "Topic 2" | - | weeks | 0 | "C1" | should | should | "8 January - 14 January" | + | topics | 1 | "General" | should | should not | "Topic 2" | + | weeks | 0 | "General" | should | should | "8 January - 14 January" | | weeks | 1 | "1 January - 7 January" | should not | should not | "8 January - 14 January" | - | weeks | 1 | "C1" | should | should not | "8 January - 14 January" | + | weeks | 1 | "General" | should | should not | "8 January - 14 January" | Scenario Outline: General activities course controls using topics and weeks formats, and paged mode and not paged mode works as expected Given the following "users" exist: @@ -99,7 +99,7 @@ Feature: Course activity controls works as expected | forum | Test forum name 2 | Test forum description 2 | C1 | 0002 | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on - When I follow the breadcrumb + When I click on "link" in the "region-main" "region" And I add the "Recent activity" block And I open the action menu in "Recent activity" "block" And I click on "Delete Recent activity block" "link" @@ -135,9 +135,9 @@ Feature: Course activity controls works as expected Examples: | courseformat | coursedisplay | targetpage | should_see_other_sections | should_see_other_sections_following_block_sections_links | belowpage | - | topics | 0 | "C1" | should | should | "Topic 2" | + | topics | 0 | "General" | should | should | "Topic 2" | | topics | 1 | "Topic 1" | should not | should not | "Topic 2" | - | topics | 1 | "C1" | should | should not | "Topic 2" | - | weeks | 0 | "C1" | should | should | "8 January - 14 January" | + | topics | 1 | "General" | should | should not | "Topic 2" | + | weeks | 0 | "General" | should | should | "8 January - 14 January" | | weeks | 1 | "1 January - 7 January" | should not | should not | "8 January - 14 January" | - | weeks | 1 | "C1" | should | should not | "8 January - 14 January" | + | weeks | 1 | "General" | should | should not | "8 January - 14 January" | diff --git a/course/tests/behat/edit_settings.feature b/course/tests/behat/edit_settings.feature index d6afba611fd..e6ba53eada9 100644 --- a/course/tests/behat/edit_settings.feature +++ b/course/tests/behat/edit_settings.feature @@ -15,6 +15,8 @@ Feature: Edit course settings And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | + And the following config values are set as admin: + | courselistshortnames | 1 | And I log in as "teacher1" And I am on "Course 1" course homepage When I navigate to "Settings" in current page administration @@ -23,10 +25,12 @@ Feature: Edit course settings | Course short name | Edited course shortname | | Course summary | Edited course summary | And I press "Save and display" + And I am on site homepage Then I should not see "Course 1" And I should not see "C1" And I should see "Edited course fullname" And I should see "Edited course shortname" + And I am on "Edited course fullname" course homepage And I navigate to "Settings" in current page administration And the field "Course full name" matches value "Edited course fullname" And the field "Course short name" matches value "Edited course shortname" diff --git a/mod/forum/tests/behat/advanced_search.feature b/mod/forum/tests/behat/advanced_search.feature index b6ce9edd329..77c003e5c88 100644 --- a/mod/forum/tests/behat/advanced_search.feature +++ b/mod/forum/tests/behat/advanced_search.feature @@ -40,7 +40,7 @@ Feature: The forum search allows users to perform advanced searches for forum po Scenario: Perform an advanced search using any term Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "words" to "subject" When I press "Search" Then I should see "My subject" @@ -49,7 +49,7 @@ Feature: The forum search allows users to perform advanced searches for forum po Scenario: Perform an advanced search avoiding words Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "words" to "My" And I set the field "notwords" to "subjective" When I press "Search" @@ -62,7 +62,7 @@ Feature: The forum search allows users to perform advanced searches for forum po | postgres | And I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "fullwords" to "subject" When I press "Search" Then I should see "My subject" @@ -71,7 +71,7 @@ Feature: The forum search allows users to perform advanced searches for forum po Scenario: Perform an advanced search matching the subject Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "subject" to "subjective" When I press "Search" Then I should not see "My message" @@ -86,7 +86,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I log out When I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "user" to "TWO" And I press "Search" Then I should see "Teacher TWO" @@ -95,7 +95,7 @@ Feature: The forum search allows users to perform advanced searches for forum po Scenario: Perform an advanced search with multiple words Given I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "subject" to "your subjective" When I press "Search" Then I should not see "My message" @@ -112,7 +112,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I log out And I am on the "Announcements" "forum activity" page logged in as student1 And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "Is tagged with" to "SearchedTag" When I press "Search" Then I should see "My subject" @@ -124,7 +124,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I click on "Your subjective" action menu And I follow "Star this discussion" And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "starredonly" to "1" When I press "Search" Then I should not see "My message" @@ -136,7 +136,7 @@ Feature: The forum search allows users to perform advanced searches for forum po And I click on "Your subjective" action menu And I follow "Star this discussion" And I press "Search" - And I should see "Advanced search" + And I should see "Please enter search terms into one or more of the following fields" And I set the field "words" to "message" And I set the field "starredonly" to "1" When I press "Search" diff --git a/mod/h5pactivity/tests/behat/contentbank_link.feature b/mod/h5pactivity/tests/behat/contentbank_link.feature index d0c53c208cc..3b48a2ec3e6 100644 --- a/mod/h5pactivity/tests/behat/contentbank_link.feature +++ b/mod/h5pactivity/tests/behat/contentbank_link.feature @@ -25,7 +25,9 @@ Feature: Content bank link in the activity settings form And I add a "H5P" to section "1" Then I should see "Use the content bank (opens in new window) to manage your H5P files" And I click on "content bank (opens in new window)" "link" in the "General" "fieldset" - And I should see "C1" in the "page-navbar" "region" + And I switch to the browser tab opened by the app + And I should see "Content bank" in the "page-header" "region" + And I should see "filltheblanks.h5p" in the "page-content" "region" And I close all opened windows @javascript diff --git a/report/log/tests/behat/user_log.feature b/report/log/tests/behat/user_log.feature index b499be9a4ba..7a62b3df50d 100644 --- a/report/log/tests/behat/user_log.feature +++ b/report/log/tests/behat/user_log.feature @@ -44,7 +44,7 @@ Feature: User can view activity log. And I follow "Ann, Jill, Grainne, Beauchamp" When I follow "Today's logs" And I should see "Assignment: Test assignment name" - And I follow "Ann, Jill, Grainne, Beauchamp" + And I click on "Back" "button" And I follow "All logs" Then I should see "Assignment: Test assignment name"