From 1e38a8a77fadc501562b556943ae3236d8411cf7 Mon Sep 17 00:00:00 2001 From: Alex Yeung Date: Thu, 16 Jan 2025 14:46:13 +0000 Subject: [PATCH] CTP-4026 Add test coverage for newly supported activities --- .github/workflows/moodle-ci.yml | 1 + tests/behat/marks_transfer.feature | 36 +++++++++++++++++++ tests/behat/reassess_marks_transfer.feature | 38 +++++++++++++++++++++ tests/behat/reassess_select_source.feature | 21 ++++++++++-- tests/behat/select_source.feature | 18 ++++++++-- 5 files changed, 108 insertions(+), 6 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 8e76c27..85f1a3f 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -81,6 +81,7 @@ jobs: run: | moodle-plugin-ci add-plugin -b main --clone https://aspark21:"$GHA_MOODLE_READ_ACCESS"@github.com/ucl-isd/moodle-block_portico_enrolments.git moodle-plugin-ci add-plugin -b main --clone https://aspark21:"$GHA_MOODLE_READ_ACCESS"@github.com/ucl-isd/moodle-block_lifecycle.git + moodle-plugin-ci add-plugin -b main --clone https://aspark21:"$GHA_MOODLE_READ_ACCESS"@github.com/ucl-isd/moodle-mod_coursework.git moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 env: DB: ${{ matrix.database }} diff --git a/tests/behat/marks_transfer.feature b/tests/behat/marks_transfer.feature index 2783b41..8125167 100644 --- a/tests/behat/marks_transfer.feature +++ b/tests/behat/marks_transfer.feature @@ -139,3 +139,39 @@ Feature: Marks transfer from Moodle to SITS And I run all adhoc tasks And I reload the page Then I should see "0" marks to transfer for "72hr take-home examination (3000 words)" + + @javascript @_file_upload + Scenario: Transfer marks for coursework to SITS + Given the "mod_coursework" plugin is installed + And the following "activities" exist: + | activity | name | intro | course | idnumber | section | allowearlyfinalisation | numberofmarkers | + | coursework | Coursework 1 | CW1 desc | C1 | coursework1 | 1 | 1 | 1 | + And the following "permission overrides" exist: + | capability | permission | role | contextlevel | reference | + | mod/coursework:publish | Allow | editingteacher | Course | C1 | + And I am on the "Course 1" course page logged in as student1 + And I follow "Coursework 1" + And I press "Upload your submission" + And I upload "lib/tests/fixtures/empty.txt" file to "Upload a file" filemanager + And I press "Submit" + And I press "Finalise your submission" + And I press "Yes" + And I log out + And I am on the "Course 1" course page logged in as teacher1 + And I follow "Coursework 1" + And I click on "Add final feedback" "link" + And I press "Save and finalise" + And I reload the page + And I press "Release all grades" + And I press "Continue" + And the "mod" "coursework1" is mapped to "72hr take-home examination (3000 words)" + And I am on the "Course 1" course page logged in as teacher1 + And I click on "More" "link" in the ".secondary-navigation" "css_element" + And I select "SITS Marks Transfer" from secondary navigation + And I should see "1" marks to transfer for "72hr take-home examination (3000 words)" + And I click on the "Transfer marks" button for "72hr take-home examination (3000 words)" + And I press "Confirm" + And I run the scheduled task "\local_sitsgradepush\task\pushtask" + And I run all adhoc tasks + And I reload the page + Then I should see "0" marks to transfer for "72hr take-home examination (3000 words)" diff --git a/tests/behat/reassess_marks_transfer.feature b/tests/behat/reassess_marks_transfer.feature index 6f3f3f8..05471f9 100644 --- a/tests/behat/reassess_marks_transfer.feature +++ b/tests/behat/reassess_marks_transfer.feature @@ -149,3 +149,41 @@ Feature: Marks transfer from Moodle to SITS for re-assessment And I run all adhoc tasks And I reload the page Then I should see "0" marks to transfer for "Coursework 4000 word written case studies" + + @javascript @_file_upload + Scenario: Transfer marks for a re-assessment coursework to SITS + Given the "mod_coursework" plugin is installed + And the following "activities" exist: + | activity | name | intro | course | idnumber | section | allowearlyfinalisation | numberofmarkers | + | coursework | Coursework 1 | CW1 desc | C1 | coursework1 | 1 | 1 | 1 | + And the following "permission overrides" exist: + | capability | permission | role | contextlevel | reference | + | mod/coursework:publish | Allow | editingteacher | Course | C1 | + And I am on the "Course 1" course page logged in as student1 + And I follow "Coursework 1" + And I press "Upload your submission" + And I upload "lib/tests/fixtures/empty.txt" file to "Upload a file" filemanager + And I press "Submit" + And I press "Finalise your submission" + And I press "Yes" + And I log out + And I am on the "Course 1" course page logged in as teacher1 + And I follow "Coursework 1" + And I click on "Add final feedback" "link" + And I press "Save and finalise" + And I reload the page + And I press "Release all grades" + And I press "Continue" + And the "mod" "coursework1" is a re-assessment and mapped to "Coursework 4000 word written case studies" + And I am on the "Course 1" course page logged in as teacher1 + And I click on "More" "link" in the ".secondary-navigation" "css_element" + And I select "SITS Marks Transfer" from secondary navigation + And I click on the marks transfer types dropdown menu and select "Re-assessment" + And I should see "Re-assessment" in the "tertiary-navigation" "region" + And I should see "1" marks to transfer for "Coursework 4000 word written case studies" + And I click on the "Transfer marks" button for "Coursework 4000 word written case studies" + And I press "Confirm" + And I run the scheduled task "\local_sitsgradepush\task\pushtask" + And I run all adhoc tasks + And I reload the page + Then I should see "0" marks to transfer for "Coursework 4000 word written case studies" \ No newline at end of file diff --git a/tests/behat/reassess_select_source.feature b/tests/behat/reassess_select_source.feature index 20f48d4..dabea37 100644 --- a/tests/behat/reassess_select_source.feature +++ b/tests/behat/reassess_select_source.feature @@ -32,9 +32,10 @@ Feature: Map Moodle source to SITS assessment component for re-assessment | local/sitsgradepush:mapassessment | Allow | editingteacher | Course | C1 | And the course "C1" is set up for marks transfer And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | - | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | + | activity | name | intro | course | idnumber | section | + | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | + | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | + | coursework | Coursework 1 | CW1 desc | C1 | coursework1 | 1 | And the following "grade items" exist: | itemname | course | idnumber | | Grade Item 1 | C1 | gradeitem1 | @@ -93,3 +94,17 @@ Feature: Map Moodle source to SITS assessment component for re-assessment And I click on the "Select" button for "Grade category 1" And I press "Confirm" Then I should see "Grade category 1" is mapped to "Coursework 4000 word written case studies" + + @javascript + Scenario: Map a re-assessment coursework to a SITS assessment component + Given the "mod_coursework" plugin is installed + And I am on the "Course 1" course page logged in as teacher1 + And I click on "More" "link" in the ".secondary-navigation" "css_element" + And I select "SITS Marks Transfer" from secondary navigation + And I click on the marks transfer types dropdown menu and select "Re-assessment" + And I should see "Re-assessment" in the "tertiary-navigation" "region" + And I click on the "Select source" button for "Coursework 4000 word written case studies" + And I click on the "Select" button for "Coursework 1" + And I press "Confirm" + Then I should see "Coursework 1" is mapped to "Coursework 4000 word written case studies" + diff --git a/tests/behat/select_source.feature b/tests/behat/select_source.feature index 9877ad8..fa745f3 100644 --- a/tests/behat/select_source.feature +++ b/tests/behat/select_source.feature @@ -30,9 +30,10 @@ Feature: Map Moodle source to SITS assessment component | local/sitsgradepush:mapassessment | Allow | editingteacher | Course | C1 | And the course "C1" is set up for marks transfer And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | - | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | + | activity | name | intro | course | idnumber | section | + | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | + | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | + | coursework | Coursework 1 | CW1 desc | C1 | coursework1 | 1 | And the following "grade items" exist: | itemname | course | idnumber | | Grade Item 1 | C1 | gradeitem1 | @@ -83,3 +84,14 @@ Feature: Map Moodle source to SITS assessment component And I click on the "Select" button for "Grade category 1" And I press "Confirm" Then I should see "Grade category 1" is mapped to "72hr take-home examination (3000 words)" + + @javascript + Scenario: Map a coursework to a SITS assessment component + Given the "mod_coursework" plugin is installed + And I am on the "Course 1" course page logged in as teacher1 + And I click on "More" "link" in the ".secondary-navigation" "css_element" + And I select "SITS Marks Transfer" from secondary navigation + And I click on the "Select source" button for "72hr take-home examination (3000 words)" + And I click on the "Select" button for "Coursework 1" + And I press "Confirm" + Then I should see "Coursework 1" is mapped to "72hr take-home examination (3000 words)"