MDL-52964 Qtype: Add behat tests to core question types
[moodle.git] / question / type / truefalse / tests / behat / export.feature
bloba80ec25ee69fe9592140101f0c200c89f8d1f132
1 @qtype @qtype_truefalse
2 Feature: Test exporting True/False questions
3   As a teacher
4   In order to be able to reuse my True/false questions
5   I need to export them
7   Background:
8     Given the following "users" exist:
9       | username | firstname | lastname | email                |
10       | teacher1 | T1        | Teacher1 | teacher1@example.com |
11     And the following "courses" exist:
12       | fullname | shortname | category |
13       | Course 1 | C1        | 0        |
14     And the following "course enrolments" exist:
15       | user     | course | role           |
16       | teacher1 | C1     | editingteacher |
17     And the following "question categories" exist:
18       | contextlevel | reference | name           |
19       | Course       | C1        | Test questions |
20     And the following "questions" exist:
21       | questioncategory | qtype     | name           | template |
22       | Test questions   | truefalse | true-false-001 | true     |
23     And I log in as "teacher1"
24     And I follow "Course 1"
26   @javascript
27   Scenario: Export a True/False question
28     When I navigate to "Export" node in "Course administration > Question bank"
29     And I set the field "id_format_xml" to "1"
30     And I press "Export questions to file"
31     Then following "click here" should download between "950" and "1050" bytes
32     # If the download step is the last in the scenario then we can sometimes run
33     # into the situation where the download page causes a http redirect but behat
34     # has already conducted its reset (generating an error). By putting a logout
35     # step we avoid behat doing the reset until we are off that page.
36     And I log out