From adb8b59dd381c1ae2612f6c6ba22698ccd432cb2 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 | 3 +- tests/behat/behat_sitsgradepush.php | 36 ++++- tests/behat/marks_transfer.feature | 139 +++++++++++++++--- tests/behat/marks_transfer_all.feature | 4 +- tests/behat/reassess_marks_transfer.feature | 109 +++++++++++++- .../behat/reassess_marks_transfer_all.feature | 4 +- tests/behat/reassess_select_source.feature | 53 ++++++- tests/behat/remove_source.feature | 2 +- tests/behat/select_source.feature | 47 +++++- 9 files changed, 357 insertions(+), 40 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 8e76c27..7dd5545 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -10,7 +10,7 @@ jobs: services: postgres: - image: postgres:13 + image: postgres:14 env: POSTGRES_USER: 'postgres' POSTGRES_HOST_AUTH_METHOD: 'trust' @@ -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/behat_sitsgradepush.php b/tests/behat/behat_sitsgradepush.php index 675ff2c..b8807b6 100644 --- a/tests/behat/behat_sitsgradepush.php +++ b/tests/behat/behat_sitsgradepush.php @@ -253,12 +253,11 @@ public function map_source(string $sourcetype, string $sourcename, string $mabna global $DB; $manager = manager::get_manager(); + $sourceexplode = explode('_', $sourcetype); + // Get the source. - $source = match ($sourcetype) { - 'mod' => $DB->get_record( - 'course_modules', - ['idnumber' => $sourcename] - ), + $source = match ($sourceexplode[0]) { + 'mod' => $this->get_coursemodule($sourceexplode[1], $sourcename), 'gradeitem' => $DB->get_record( 'grade_items', ['idnumber' => $sourcename] @@ -276,7 +275,7 @@ public function map_source(string $sourcetype, string $sourcename, string $mabna $mab = $DB->get_record('local_sitsgradepush_mab', ['mabname' => $mabname]); // Get the assessment. - $assessment = assessmentfactory::get_assessment($sourcetype, $source->id); + $assessment = assessmentfactory::get_assessment($sourceexplode[0], $source->id); // Insert new mapping. $record = new \stdClass(); @@ -294,6 +293,31 @@ public function map_source(string $sourcetype, string $sourcename, string $mabna $DB->insert_record($manager::TABLE_ASSESSMENT_MAPPING, $record); } + /** + * Get the course module. + * + * @param string $modulename + * @param string $sourcename + * @return object + * @throws \Exception + */ + public function get_coursemodule(string $modulename, string $sourcename ): mixed { + global $DB; + + if ($modulename == 'lti') { + $sql = "SELECT cm.id FROM {course_modules} cm JOIN {lti} lti ON cm.instance = lti.id WHERE lti.name = :sourcename"; + $coursemodule = $DB->get_record_sql($sql, ['sourcename' => $sourcename]); + } else { + $coursemodule = $DB->get_record('course_modules', ['idnumber' => $sourcename]); + } + + if (!$coursemodule) { + throw new Exception("Course module with module name '$modulename', source name '$sourcename' not found."); + } + + return $coursemodule; + } + /** * Re-grade the course. * diff --git a/tests/behat/marks_transfer.feature b/tests/behat/marks_transfer.feature index 2783b41..92482d6 100644 --- a/tests/behat/marks_transfer.feature +++ b/tests/behat/marks_transfer.feature @@ -13,7 +13,7 @@ Feature: Marks transfer from Moodle to SITS | student3 | Student3 | Test | 23456783 | student3@example.com | | teacher1 | Teacher1 | Test | tea1 | teacher1@example.com | And the following custom field exists for grade push: - | category | CLC | + | category | CLC | | shortname | course_year | | name | Course Year | | type | text | @@ -21,10 +21,10 @@ Feature: Marks transfer from Moodle to SITS | fullname | shortname | format | customfield_course_year | | Course 1 | C1 | topics | ##now##%Y## | And the following "course enrolments" exist: - | user | course | role | - | student1 | C1 | student | - | student2 | C1 | student | - | student3 | C1 | student | + | user | course | role | + | student1 | C1 | student | + | student2 | C1 | student | + | student3 | C1 | student | | teacher1 | C1 | editingteacher | And the following "permission overrides" exist: | capability | permission | role | contextlevel | reference | @@ -35,15 +35,15 @@ Feature: Marks transfer from Moodle to SITS @javascript Scenario: Transfer marks for an assignment to SITS Given the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | + | activity | name | intro | course | idnumber | section | + | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | And the following "mod_assign > submissions" exist: - | assign | user | onlinetext | - | assign1 | student1 | This is a submission for assignment | + | assign | user | onlinetext | + | assign1 | student1 | This is a submission for assignment | And the following "grade grades" exist: | gradeitem | user | grade | - | Assign 1 | student1 | 50 | - And the "mod" "assign1" is mapped to "72hr take-home examination (3000 words)" + | Assign 1 | student1 | 50 | + And the "mod_assign" "assign1" 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 @@ -58,8 +58,8 @@ Feature: Marks transfer from Moodle to SITS @javascript Scenario: Transfer marks for a quiz to SITS Given the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | + | activity | name | intro | course | idnumber | section | + | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | @@ -75,13 +75,13 @@ Feature: Marks transfer from Moodle to SITS | TF2 | 1 | 50.0 | And user "student1" has attempted "Quiz 1" with responses: | slot | response | - | 2 | True | - | 3 | False | + | 2 | True | + | 3 | False | And user "student2" has attempted "Quiz 1" with responses: | slot | response | - | 2 | True | - | 3 | True | - And the "mod" "quiz1" is mapped to "72hr take-home examination (3000 words)" + | 2 | True | + | 3 | True | + And the "mod_quiz" "quiz1" 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 @@ -96,8 +96,8 @@ Feature: Marks transfer from Moodle to SITS @javascript Scenario: Transfer marks for a grade item to SITS Given the following "grade items" exist: - | itemname | course | idnumber | - | Grade Item 1 | C1 | gradeitem1 | + | itemname | course | idnumber | + | Grade Item 1 | C1 | gradeitem1 | And the following "grade grades" exist: | gradeitem | user | grade | | Grade Item 1 | student1 | 21.00 | @@ -139,3 +139,102 @@ 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_coursework" "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)" + + @javascript + Scenario: Transfer marks for lesson to SITS + Given the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And the following "mod_lesson > pages" exist: + | lesson | qtype | title | content | + | Test lesson name | truefalse | True/false question 1 | Paper is made from trees. | + | Test lesson name | truefalse | True/false question 2 | The sky is Pink. | + And the following "mod_lesson > answers" exist: + | page | answer | response | jumpto | score | + | True/false question 1 | True | Correct | Next page | 1 | + | True/false question 1 | False | Wrong | This page | 0 | + | True/false question 2 | False | Correct | Next page | 1 | + | True/false question 2 | True | Wrong | This page | 0 | + When I am on the "Test lesson name" "lesson activity" page logged in as student1 + And I should see "Paper is made from trees." + And I set the following fields to these values: + | True | 1 | + And I press "Submit" + And I press "Continue" + And I should see "The sky is Pink." + And I set the following fields to these values: + | True | 1 | + And I press "Submit" + And I press "Continue" + And the "mod_lesson" "lesson1" 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)" + + @javascript + Scenario: Transfer marks for lti to SITS + Given the following "mod_lti > tool types" exist: + | name | baseurl | coursevisible | state | + | Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 | + And I am on the "Course 1" course page logged in as teacher1 + And I turn editing mode on + And I add a "Teaching Tool 1" to section "1" using the activity chooser + And I set the field "Activity name" to "lti 1" + And I press "Save and return to course" + And I am on the "Course 1" "grades > Grader report > View" page + And I give the grade "90.00" to the user "Student1 Test" for the grade item "lti 1" + And I press "Save changes" + And the "mod_lti" "lti 1" is mapped to "72hr take-home examination (3000 words)" + And I am on the "Course 1" course page + 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/marks_transfer_all.feature b/tests/behat/marks_transfer_all.feature index f0a9443..5d53665 100644 --- a/tests/behat/marks_transfer_all.feature +++ b/tests/behat/marks_transfer_all.feature @@ -40,7 +40,7 @@ Feature: Transfer all mapped sources from Moodle to SITS And the following "grade grades" exist: | gradeitem | user | grade | | Assign 1 | student1 | 50 | - And the "mod" "assign1" is mapped to "72hr take-home examination (3000 words)" + And the "mod_assign" "assign1" is mapped to "72hr take-home examination (3000 words)" And the following "activities" exist: | activity | name | intro | course | idnumber | section | | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | @@ -65,7 +65,7 @@ Feature: Transfer all mapped sources from Moodle to SITS | slot | response | | 2 | True | | 3 | True | - And the "mod" "quiz1" is mapped to "2000 word essay" + And the "mod_quiz" "quiz1" is mapped to "2000 word essay" @javascript Scenario: Transfer all marks to SITS diff --git a/tests/behat/reassess_marks_transfer.feature b/tests/behat/reassess_marks_transfer.feature index 6f3f3f8..6deff5e 100644 --- a/tests/behat/reassess_marks_transfer.feature +++ b/tests/behat/reassess_marks_transfer.feature @@ -45,7 +45,7 @@ Feature: Marks transfer from Moodle to SITS for re-assessment And the following "grade grades" exist: | gradeitem | user | grade | | Assign 1 | student1 | 50 | - And the "mod" "assign1" is a re-assessment and mapped to "Coursework 4000 word written case studies" + And the "mod_assign" "assign1" 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 @@ -85,7 +85,7 @@ Feature: Marks transfer from Moodle to SITS for re-assessment | slot | response | | 2 | True | | 3 | True | - And the "mod" "quiz1" is a re-assessment and mapped to "Coursework 4000 word written case studies" + And the "mod_quiz" "quiz1" 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 @@ -149,3 +149,108 @@ 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_coursework" "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" + + @javascript + Scenario: Transfer marks for a re-assessment lesson to SITS + Given the following "activities" exist: + | activity | name | course | idnumber | + | lesson | Test lesson name | C1 | lesson1 | + And the following "mod_lesson > pages" exist: + | lesson | qtype | title | content | + | Test lesson name | truefalse | True/false question 1 | Paper is made from trees. | + | Test lesson name | truefalse | True/false question 2 | The sky is Pink. | + And the following "mod_lesson > answers" exist: + | page | answer | response | jumpto | score | + | True/false question 1 | True | Correct | Next page | 1 | + | True/false question 1 | False | Wrong | This page | 0 | + | True/false question 2 | False | Correct | Next page | 1 | + | True/false question 2 | True | Wrong | This page | 0 | + When I am on the "Test lesson name" "lesson activity" page logged in as student1 + And I should see "Paper is made from trees." + And I set the following fields to these values: + | True | 1 | + And I press "Submit" + And I press "Continue" + And I should see "The sky is Pink." + And I set the following fields to these values: + | True | 1 | + And I press "Submit" + And I press "Continue" + And the "mod_lesson" "lesson1" 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" + + @javascript + Scenario: Transfer marks for a re-assessment lti activity to SITS + Given the following "mod_lti > tool types" exist: + | name | baseurl | coursevisible | state | + | Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 | + And I am on the "Course 1" course page logged in as teacher1 + And I turn editing mode on + And I add a "Teaching Tool 1" to section "1" using the activity chooser + And I set the field "Activity name" to "lti 1" + And I press "Save and return to course" + And I am on the "Course 1" "grades > Grader report > View" page + And I give the grade "90.00" to the user "Student1 Test" for the grade item "lti 1" + And I press "Save changes" + And the "mod_lti" "lti 1" is a re-assessment and mapped to "Coursework 4000 word written case studies" + And I am on the "Course 1" course page + 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" diff --git a/tests/behat/reassess_marks_transfer_all.feature b/tests/behat/reassess_marks_transfer_all.feature index 0ea586f..7faa07b 100644 --- a/tests/behat/reassess_marks_transfer_all.feature +++ b/tests/behat/reassess_marks_transfer_all.feature @@ -42,7 +42,7 @@ Feature: Transfer all mapped sources from Moodle to SITS for re-assessment And the following "grade grades" exist: | gradeitem | user | grade | | Assign 1 | student1 | 50 | - And the "mod" "assign1" is a re-assessment and mapped to "Coursework 4000 word written case studies" + And the "mod_assign" "assign1" is a re-assessment and mapped to "Coursework 4000 word written case studies" And the following "activities" exist: | activity | name | intro | course | idnumber | section | | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | @@ -67,7 +67,7 @@ Feature: Transfer all mapped sources from Moodle to SITS for re-assessment | slot | response | | 2 | True | | 3 | True | - And the "mod" "quiz1" is a re-assessment and mapped to "OSCE" + And the "mod_quiz" "quiz1" is a re-assessment and mapped to "OSCE" @javascript Scenario: Transfer all marks to SITS diff --git a/tests/behat/reassess_select_source.feature b/tests/behat/reassess_select_source.feature index 20f48d4..39d5334 100644 --- a/tests/behat/reassess_select_source.feature +++ b/tests/behat/reassess_select_source.feature @@ -32,9 +32,11 @@ 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 | + | lesson | Lesson 1 | L1 desc | C1 | lesson1 | 1 | And the following "grade items" exist: | itemname | course | idnumber | | Grade Item 1 | C1 | gradeitem1 | @@ -93,3 +95,48 @@ 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" + + @javascript + Scenario: Map a re-assessment lesson to a SITS assessment component + Given 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 "Lesson 1" + And I press "Confirm" + Then I should see "Lesson 1" is mapped to "Coursework 4000 word written case studies" + + @javascript + Scenario: Map a re-assessment lti activity to a SITS assessment component + Given the following "mod_lti > tool types" exist: + | name | baseurl | coursevisible | state | + | Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 | + And I am on the "Course 1" course page logged in as teacher1 + And I turn editing mode on + And I add a "Teaching Tool 1" to section "1" using the activity chooser + And I set the field "Activity name" to "LTI 1" + And I press "Save and return to course" + And I am on the "Course 1" course page + 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 "LTI 1" + And I press "Confirm" + Then I should see "LTI 1" is mapped to "Coursework 4000 word written case studies" diff --git a/tests/behat/remove_source.feature b/tests/behat/remove_source.feature index 2573245..7a8a5a6 100644 --- a/tests/behat/remove_source.feature +++ b/tests/behat/remove_source.feature @@ -28,7 +28,7 @@ Feature: Remove Moodle source for SITS assessment component | assign | Assign 1 | A1 desc | C1 | assign1 | 1 | | quiz | Quiz 1 | Q1 desc | C1 | quiz1 | 1 | And the course "C1" is regraded - And the "mod" "assign1" is mapped to "72hr take-home examination (3000 words)" + And the "mod_assign" "assign1" is mapped to "72hr take-home examination (3000 words)" @javascript Scenario: Remove source for a SITS assessment component diff --git a/tests/behat/select_source.feature b/tests/behat/select_source.feature index 9877ad8..ebf5bfb 100644 --- a/tests/behat/select_source.feature +++ b/tests/behat/select_source.feature @@ -30,9 +30,11 @@ 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 | + | lesson | Lesson 1 | L1 desc | C1 | lesson1 | 1 | And the following "grade items" exist: | itemname | course | idnumber | | Grade Item 1 | C1 | gradeitem1 | @@ -83,3 +85,42 @@ 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)" + + @javascript + Scenario: Map a lesson to a SITS assessment component + Given 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 "Lesson 1" + And I press "Confirm" + Then I should see "Lesson 1" is mapped to "72hr take-home examination (3000 words)" + + @javascript + Scenario: Map a lti activity to a SITS assessment component + Given the following "mod_lti > tool types" exist: + | name | baseurl | coursevisible | state | + | Teaching Tool 1 | /mod/lti/tests/fixtures/tool_provider.php | 2 | 1 | + And I am on the "Course 1" course page logged in as teacher1 + And I turn editing mode on + And I add a "Teaching Tool 1" to section "1" using the activity chooser + And I set the field "Activity name" to "LTI 1" + And I press "Save and return to course" + And I am on the "Course 1" course page + 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 "LTI 1" + And I press "Confirm" + Then I should see "LTI 1" is mapped to "72hr take-home examination (3000 words)"