Skip to content

Commit

Permalink
Extend Behat tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Sep 4, 2024
1 parent d7b5a08 commit 8a7246d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lang/en/qbank_bulkxmlexport.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
*/


$string['pluginname'] = 'Bulk XML Export';
$string['pluginname'] = 'Bulk XML Export questions';
$string['privacy:metadata'] = 'The XML export question bank plugin does not store any personal data.';
38 changes: 22 additions & 16 deletions tests/behat/bulk_xml_export_action.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,55 @@ Feature: Use the plugin to export several question at once in the qbank manager.

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "activities" exist:
| activity | name | course | idnumber |
| quiz | Test quiz | C1 | quiz1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | questioncategory | name |
| Course | C1 | Test Q1 | Test Q1 |
| Course | C1 | Test Q1 | Sub Q1.2 |
| contextlevel | reference | questioncategory | name |
| Course | C1 | Top | top |
| Course | C1 | top | Default for C1 |
| Course | C1 | Default for C1 | Subcategory |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test Q1 | truefalse | First question | Answer the first question |
| Sub Q1.2 | essay | Essay Foo Bar | Write about whatever you want |
| Default for C1 | truefalse | First question | Answer the first question |
| Subcategory | essay | Essay Foo Bar | Write about whatever you want |

Scenario: Enable/disable bulk export xml questions bulk action from the base view
Given I log in as "admin"
When I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
And I should see "Bulk XML Export"
And I click on "Disable" "link" in the "Bulk move questions" "table_row"
And I should see "Bulk move questions"
And I click on "Disable" "link" in the "Bulk XML Export questions" "table_row"
And I am on the "Test quiz" "mod_quiz > question bank" page
And I click on "First question" "checkbox"
And I click on "With selected" "button"
Then I should not see question bulk action "Export as Moodle XML"
Then I should not see question bulk action "bulkxmlexport"
And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
And I click on "Enable" "link" in the "Bulk XML Export" "table_row"
And I click on "Enable" "link" in the "Bulk XML Export questions" "table_row"
And I am on the "Test quiz" "mod_quiz > question bank" page
And I click on "First question" "checkbox"
And I click on "With selected" "button"
And I should see question bulk action "Export as Moodle XML"
And I should see question bulk action "bulkxmlexport"

@javascript
Scenario: Export questions as Moodle XML
Scenario: Bulk export questions as Moodle XML
When I am on the "Course 1" "core_question > course question bank" page logged in as "teacher1"
And I should see "First question"
And I should not see "Essay Foo Bar"
And I click on "Also show questions from subcategories" "checkbox"
And I click the "Apply filters" "button"
And I click on "Apply filters" "button"
And I should see "First question"
And I should see "Essay Foo Bar"
And I click on "First question" "checkbox"
And I click on "Essay Foo Bar" "checkbox"
And I click on "With selected" "button"
And I should see question bulk action "bulkxmlexport"
And I click on question bulk action "bulkxmlexport"
Then following "Download" should download between "1" and "180000" bytes

0 comments on commit 8a7246d

Please sign in to comment.