From 8d3724c91ebb51ad288112667e077f4d2fcd9656 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Fri, 4 Nov 2022 02:16:40 +0800 Subject: [PATCH] MDL-75837 behat: Update behat tests --- .../tests/behat/gradeitemsearch.feature | 10 ++--- .../tests/behat/reportswitching.feature | 13 +++--- .../singleview/tests/behat/singleview.feature | 4 +- .../singleview/tests/behat/usersearch.feature | 14 +++---- .../user/tests/behat/groupsearch.feature | 42 +++++++------------ .../user/tests/behat/usersearch.feature | 14 +++---- 6 files changed, 43 insertions(+), 54 deletions(-) diff --git a/grade/report/singleview/tests/behat/gradeitemsearch.feature b/grade/report/singleview/tests/behat/gradeitemsearch.feature index 6fd0686a6f7..03c5a99edb2 100644 --- a/grade/report/singleview/tests/behat/gradeitemsearch.feature +++ b/grade/report/singleview/tests/behat/gradeitemsearch.feature @@ -22,10 +22,10 @@ Feature: Given we have opted to search for a grade item, Lets find and search th Scenario: A teacher can search for and find a grade item to view Given I navigate to "View > Single view" in the course gradebook And I click on "Grade items" "link" in the ".page-toggler" "css_element" - When I click on ".gradewidget" "css_element" - Then I confirm "Test assignment one" in "Select a grade item" search within the gradebook widget exists - And I confirm "Test assignment two" in "Select a grade item" search within the gradebook widget exists + When I click on ".search-widget[data-searchtype='grade']" "css_element" + Then I confirm "Test assignment one" in "grade" search within the gradebook widget exists + And I confirm "Test assignment two" in "grade" search within the gradebook widget exists And I set the field "searchinput" to "two" And I wait "1" seconds - And I confirm "Test assignment two" in "Select a grade item" search within the gradebook widget exists - And I confirm "Test assignment one" in "Select a grade item" search within the gradebook widget does not exist + And I confirm "Test assignment two" in "grade" search within the gradebook widget exists + And I confirm "Test assignment one" in "grade" search within the gradebook widget does not exist diff --git a/grade/report/singleview/tests/behat/reportswitching.feature b/grade/report/singleview/tests/behat/reportswitching.feature index 41b872be791..feb106d8e45 100644 --- a/grade/report/singleview/tests/behat/reportswitching.feature +++ b/grade/report/singleview/tests/behat/reportswitching.feature @@ -21,9 +21,10 @@ Feature: Given we land on the index page, select what type of report we wish to Scenario: I switch between the two report types within singleview Given I navigate to "View > Single view" in the course gradebook And I click on "Grade items" "link" in the ".page-toggler" "css_element" - When I click on ".gradewidget" "css_element" - Then I wait until "Select a grade item" "dialogue" exists - And I click on "Close" "button" in the "Select a grade item" "dialogue" - And I click on "Users" "link" in the ".page-toggler" "css_element" - And I click on ".userwidget" "css_element" - And I wait until "Select a user" "dialogue" exists + And ".search-widget[data-searchtype='user']" "css_element" should not exist + And ".search-widget[data-searchtype='grade']" "css_element" should exist + And I confirm "assign" in "grade" search within the gradebook widget exists + When I click on "Users" "link" in the ".page-toggler" "css_element" + Then ".search-widget[data-searchtype='grade']" "css_element" should not exist + And ".search-widget[data-searchtype='user']" "css_element" should exist + And I confirm "student1" in "user" search within the gradebook widget exists diff --git a/grade/report/singleview/tests/behat/singleview.feature b/grade/report/singleview/tests/behat/singleview.feature index 9e9d9f55d21..aa2f53fad33 100644 --- a/grade/report/singleview/tests/behat/singleview.feature +++ b/grade/report/singleview/tests/behat/singleview.feature @@ -59,7 +59,7 @@ Feature: We can use Single view Scenario: I can update grades, add feedback and exclude grades. Given I navigate to "View > Single view" in the course gradebook - And I click on "Users" "link" + And I click on "Users" "link" in the ".page-toggler" "css_element" And I click on "Student" in the "user" search widget And I turn editing mode on And I set the field "Override for Test assignment one" to "1" @@ -99,7 +99,7 @@ Feature: We can use Single view And I log in as "teacher2" And I am on "Course 1" course homepage Given I navigate to "View > Single view" in the course gradebook - And I click on "Users" "link" + And I click on "Users" "link" in the ".page-toggler" "css_element" And I click on "Student" in the "user" search widget And I turn editing mode on And the "Exclude for Test assignment one" "checkbox" should be disabled diff --git a/grade/report/singleview/tests/behat/usersearch.feature b/grade/report/singleview/tests/behat/usersearch.feature index a79d3f38973..5108f23ef02 100644 --- a/grade/report/singleview/tests/behat/usersearch.feature +++ b/grade/report/singleview/tests/behat/usersearch.feature @@ -23,12 +23,12 @@ Feature: Within the singleview report, a teacher can search for users. Given I navigate to "View > Single view" in the course gradebook When I click on "Users" "link" in the ".page-toggler" "css_element" And I wait until the page is ready - And I click on ".userwidget" "css_element" - Then I confirm "Student 1" in "Select a user" search within the gradebook widget exists - And I confirm "Student 2" in "Select a user" search within the gradebook widget exists - And I confirm "Student 32" in "Select a user" search within the gradebook widget exists + And I click on ".search-widget[data-searchtype='user']" "css_element" + Then I confirm "Student 1" in "user" search within the gradebook widget exists + And I confirm "Student 2" in "user" search within the gradebook widget exists + And I confirm "Student 32" in "user" search within the gradebook widget exists And I set the field "searchinput" to "2" And I wait "1" seconds - And I confirm "Student 2" in "Select a user" search within the gradebook widget exists - And I confirm "Student 32" in "Select a user" search within the gradebook widget exists - And I confirm "Student 1" in "Select a user" search within the gradebook widget does not exist + And I confirm "Student 2" in "user" search within the gradebook widget exists + And I confirm "Student 32" in "user" search within the gradebook widget exists + And I confirm "Student 1" in "user" search within the gradebook widget does not exist diff --git a/grade/report/user/tests/behat/groupsearch.feature b/grade/report/user/tests/behat/groupsearch.feature index d594396862f..d8e3bf9b74f 100644 --- a/grade/report/user/tests/behat/groupsearch.feature +++ b/grade/report/user/tests/behat/groupsearch.feature @@ -28,50 +28,38 @@ Feature: Group searching functionality within the user report. Scenario: A teacher can see the 'group' search widget only when group mode is enabled in the course Given I navigate to "View > User report" in the course gradebook - And ".groupwidget" "css_element" should exist + And ".search-widget[data-searchtype='group']" "css_element" should exist And I am on "Course 1" course homepage And I navigate to "Settings" in current page administration And I set the following fields to these values: | id_groupmode | No groups | And I press "Save and display" When I navigate to "View > User report" in the course gradebook - Then ".groupwidget" "css_element" should not exist + Then ".search-widget[data-searchtype='group']" "css_element" should not exist Scenario: A teacher can search for and find a group to find a user in Given I navigate to "View > User report" in the course gradebook - And I click on ".groupwidget" "css_element" - And I wait until "Select a group" "dialogue" exists - And I should see "Tutor group" in the "Select a group" "dialogue" - And I should see "Marker group" in the "Select a group" "dialogue" + And I click on ".search-widget[data-searchtype='group']" "css_element" + And I confirm "Tutor group" in "group" search within the gradebook widget exists + And I confirm "Marker group" in "group" search within the gradebook widget exists When I set the field "searchinput" to "tutor" And I wait "1" seconds - Then I should see "Tutor group" in the "Select a group" "dialogue" - And I should not see "Marker group" in the "Select a group" "dialogue" + Then I confirm "Tutor group" in "group" search within the gradebook widget exists + And I confirm "Marker group" in "group" search within the gradebook widget does not exist Scenario: A teacher can only see the group members in the 'user' search widget after selecting a group option Given I navigate to "View > User report" in the course gradebook # Confirm that all users are initially displayed in the 'user' search widget. - And I click on ".userwidget" "css_element" - And I wait until "Select a user" "dialogue" exists - And I should see "Student 1" in the "Select a user" "dialogue" - And I should see "Student 2" in the "Select a user" "dialogue" - And I click on "Close" "button" in the "Select a user" "dialogue" + And I confirm "Student 1" in "user" search within the gradebook widget exists + And I confirm "Student 2" in "user" search within the gradebook widget exists # Select a particular group from the 'group' search widget. When I click on "Default group" in the "group" search widget # Confirm that only users which are members of the selected group are displayed in the 'user' search widget. - And I click on ".userwidget" "css_element" - And I wait until "Select a user" "dialogue" exists - Then I should see "Student 1" in the "Select a user" "dialogue" - And I should not see "Student 2" in the "Select a user" "dialogue" - And I click on "Close" "button" in the "Select a user" "dialogue" + And I confirm "Student 1" in "user" search within the gradebook widget exists + And I confirm "Student 2" in "user" search within the gradebook widget does not exist And I click on "Tutor group" in the "group" search widget - And I click on ".userwidget" "css_element" - And I wait until "Select a user" "dialogue" exists - And I should not see "Student 1" in the "Select a user" "dialogue" - And I should not see "Student 2" in the "Select a user" "dialogue" - And I click on "Close" "button" in the "Select a user" "dialogue" + And I confirm "Student 1" in "user" search within the gradebook widget does not exist + And I confirm "Student 2" in "user" search within the gradebook widget does not exist And I click on "All participants" in the "group" search widget - And I click on ".userwidget" "css_element" - And I wait until "Select a user" "dialogue" exists - And I should see "Student 1" in the "Select a user" "dialogue" - And I should see "Student 2" in the "Select a user" "dialogue" + And I confirm "Student 1" in "user" search within the gradebook widget exists + And I confirm "Student 2" in "user" search within the gradebook widget exists diff --git a/grade/report/user/tests/behat/usersearch.feature b/grade/report/user/tests/behat/usersearch.feature index 40d654abbe1..59d3a77940d 100644 --- a/grade/report/user/tests/behat/usersearch.feature +++ b/grade/report/user/tests/behat/usersearch.feature @@ -21,12 +21,12 @@ Feature: Within the User report, a teacher can search for users. Scenario: A teacher can search for and find a user to view Given I navigate to "View > User report" in the course gradebook - When I click on ".userwidget" "css_element" - Then I confirm "Student 1" in "Select a user" search within the gradebook widget exists - And I confirm "Student 2" in "Select a user" search within the gradebook widget exists - And I confirm "Student 32" in "Select a user" search within the gradebook widget exists + When I click on ".search-widget[data-searchtype='user']" "css_element" + Then I confirm "Student 1" in "user" search within the gradebook widget exists + And I confirm "Student 2" in "user" search within the gradebook widget exists + And I confirm "Student 32" in "user" search within the gradebook widget exists And I set the field "searchinput" to "2" And I wait "1" seconds - And I confirm "Student 2" in "Select a user" search within the gradebook widget exists - And I confirm "Student 32" in "Select a user" search within the gradebook widget exists - And I confirm "Student 1" in "Select a user" search within the gradebook widget does not exist + And I confirm "Student 2" in "user" search within the gradebook widget exists + And I confirm "Student 32" in "user" search within the gradebook widget exists + And I confirm "Student 1" in "user" search within the gradebook widget does not exist