From 020cbf5292f5da3461afb946e7ce38a3e4f04ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Thu, 4 Jan 2024 16:24:39 +0100 Subject: [PATCH] Adopt Moodle Plugin CI tests to current versions. --- .github/workflows/moodle-plugin-ci.yml | 8 +- .../choicegroup_activity_completion.feature | 152 +++++++++++++++++- 2 files changed, 150 insertions(+), 10 deletions(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index f564459..aa1b82c 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -8,7 +8,7 @@ jobs: services: postgres: - image: postgres:10 + image: postgres:13 env: POSTGRES_USER: 'postgres' POSTGRES_HOST_AUTH_METHOD: 'trust' @@ -16,7 +16,7 @@ jobs: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 mariadb: - image: mariadb:10.5 + image: mariadb:10 env: MYSQL_USER: 'root' MYSQL_ALLOW_EMPTY_PASSWORD: "true" @@ -27,8 +27,8 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.3', '7.4', '8.0'] - moodle-branch: ['MOODLE_400_STABLE'] + php: ['8.0', '8.1', '8.2'] + moodle-branch: ['MOODLE_402_STABLE', 'MOODLE_403_STABLE'] database: [pgsql, mariadb] steps: diff --git a/tests/behat/choicegroup_activity_completion.feature b/tests/behat/choicegroup_activity_completion.feature index f9a04cb..26650a0 100644 --- a/tests/behat/choicegroup_activity_completion.feature +++ b/tests/behat/choicegroup_activity_completion.feature @@ -34,8 +34,49 @@ Feature: View activity completion information in the choicegroup activity And I log out @javascript - Scenario: View automatic completion items for view - Given I log in as "teacher1" + Scenario: View automatic completion items for view for Moodle ≥ 4.3 + Given the site is running Moodle version 4.3 or higher + And I log in as "teacher1" + And I am on "Course 1" course homepage with editing mode on + And I press "Add an activity or resource" + And I click on "Add a new Group choice" "link" in the "Add an activity or resource" "dialogue" + And I set the following fields to these values: + | Group choice name | Choose your group | + | Description | Group choice description | + | Add requirements | 1 | + | View the activity | 1 | + And I set the field "availablegroups" to "Group A" + And I press "Add Group" + And I set the field "availablegroups" to "Group B" + And I press "Add Group" + And I press "Save and return to course" + # Teacher view. + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And "Choose your group" should have the "View" completion condition + And I am on "Course 1" course homepage + And I navigate to "Reports" in current page administration + And I click on "Activity completion" "link" + And "Vinnie Student1, Choose your group: Not completed" "icon" should exist in the "Vinnie Student1" "table_row" + And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And I log out + # Student 1 view. + And I log in as "student1" + And I am on the "Choose your group" "choicegroup activity" page logged in as student1 + And the "View" completion condition of "Choose your group" is displayed as "done" + # Teacher view. + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And "Choose your group" should have the "View" completion condition + And I am on "Course 1" course homepage + And I navigate to "Reports" in current page administration + And I click on "Activity completion" "link" + Then "Vinnie Student1, Choose your group: Completed" "icon" should exist in the "Vinnie Student1" "table_row" + And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" + + @javascript + Scenario: View automatic completion items for view for Moodle ≤ 4.2 + Given the site is running Moodle version 4.2 or lower + And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I press "Add an activity or resource" And I click on "Add a new Group choice" "link" in the "Add an activity or resource" "dialogue" @@ -74,8 +115,9 @@ Feature: View activity completion information in the choicegroup activity And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" @javascript - Scenario: View automatic completion items for choose - Given I log in as "teacher1" + Scenario: View automatic completion items for choose for Moodle ≤ 4.2 + Given the site is running Moodle version 4.2 or lower + And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I press "Add an activity or resource" And I click on "Add a new Group choice" "link" in the "Add an activity or resource" "dialogue" @@ -117,8 +159,53 @@ Feature: View activity completion information in the choicegroup activity And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" @javascript - Scenario: View automatic completion items for both choose and view - Given I log in as "teacher1" + Scenario: View automatic completion items for choose for Moodle ≥ 4.3 + Given the site is running Moodle version 4.3 or higher + And I log in as "teacher1" + And I am on "Course 1" course homepage with editing mode on + And I press "Add an activity or resource" + And I click on "Add a new Group choice" "link" in the "Add an activity or resource" "dialogue" + And I set the following fields to these values: + | Group choice name | Choose your group | + | Description | Group choice description | + | Add requirements | 1 | + | View the activity | 0 | + | Show as complete when user makes a choice | 1 | + And I set the field "availablegroups" to "Group A" + And I press "Add Group" + And I set the field "availablegroups" to "Group B" + And I press "Add Group" + And I press "Save and return to course" + # Teacher view. + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And "Choose your group" should have the "Choose a group" completion condition + And I am on "Course 1" course homepage + And I navigate to "Reports" in current page administration + And I click on "Activity completion" "link" + And "Vinnie Student1, Choose your group: Not completed" "icon" should exist in the "Vinnie Student1" "table_row" + And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And I log out + # Student 1 choose. + And I log in as "student1" + And I am on the "Choose your group" "choicegroup activity" page logged in as student1 + And the "Choose a group" completion condition of "Choose your group" is displayed as "todo" + And I set the field "Group A" to "1" + And I press "Save my choice" + And the "Choose a group" completion condition of "Choose your group" is displayed as "done" + # Teacher view. + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And "Choose your group" should have the "Choose a group" completion condition + And I am on "Course 1" course homepage + And I navigate to "Reports" in current page administration + And I click on "Activity completion" "link" + Then "Vinnie Student1, Choose your group: Completed" "icon" should exist in the "Vinnie Student1" "table_row" + And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" + + @javascript + Scenario: View automatic completion items for both choose and view for Moodle ≤ 4.2 + Given the site is running Moodle version 4.2 or lower + And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I press "Add an activity or resource" And I click on "Add a new Group choice" "link" in the "Add an activity or resource" "dialogue" @@ -167,3 +254,56 @@ Feature: View activity completion information in the choicegroup activity And I click on "Activity completion" "link" Then "Vinnie Student1, Choose your group: Completed" "icon" should exist in the "Vinnie Student1" "table_row" And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" + + @javascript + Scenario: View automatic completion items for both choose and view for Moodle ≥ 4.3 + Given the site is running Moodle version 4.3 or higher + And I log in as "teacher1" + And I am on "Course 1" course homepage with editing mode on + And I press "Add an activity or resource" + And I click on "Add a new Group choice" "link" in the "Add an activity or resource" "dialogue" + And I set the following fields to these values: + | Group choice name | Choose your group | + | Description | Group choice description | + | Add requirements | 1 | + | View the activity | 1 | + | Show as complete when user makes a choice | 1 | + And I set the field "availablegroups" to "Group A" + And I press "Add Group" + And I set the field "availablegroups" to "Group B" + And I press "Add Group" + And I press "Save and return to course" + # Teacher view. + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And "Choose your group" should have the "View" completion condition + And "Choose your group" should have the "Choose a group" completion condition + And I am on "Course 1" course homepage + And I navigate to "Reports" in current page administration + And I click on "Activity completion" "link" + And "Vinnie Student1, Choose your group: Not completed" "icon" should exist in the "Vinnie Student1" "table_row" + And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row" + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And I log out + # Student 1 choose. + And I log in as "student1" + And I am on the "Choose your group" "choicegroup activity" page logged in as student1 + And the "View" completion condition of "Choose your group" is displayed as "done" + And the "Choose a group" completion condition of "Choose your group" is displayed as "todo" + And I set the field "Group A" to "1" + And I press "Save my choice" + And the "Choose a group" completion condition of "Choose your group" is displayed as "done" + And I log out + # Student 2 view. + And I log in as "student2" + And I am on the "Choose your group" "choicegroup activity" page logged in as student2 + And the "View" completion condition of "Choose your group" is displayed as "done" + And the "Choose a group" completion condition of "Choose your group" is displayed as "todo" + And I log out + # Teacher view. + And I am on the "Choose your group" "choicegroup activity" page logged in as teacher1 + And "Choose your group" should have the "Choose a group" completion condition + And I am on "Course 1" course homepage + And I navigate to "Reports" in current page administration + And I click on "Activity completion" "link" + Then "Vinnie Student1, Choose your group: Completed" "icon" should exist in the "Vinnie Student1" "table_row" + And "Ann Student2, Choose your group: Not completed" "icon" should exist in the "Ann Student2" "table_row"