MDL-70821 behat: Use new activity completion steps for Behat tests

Replace usages of completion Behat steps that check for the completion
checkboxes with the new activity completion Behat steps.
This commit is contained in:
Jun Pataleta 2021-03-26 17:50:41 +08:00
parent 300b72f81a
commit 1c15796a75
14 changed files with 57 additions and 54 deletions

View File

@ -52,5 +52,5 @@ Feature: availability_completion
Then I should not see "Page 2" in the "region-main" "region"
# Mark page 1 complete
When I click on ".togglecompletion .icon" "css_element"
When I toggle the manual completion state of "Page 1"
Then I should see "Page 2" in the "region-main" "region"

View File

@ -242,7 +242,7 @@ Feature: Award badges
And I click on "Course 1" "link" in the "region-main" "region"
Then I should not see "badges"
And I am on "Course 1" course homepage
And I click on "Not completed: Test assignment name" "icon"
And I toggle the manual completion state of "Test assignment name"
And I follow "Profile" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
Then I should see "Course Badge"
@ -296,7 +296,7 @@ Feature: Award badges
And I click on "Course 1" "link" in the "region-main" "region"
Then I should not see "badges"
And I am on "Course 1" course homepage
And I click on "Not completed: Test assignment name" "icon"
And I toggle the manual completion state of "Test assignment name"
And I log out
# Completion cron won't mark the whole course completed unless the
# individual criteria was marked completed more than a second ago. So

View File

@ -53,7 +53,8 @@ Feature: Award badges based on activity completion
Scenario: Student earns a badge using activity completion, but does not get passing grade
When I log in as "student1"
And I am on "Course 1" course homepage
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo"
And I follow "Test quiz name"
And I press "Re-attempt quiz"
And I set the field "False" to "1"

View File

@ -2,7 +2,7 @@
Feature: Show activity completion status or activity completion configuration on the course page
In order to understand the configuration or status of an activity's completion
As a user
I want to see an appropriate checkbox icon besides the activity
I need to see the appropriate completion information for each activity in the course homepage
Background:
Given the following "courses" exist:
@ -39,27 +39,27 @@ Feature: Show activity completion status or activity completion configuration on
Given I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Your progress"
And the "Test forum name" "Forum" activity with "manual" completion shows a status completion checkbox
And the "Test assignment name" "Assign" activity with "auto" completion shows a status completion checkbox
And the "Test quiz name" "Quiz" activity does not show any completion checkbox
And the manual completion button of "Test forum name" is displayed as "Mark as done"
And the "View" completion condition of "Test assignment name" is displayed as "todo"
And there should be no completion information shown for "Test quiz name"
Scenario: Show completion configuration to editing teachers
Given I log in as "teacher1"
And I am on "Course 1" course homepage
Then I should not see "Your progress"
And the "Test forum name" "Forum" activity with "manual" completion shows a configuration completion checkbox
And the "Test assignment name" "Assign" activity with "auto" completion shows a configuration completion checkbox
And the "Test quiz name" "Quiz" activity does not show any completion checkbox
And the manual completion button for "Test forum name" should be disabled
And "Test assignment name" should have the "View" completion condition
And there should be no completion information shown for "Test quiz name"
And I am on "Course 1" course homepage with editing mode on
And I should not see "Your progress"
And the "Test forum name" "Forum" activity with "manual" completion shows a configuration completion checkbox
And the "Test assignment name" "Assign" activity with "auto" completion shows a configuration completion checkbox
And the "Test quiz name" "Quiz" activity does not show any completion checkbox
And the manual completion button for "Test forum name" should be disabled
And "Test assignment name" should have the "View" completion condition
And there should be no completion information shown for "Test quiz name"
Scenario: Show completion configuration to non-editing teachers
Given I log in as "teacher2"
And I am on "Course 1" course homepage
Then I should not see "Your progress"
And the "Test forum name" "Forum" activity with "manual" completion shows a configuration completion checkbox
And the "Test assignment name" "Assign" activity with "auto" completion shows a configuration completion checkbox
And the "Test quiz name" "Quiz" activity does not show any completion checkbox
And the manual completion button for "Test forum name" should be disabled
And "Test assignment name" should have the "View" completion condition
And there should be no completion information shown for "Test quiz name"

View File

@ -31,8 +31,8 @@ Feature: Allow students to manually mark an activity as complete
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
When I click on "Not completed: Test forum name. Select to mark as complete." "icon"
Then the "Test forum name" "forum" activity with "manual" completion should be marked as complete
When I toggle the manual completion state of "Test forum name"
Then the manual completion button of "Test forum name" is displayed as "Done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -45,7 +45,7 @@ Feature: Restrict sections availability through completion or grade conditions
And I am on "Course 1" course homepage
Then I should see "Not available unless: The activity Test label is marked complete"
And I should not see "Test page name"
And I click on "Not completed: Test label. Select to mark as complete." "icon"
And I toggle the manual completion state of "Test label"
And I should see "Test page name"
And I should not see "Not available unless: The activity Test label is marked complete"

View File

@ -33,7 +33,7 @@ Feature: Set a certain number of discussions as a completion condition for a for
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
Then the "Test forum name" "forum" activity with "auto" completion should be marked as not complete
And the "Start discussions: 2" completion condition of "Test forum name" is displayed as "todo"
And I add a new discussion to "Test forum name" forum with:
| Subject | Post 1 subject |
| Message | Body 1 content |
@ -41,7 +41,7 @@ Feature: Set a certain number of discussions as a completion condition for a for
| Subject | Post 2 subject |
| Message | Body 2 content |
And I am on "Course 1" course homepage
Then the "Test forum name" "forum" activity with "auto" completion should be marked as complete
Then the "Start discussions: 2" completion condition of "Test forum name" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -48,11 +48,11 @@ Feature: Set end of lesson reached as a completion condition for a lesson
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
Then the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "todo"
And I follow "Test lesson"
And I press "Next page"
And I am on "Course 1" course homepage
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
And the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "todo"
And I am on "Course 1" course homepage
And I follow "Test lesson"
And I should see "You have seen more than one page of this lesson already."
@ -61,7 +61,7 @@ Feature: Set end of lesson reached as a completion condition for a lesson
And I press "Next page"
And I press "Next page"
And I am on "Course 1" course homepage
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as complete
And the "Go through the activity to the end" completion condition of "Test lesson" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -50,7 +50,7 @@ Feature: Set time spent as a completion condition for a lesson
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
Then the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
And I follow "Test lesson"
And I press "Next page"
# Add 1 sec delay so lesson knows a valid attempt has been made in past.
@ -59,7 +59,7 @@ Feature: Set time spent as a completion condition for a lesson
And I should see "You completed this lesson in"
And I should see ", which is less than the required time of 10 secs. You might need to attempt the lesson again."
And I am on "Course 1" course homepage
And the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete
And the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "todo"
And I am on "Course 1" course homepage
And I follow "Test lesson"
And I press "Next page"
@ -67,7 +67,7 @@ Feature: Set time spent as a completion condition for a lesson
And I press "Next page"
And I should not see "You might need to attempt the lesson again."
And I am on "Course 1" course homepage
And the "Test lesson" "lesson" activity with "auto" completion should be marked as complete
And the "Spend at least 10 secs on this activity" completion condition of "Test lesson" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -37,14 +37,16 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all
Scenario: student1 uses up both attempts without passing
When I log in as "student1"
And I am on "Course 1" course homepage
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo"
And I follow "Test quiz name"
And I press "Re-attempt quiz"
And I set the field "False" to "1"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I am on "Course 1" course homepage
Then "Completed: Test quiz name" "icon" should exist in the "li.modtype_quiz" "css_element"
Then the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed"
And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -41,14 +41,14 @@ Feature: Set a quiz to be marked complete when the student completes a minimum a
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And the "Make attempts: 2" completion condition of "Test quiz name" is displayed as "todo"
And I follow "Test quiz name"
And I press "Re-attempt quiz"
And I set the field "False" to "1"
And I press "Finish attempt ..."
And I press "Submit all and finish"
And I am on "Course 1" course homepage
Then "Completed: Test quiz name" "icon" should exist in the "Test quiz name" "list_item"
Then the "Make attempts: 2" completion condition of "Test quiz name" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -34,12 +34,14 @@ Feature: Set a quiz to be marked complete when the student passes
Scenario: student1 passes on the first try
When I log in as "student1"
And I am on "Course 1" course homepage
And the "Test quiz name" "quiz" activity with "auto" completion should be marked as not complete
And the "Receive a grade" completion condition of "Test quiz name" is displayed as "todo"
And the "Receive a pass grade" completion condition of "Test quiz name" is displayed as "todo"
And user "student1" has attempted "Test quiz name" with responses:
| slot | response |
| 1 | True |
And I am on "Course 1" course homepage
Then "Completed: Test quiz name" "icon" should exist in the "li.modtype_quiz" "css_element"
Then the "Receive a grade" completion condition of "Test quiz name" is displayed as "done"
And the "Receive a pass grade" completion condition of "Test quiz name" is displayed as "done"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage

View File

@ -30,10 +30,10 @@ Feature: A teacher can use activity completion to track a student progress
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And the "Test survey name" "survey" activity with "auto" completion should be marked as not complete
And the "View" completion condition of "Test survey name" is displayed as "todo"
And I follow "Test survey name"
And I am on "Course 1" course homepage
Then the "Test survey name" "survey" activity with "auto" completion should be marked as complete
Then the "View" completion condition of "Test survey name" is displayed as "done"
Scenario: Require survey submission
Given I add a "Survey" to section "1" and I fill the form with:
@ -45,8 +45,8 @@ Feature: A teacher can use activity completion to track a student progress
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
And the "Test survey name" "survey" activity with "auto" completion should be marked as not complete
And the "View" completion condition of "Test survey name" is displayed as "todo"
And I follow "Test survey name"
And I press "Click here to continue"
And I am on "Course 1" course homepage
Then the "Test survey name" "survey" activity with "auto" completion should be marked as complete
And the "View" completion condition of "Test survey name" is displayed as "done"

View File

@ -30,13 +30,12 @@ Feature: Teacher can view and override users' activity completion data via the p
# Student completes the activities, manual and automatic completion.
Given I log in as "student1"
And I am on "Course 1" course homepage
And "Not completed: my assignment. Select to mark as complete." "icon" should exist in the "my assignment" "list_item"
And "Not completed: my assignment 2" "icon" should exist in the "my assignment 2" "list_item"
And I click on "Not completed: my assignment. Select to mark as complete." "icon"
And "Completed: my assignment. Select to mark as not complete." "icon" should exist in the "my assignment" "list_item"
And the manual completion button of "my assignment" is displayed as "Mark as done"
And I toggle the manual completion state of "my assignment"
And the manual completion button of "my assignment" is displayed as "Done"
And I click on "my assignment 2" "link"
And I am on "Course 1" course homepage
And "Completed: my assignment 2" "icon" should exist in the "my assignment 2" "list_item"
And the "View" completion condition of "my assignment 2" is displayed as "done"
And I log out
# Teacher overrides the activity completion statuses to incomplete.
When I log in as "teacher1"
@ -54,13 +53,13 @@ Feature: Teacher can view and override users' activity completion data via the p
# Student can now complete the activities again, via normal means.
Then I log in as "student1"
And I am on "Course 1" course homepage
And "Not completed: my assignment (set by Teacher One). Select to mark as complete." "icon" should exist in the "my assignment" "list_item"
And "Not completed: my assignment 2 (set by Teacher One)" "icon" should exist in the "my assignment 2" "list_item"
And I click on "Not completed: my assignment (set by Teacher One). Select to mark as complete." "icon"
And "Completed: my assignment. Select to mark as not complete." "icon" should exist in the "my assignment" "list_item"
And the manual completion button of "my assignment" overridden by "Teacher One" is displayed as "Mark as done"
And the "View" completion condition of "my assignment 2" overridden by "Teacher One" is displayed as "todo"
And I toggle the manual completion state of "my assignment"
And the manual completion button of "my assignment" is displayed as "Done"
And I click on "my assignment 2" "link"
And I am on "Course 1" course homepage
And "Completed: my assignment 2" "icon" should exist in the "my assignment 2" "list_item"
And the "View" completion condition of "my assignment 2" is displayed as "done"
And I log out
# And the activity completion report should show the same.
When I log in as "teacher1"
@ -90,7 +89,7 @@ Feature: Teacher can view and override users' activity completion data via the p
# Then as a student, confirm that automatic completion checks are no longer triggered (such as after an assign submission).
Then I log in as "student1"
And I am on "Course 1" course homepage
And "Completed: my assignment 3 (set by Teacher One)" "icon" should exist in the "my assignment 3" "list_item"
And the "Receive a grade" completion condition of "my assignment 3" overridden by "Teacher One" is displayed as "done"
And I click on "my assignment 3" "link"
And I press "Add submission"
And I set the following fields to these values:
@ -98,10 +97,9 @@ Feature: Teacher can view and override users' activity completion data via the p
And I press "Save changes"
And I should see "Submitted for grading"
And I am on "Course 1" course homepage
And "Completed: my assignment 3 (set by Teacher One)" "icon" should exist in the "my assignment 3" "list_item"
And the "Receive a grade" completion condition of "my assignment 3" overridden by "Teacher One" is displayed as "done"
# And Confirm that manual completion changes are still allowed.
And I am on "Course 1" course homepage
And "Completed: my assignment (set by Teacher One). Select to mark as not complete." "icon" should exist in the "my assignment" "list_item"
And I click on "Completed: my assignment (set by Teacher One). Select to mark as not complete." "icon"
And "Not completed: my assignment. Select to mark as complete." "icon" should exist in the "my assignment" "list_item"
And I log out
And the manual completion button of "my assignment" overridden by "Teacher One" is displayed as "Done"
And I toggle the manual completion state of "my assignment"
And the manual completion button of "my assignment" is displayed as "Mark as done"