MDL-71162 mod_choice: Updated completion behat to use latest rules

This commit is contained in:
Michael Hawkins 2021-04-16 20:15:46 +08:00
parent 73bcf9a8d0
commit 53707660dc
2 changed files with 22 additions and 27 deletions

View File

@ -32,19 +32,19 @@ Feature: Automatic completion in the choice activity
Given I log in as "student1"
And I am on "Course 1" course homepage
When I follow "What to drink?"
Then I should see "Done: View" in the "[data-region=completionrequirements]" "css_element"
And I should see "To do: Make a choice" in the "[data-region=completionrequirements]" "css_element"
Then the "View" completion condition of "What to drink?" is displayed as "done"
And the "Make a choice" completion condition of "What to drink?" is displayed as "todo"
And I set the field "Beer" to "1"
And I press "Save my choice"
And I should see "Done: View" in the "[data-region=completionrequirements]" "css_element"
And I should see "Done: Make a choice" in the "[data-region=completionrequirements]" "css_element"
And the "View" completion condition of "What to drink?" is displayed as "done"
And the "Make a choice" completion condition of "What to drink?" is displayed as "done"
Scenario: Viewing a choice activity with automatic completion as a teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I follow "What to drink?"
And I should see "View" in the "[data-region=completionrequirements]" "css_element"
And I should see "Make a choice" in the "[data-region=completionrequirements]" "css_element"
Then "What to drink?" should have the "View" completion condition
And "What to drink?" should have the "Make a choice" completion condition
@javascript
Scenario: Overriding automatic choice completion for a user
@ -57,5 +57,5 @@ Feature: Automatic completion in the choice activity
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "What to drink?"
Then "span[aria-label=\"Done: View (set by Teacher 1)\"]" "css_element" should exist
And "span[aria-label=\"Done: Make a choice (set by Teacher 1)\"]" "css_element" should exist
Then the "View" completion condition of "What to drink?" overridden by "Teacher 1" is displayed as "done"
And the "Make a choice" completion condition of "What to drink?" overridden by "Teacher 1" is displayed as "done"

View File

@ -31,31 +31,28 @@ Feature: Manual completion in the choice activity
Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "What to drink?"
And "Mark as done" "button" should exist
When I press "Mark as done"
And I wait until the page is ready
Then "Done" "button" should exist
And the manual completion button of "What to drink?" is displayed as "Mark as done"
When I toggle the manual completion state of "What to drink?"
Then the manual completion button of "What to drink?" is displayed as "Done"
But "Mark as done" "button" should not exist
# Just make sure that the change persisted.
And I reload the page
And I wait until the page is ready
And I should not see "Mark as done"
And I should see "Done"
And I press "Done"
And I wait until the page is ready
And "Mark as done" "button" should exist
And the manual completion button of "What to drink?" is displayed as "Done"
And I toggle the manual completion state of "What to drink?"
And the manual completion button of "What to drink?" is displayed as "Mark as done"
But "Done" "button" should not exist
# Just make sure that the change persisted.
And I reload the page
And I wait until the page is ready
And "Mark as done" "button" should exist
And the manual completion button of "What to drink?" is displayed as "Mark as done"
But "Done" "button" should not exist
Scenario: Viewing a choice activity with manual completion as a teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I follow "What to drink?"
Then the "Mark as done" "button" should be disabled
Then the manual completion button for "What to drink?" should be disabled
@javascript
Scenario: Overriding a manual choice completion for a user to done
@ -68,10 +65,9 @@ Feature: Manual completion in the choice activity
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "What to drink?"
Then "button[aria-label=\"What to drink? is marked by Teacher 1 as done. Press to undo.\"]" "css_element" should exist
And I press "Done"
And I wait until the page is ready
And "button[aria-label=\"Mark What to drink? as done\"]" "css_element" should exist
Then the manual completion button of "What to drink?" overridden by "Teacher 1" is displayed as "Done"
And I toggle the manual completion state of "What to drink?"
And the manual completion button of "What to drink?" is displayed as "Mark as done"
@javascript
Scenario: Overriding a manual choice completion for a user to not done
@ -90,7 +86,6 @@ Feature: Manual completion in the choice activity
And I log in as "student1"
And I am on "Course 1" course homepage
When I follow "What to drink?"
Then "button[aria-label=\"What to drink? is marked by Teacher 1 as not done. Press to mark as done.\"]" "css_element" should exist
And I press "Mark as done"
And I wait until the page is ready
And "button[aria-label=\"What to drink? is marked as done. Press to undo.\"]" "css_element" should exist
Then the manual completion button of "What to drink?" overridden by "Teacher 1" is displayed as "Mark as done"
And I toggle the manual completion state of "What to drink?"
And the manual completion button of "What to drink?" is displayed as "Done"