From 53707660dceb0c169600876bd54aa82a0bd82f0f Mon Sep 17 00:00:00 2001 From: Michael Hawkins Date: Fri, 16 Apr 2021 20:15:46 +0800 Subject: [PATCH] MDL-71162 mod_choice: Updated completion behat to use latest rules --- ...activity_info_completion_automatic.feature | 16 ++++----- .../activity_info_completion_manual.feature | 33 ++++++++----------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/mod/choice/tests/behat/activity_info_completion_automatic.feature b/mod/choice/tests/behat/activity_info_completion_automatic.feature index 8c4cf786cde..6acd80966d5 100644 --- a/mod/choice/tests/behat/activity_info_completion_automatic.feature +++ b/mod/choice/tests/behat/activity_info_completion_automatic.feature @@ -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" diff --git a/mod/choice/tests/behat/activity_info_completion_manual.feature b/mod/choice/tests/behat/activity_info_completion_manual.feature index e5285746ab7..b44b9690d6e 100644 --- a/mod/choice/tests/behat/activity_info_completion_manual.feature +++ b/mod/choice/tests/behat/activity_info_completion_manual.feature @@ -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"