MDL-71016 gradeexport_xml: ensure user/grade idnumbers are encoded.
[moodle.git] / grade / export / xml / tests / behat / export.feature
CommitLineData
8023a71b
DW
1@gradeexport @gradeexport_xml
2Feature: I need to export grades as xml
3 In order to easily review marks
4 As a teacher
5 I need to have a export grades as xml
6
7 Background:
8 Given the following "courses" exist:
9 | fullname | shortname | category | groupmode |
10 | Course 1 | C1 | 0 | 1 |
11 And the following "users" exist:
12 | username | firstname | lastname | email | idnumber |
0fe86bbd
RT
13 | teacher1 | Teacher | 1 | teacher1@example.com | t1 |
14 | student1 | Student | 1 | student1@example.com | s1 |
0bda2849 15 | student2 | Student | 2 | student2@example.com | 'Bill'&"Ben"<tag>Hello</tag> |
8023a71b
DW
16 And the following "course enrolments" exist:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 | student1 | C1 | student |
0bda2849 20 | student2 | C1 | student |
8023a71b
DW
21 And the following "activities" exist:
22 | activity | course | idnumber | name | intro |
23 | assign | C1 | a1 | Test assignment name | Submit something! |
24 And I log in as "teacher1"
fdeeaff9 25 And I am on "Course 1" course homepage
44f460c3 26 And I navigate to "View > Grader report" in the course gradebook
8023a71b
DW
27 And I turn editing mode on
28 And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name"
0bda2849 29 And I give the grade "42.00" to the user "Student 2" for the grade item "Test assignment name"
cc413422 30 And I press "Save changes"
8023a71b 31
8cd07ed0 32 @javascript
0bda2849 33 Scenario: Export grades as XML
44f460c3 34 When I navigate to "Export > XML file" in the course gradebook
8023a71b 35 And I expand all fieldsets
a9245888 36 And I set the field "Grade export decimal places" to "1"
8023a71b 37 And I press "Download"
0bda2849
PH
38 Then I should see "s1" in the "//results//result[1]//student" "xpath_element"
39 And I should see "a1" in the "//results//result[1]//assignment" "xpath_element"
40 And I should see "80.0" in the "//results//result[1]//score" "xpath_element"
41 And I should not see "80.00" in the "//results//result[1]//score" "xpath_element"
42 # Ensure we have the encoded ID number of student 2.
43 And I should see "'Bill'&\"Ben\"<tag>Hello</tag>" in the "//results//result[2]//student" "xpath_element"
44 And I should see "a1" in the "//results//result[2]//assignment" "xpath_element"
45 And I should see "42.0" in the "//results//result[2]//score" "xpath_element"
46 And I should not see "42.00" in the "//results//result[2]//score" "xpath_element"