diff --git a/tests/behat/attendance_mod.feature b/tests/behat/attendance_mod.feature index 28fd3b6..e5625c4 100644 --- a/tests/behat/attendance_mod.feature +++ b/tests/behat/attendance_mod.feature @@ -37,66 +37,66 @@ Feature: Teachers and Students can record session attendance And I should see "Attendance" And I log out - Scenario: Students can mark their own attendance - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Add" - And I set the field "Allow students to record own attendance" to "1" - And I set the following fields to these values: - | id_sestime_starthour | 22 | - | id_sestime_endhour | 23 | - And I click on "id_submitbutton" "button" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Submit attendance" - And I set the field "Present" to "1" - And I press "Save changes" - And I should see "Self-recorded" - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I expand "Reports" node - And I follow "Logs" - And I click on "Get these logs" "button" - Then "Attendance taken by student" "link" should exist + Scenario: Students can mark their own attendance + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Add" + And I set the field "Allow students to record own attendance" to "1" + And I set the following fields to these values: + | id_sestime_starthour | 22 | + | id_sestime_endhour | 23 | + And I click on "id_submitbutton" "button" + And I log out + And I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Submit attendance" + And I set the field "Present" to "1" + And I press "Save changes" + And I should see "Self-recorded" + And I log out + When I log in as "teacher1" + And I am on "Course 1" course homepage + And I expand "Reports" node + And I follow "Logs" + And I click on "Get these logs" "button" + Then "Attendance taken by student" "link" should exist - Scenario: Teachers can view low grade report and send a message - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Add" - And I set the following fields to these values: - | id_sestime_starthour | 01 | - | id_sestime_endhour | 02 | - And I click on "id_submitbutton" "button" - And I follow "Report" - And I follow "Low grade" - And I set the field "cb_selector" to "1" - And I click on "Send a message" "button" - And I should see "Message body" - And I should see "student1@asd.com" - And I follow "Course 1" - And I expand "Reports" node - And I follow "Logs" - And I click on "Get these logs" "button" - Then "Attendance report viewed" "link" should exist + Scenario: Teachers can view low grade report and send a message + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Add" + And I set the following fields to these values: + | id_sestime_starthour | 01 | + | id_sestime_endhour | 02 | + And I click on "id_submitbutton" "button" + And I follow "Report" + And I follow "Low grade" + And I set the field "cb_selector" to "1" + And I click on "Send a message" "button" + And I should see "Message body" + And I should see "student1@asd.com" + And I follow "Course 1" + And I expand "Reports" node + And I follow "Logs" + And I click on "Get these logs" "button" + Then "Attendance report viewed" "link" should exist - Scenario: Export report includes id number, department and institution - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Add" - And I set the following fields to these values: - | id_sestime_starthour | 01 | - | id_sestime_endhour | 02 | - And I click on "id_submitbutton" "button" - And I follow "Export" - Then the field "id_ident_idnumber" matches value "" - And the field "id_ident_institution" matches value "" - And the field "id_ident_department" matches value "" + Scenario: Export report includes id number, department and institution + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Add" + And I set the following fields to these values: + | id_sestime_starthour | 01 | + | id_sestime_endhour | 02 | + And I click on "id_submitbutton" "button" + And I follow "Export" + Then the field "id_ident_idnumber" matches value "" + And the field "id_ident_institution" matches value "" + And the field "id_ident_department" matches value "" # Removed dependency on behat_download to allow automated Travis CI tests to pass. - # It would be good to add these back at some point. + # It would be good to add these back at some point. \ No newline at end of file diff --git a/tests/behat/preferences.feature b/tests/behat/preferences.feature index d49ff05..169db77 100644 --- a/tests/behat/preferences.feature +++ b/tests/behat/preferences.feature @@ -24,33 +24,33 @@ Feature: Teachers can't change status variables to have empty acronyms or descri And I follow "Attendancepreftest" And I follow "Status set" - @javascript - Scenario: Teachers can add status variables - # Set the second status acronym to be empty - Given I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[2]/input" to "" - # Set the second status description to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/input" to "" - # Set the second status grade to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[4]/input" to "" - When I click on "Update" "button" in the "#preferencesform" "css_element" - Then I should see "Empty acronyms are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[2]/td[2]/p" "xpath_element" - And I should see "Empty descriptions are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/p" "xpath_element" - And I click on "Update" "button" in the "#preferencesform" "css_element" + @javascript + Scenario: Teachers can add status variables + # Set the second status acronym to be empty + Given I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[2]/input" to "" + # Set the second status description to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/input" to "" + # Set the second status grade to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[4]/input" to "" + When I click on "Update" "button" in the "#preferencesform" "css_element" + Then I should see "Empty acronyms are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[2]/td[2]/p" "xpath_element" + And I should see "Empty descriptions are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/p" "xpath_element" + And I click on "Update" "button" in the "#preferencesform" "css_element" - # Set the first status acronym to be empty - Given I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[2]/input" to "" - # Set the first status description to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[3]/input" to "" - # Set the first status grade to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[4]/input" to "" - # Set the third status acronym to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[2]/input" to "" - # Set the third status description to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[3]/input" to "" - # Set the third status grade to be empty - And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[4]/input" to "" - When I click on "Update" "button" in the "#preferencesform" "css_element" - Then I should see "Empty acronyms are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[1]/td[2]/p" "xpath_element" - And I should see "Empty descriptions are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[1]/td[3]/p" "xpath_element" - And I should see "Empty acronyms are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[3]/td[2]/p" "xpath_element" - And I should see "Empty descriptions are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[3]/td[3]/p" "xpath_element" \ No newline at end of file + # Set the first status acronym to be empty + Given I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[2]/input" to "" + # Set the first status description to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[3]/input" to "" + # Set the first status grade to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[1]/td[4]/input" to "" + # Set the third status acronym to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[2]/input" to "" + # Set the third status description to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[3]/input" to "" + # Set the third status grade to be empty + And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[4]/input" to "" + When I click on "Update" "button" in the "#preferencesform" "css_element" + Then I should see "Empty acronyms are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[1]/td[2]/p" "xpath_element" + And I should see "Empty descriptions are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[1]/td[3]/p" "xpath_element" + And I should see "Empty acronyms are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[3]/td[2]/p" "xpath_element" + And I should see "Empty descriptions are not allowed" in the "//*[@id='preferencesform']/table/tbody/tr[3]/td[3]/p" "xpath_element" \ No newline at end of file diff --git a/tests/behat/report.feature b/tests/behat/report.feature index 204470e..a7f5ec3 100644 --- a/tests/behat/report.feature +++ b/tests/behat/report.feature @@ -29,211 +29,211 @@ Feature: Visiting reports And I click on "id_submitbutton" "button" And I log out - Scenario: Teacher takes attendance - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Edit settings" - Then I set the following fields to these values: - | id_grade_modgrade_type | Point | - | id_grade_modgrade_point | 50 | - And I press "Save and display" - - When I follow "Report" - Then "0 / 0" "text" should exist in the "Student 1" "table_row" - And "0.0%" "text" should exist in the "Student 1" "table_row" - - When I follow "Grades" in the user menu - And I follow "Course 1" - And "-" "text" should exist in the "Student 1" "table_row" - - When I follow "Attendance" - Then I click on "Take attendance" "link" in the "1am - 2am" "table_row" - # Late - And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Report" - Then "1 / 2" "text" should exist in the "Student 1" "table_row" - And "50.0%" "text" should exist in the "Student 1" "table_row" - - When I follow "Grades" in the user menu - And I follow "Course 1" - And "25.00" "text" should exist in the "Student 1" "table_row" - - And I log out - - Scenario: Teacher changes the maximum points in the attendance settings - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Edit settings" - Then I set the following fields to these values: - | id_grade_modgrade_type | Point | - | id_grade_modgrade_point | 50 | - And I press "Save and display" - - When I follow "Attendance" - Then I click on "Take attendance" "link" in the "1am - 2am" "table_row" - # Excused - And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Attendance" - And I follow "Edit settings" - Then I set the following fields to these values: - | id_grade_modgrade_type | Point | - | id_grade_modgrade_point | 70 | - And I press "Save and display" - - When I follow "Report" - Then "1 / 2" "text" should exist in the "Student 1" "table_row" - And "50.0%" "text" should exist in the "Student 1" "table_row" - - When I follow "Grades" in the user menu - And I follow "Course 1" - Then "35.00" "text" should exist in the "Student 1" "table_row" - And I log out - - Scenario: Teacher take attendance of group session - Given the following "groups" exist: - | course | name | idnumber | - | C1 | Group1 | Group1 | - And the following "group members" exist: - | group | user | - | Group1 | student1 | - - When I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Edit settings" - And I set the following fields to these values: - | id_grade_modgrade_type | Point | - | id_grade_modgrade_point | 50 | - | id_groupmode | Visible groups | - And I press "Save and display" - - When I follow "Attendance" - Then I click on "Take attendance" "link" in the "1am - 2am" "table_row" - # Excused - And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Add session" - And I set the following fields to these values: - | id_sestime_starthour | 03 | - | id_sestime_endhour | 04 | - | id_sessiontype_1 | 1 | - | id_groups | Group1 | - And I click on "id_submitbutton" "button" - Then I should see "3am - 4am" - And "Group: Group1" "text" should exist in the "3am - 4am" "table_row" - - When I click on "Take attendance" "link" in the "3am - 4am" "table_row" - # Present - And I click on "td.cell.c3 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Report" - Then "3 / 4" "text" should exist in the "Student 1" "table_row" - And "75.0%" "text" should exist in the "Student 1" "table_row" - - When I follow "Grades" in the user menu - And I follow "Course 1" - Then "37.50" "text" should exist in the "Student 1" "table_row" - - And I log out - - Scenario: Teacher visit summary report - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Edit settings" - And I set the following fields to these values: - | id_grade_modgrade_type | Point | - | id_grade_modgrade_point | 50 | - And I press "Save and display" - - When I click on "Take attendance" "link" in the "1am - 2am" "table_row" - # Late - And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Add session" - And I set the following fields to these values: - | id_sestime_starthour | 03 | - | id_sestime_endhour | 04 | - And I click on "id_submitbutton" "button" - Then I should see "3am - 4am" - - When I click on "Take attendance" "link" in the "3am - 4am" "table_row" - # Present - And I click on "td.cell.c3 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Add session" - And I set the following fields to these values: - | id_sestime_starthour | 05 | - | id_sestime_endhour | 06 | - And I click on "id_submitbutton" "button" - Then I should see "5am - 6am" - - When I follow "Report" - And I click on "Summary" "link" in the "All" "table_row" - - Then "3 / 6" "text" should exist in the "Student 1" "table_row" - And "50.0%" "text" should exist in the "Student 1" "table_row" - And "5 / 6" "text" should exist in the "Student 1" "table_row" - And "83.3%" "text" should exist in the "Student 1" "table_row" - - And I log out - - Scenario: Student visit user report - Given I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "Edit settings" - Then I set the following fields to these values: - | id_grade_modgrade_type | Point | - | id_grade_modgrade_point | 50 | - And I press "Save and display" - - When I click on "Take attendance" "link" in the "1am - 2am" "table_row" - # Late - And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Add session" - And I set the following fields to these values: - | id_sestime_starthour | 03 | - | id_sestime_endhour | 04 | - And I click on "id_submitbutton" "button" - - When I click on "Take attendance" "link" in the "3am - 4am" "table_row" - # Present - And I click on "td.cell.c3 input" "css_element" in the "Student 1" "table_row" - And I press "Save attendance" - - When I follow "Add session" - And I set the following fields to these values: - | id_sestime_starthour | 05 | - | id_sestime_endhour | 06 | - And I click on "id_submitbutton" "button" - - Then I log out - - When I log in as "student1" - And I am on "Course 1" course homepage - And I follow "Attendance" - And I follow "All" - - Then "2" "text" should exist in the "Taken sessions" "table_row" - And "3 / 4" "text" should exist in the "Points over taken sessions:" "table_row" - And "75.0%" "text" should exist in the "Percentage over taken sessions:" "table_row" - And "3" "text" should exist in the "Total number of sessions:" "table_row" - And "3 / 6" "text" should exist in the "Points over all sessions:" "table_row" - And "50.0%" "text" should exist in the "Percentage over all sessions:" "table_row" - And "5 / 6" "text" should exist in the "Maximum possible points:" "table_row" - And "83.3%" "text" should exist in the "Maximum possible percentage:" "table_row" - - And I log out \ No newline at end of file + Scenario: Teacher takes attendance + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Edit settings" + Then I set the following fields to these values: + | id_grade_modgrade_type | Point | + | id_grade_modgrade_point | 50 | + And I press "Save and display" + + When I follow "Report" + Then "0 / 0" "text" should exist in the "Student 1" "table_row" + And "0.0%" "text" should exist in the "Student 1" "table_row" + + When I follow "Grades" in the user menu + And I follow "Course 1" + And "-" "text" should exist in the "Student 1" "table_row" + + When I follow "Attendance" + Then I click on "Take attendance" "link" in the "1am - 2am" "table_row" + # Late + And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Report" + Then "1 / 2" "text" should exist in the "Student 1" "table_row" + And "50.0%" "text" should exist in the "Student 1" "table_row" + + When I follow "Grades" in the user menu + And I follow "Course 1" + And "25.00" "text" should exist in the "Student 1" "table_row" + + And I log out + + Scenario: Teacher changes the maximum points in the attendance settings + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Edit settings" + Then I set the following fields to these values: + | id_grade_modgrade_type | Point | + | id_grade_modgrade_point | 50 | + And I press "Save and display" + + When I follow "Attendance" + Then I click on "Take attendance" "link" in the "1am - 2am" "table_row" + # Excused + And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Attendance" + And I follow "Edit settings" + Then I set the following fields to these values: + | id_grade_modgrade_type | Point | + | id_grade_modgrade_point | 70 | + And I press "Save and display" + + When I follow "Report" + Then "1 / 2" "text" should exist in the "Student 1" "table_row" + And "50.0%" "text" should exist in the "Student 1" "table_row" + + When I follow "Grades" in the user menu + And I follow "Course 1" + Then "35.00" "text" should exist in the "Student 1" "table_row" + And I log out + + Scenario: Teacher take attendance of group session + Given the following "groups" exist: + | course | name | idnumber | + | C1 | Group1 | Group1 | + And the following "group members" exist: + | group | user | + | Group1 | student1 | + + When I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Edit settings" + And I set the following fields to these values: + | id_grade_modgrade_type | Point | + | id_grade_modgrade_point | 50 | + | id_groupmode | Visible groups | + And I press "Save and display" + + When I follow "Attendance" + Then I click on "Take attendance" "link" in the "1am - 2am" "table_row" + # Excused + And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Add session" + And I set the following fields to these values: + | id_sestime_starthour | 03 | + | id_sestime_endhour | 04 | + | id_sessiontype_1 | 1 | + | id_groups | Group1 | + And I click on "id_submitbutton" "button" + Then I should see "3am - 4am" + And "Group: Group1" "text" should exist in the "3am - 4am" "table_row" + + When I click on "Take attendance" "link" in the "3am - 4am" "table_row" + # Present + And I click on "td.cell.c3 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Report" + Then "3 / 4" "text" should exist in the "Student 1" "table_row" + And "75.0%" "text" should exist in the "Student 1" "table_row" + + When I follow "Grades" in the user menu + And I follow "Course 1" + Then "37.50" "text" should exist in the "Student 1" "table_row" + + And I log out + + Scenario: Teacher visit summary report + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Edit settings" + And I set the following fields to these values: + | id_grade_modgrade_type | Point | + | id_grade_modgrade_point | 50 | + And I press "Save and display" + + When I click on "Take attendance" "link" in the "1am - 2am" "table_row" + # Late + And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Add session" + And I set the following fields to these values: + | id_sestime_starthour | 03 | + | id_sestime_endhour | 04 | + And I click on "id_submitbutton" "button" + Then I should see "3am - 4am" + + When I click on "Take attendance" "link" in the "3am - 4am" "table_row" + # Present + And I click on "td.cell.c3 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Add session" + And I set the following fields to these values: + | id_sestime_starthour | 05 | + | id_sestime_endhour | 06 | + And I click on "id_submitbutton" "button" + Then I should see "5am - 6am" + + When I follow "Report" + And I click on "Summary" "link" in the "All" "table_row" + + Then "3 / 6" "text" should exist in the "Student 1" "table_row" + And "50.0%" "text" should exist in the "Student 1" "table_row" + And "5 / 6" "text" should exist in the "Student 1" "table_row" + And "83.3%" "text" should exist in the "Student 1" "table_row" + + And I log out + + Scenario: Student visit user report + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "Edit settings" + Then I set the following fields to these values: + | id_grade_modgrade_type | Point | + | id_grade_modgrade_point | 50 | + And I press "Save and display" + + When I click on "Take attendance" "link" in the "1am - 2am" "table_row" + # Late + And I click on "td.cell.c4 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Add session" + And I set the following fields to these values: + | id_sestime_starthour | 03 | + | id_sestime_endhour | 04 | + And I click on "id_submitbutton" "button" + + When I click on "Take attendance" "link" in the "3am - 4am" "table_row" + # Present + And I click on "td.cell.c3 input" "css_element" in the "Student 1" "table_row" + And I press "Save attendance" + + When I follow "Add session" + And I set the following fields to these values: + | id_sestime_starthour | 05 | + | id_sestime_endhour | 06 | + And I click on "id_submitbutton" "button" + + Then I log out + + When I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Attendance" + And I follow "All" + + Then "2" "text" should exist in the "Taken sessions" "table_row" + And "3 / 4" "text" should exist in the "Points over taken sessions:" "table_row" + And "75.0%" "text" should exist in the "Percentage over taken sessions:" "table_row" + And "3" "text" should exist in the "Total number of sessions:" "table_row" + And "3 / 6" "text" should exist in the "Points over all sessions:" "table_row" + And "50.0%" "text" should exist in the "Percentage over all sessions:" "table_row" + And "5 / 6" "text" should exist in the "Maximum possible points:" "table_row" + And "83.3%" "text" should exist in the "Maximum possible percentage:" "table_row" + + And I log out \ No newline at end of file