1
1
@mod @mod_questionnaire
2
- Feature : In questionnaire, we can add a question requiring a file upload .
2
+ Feature : Add a question requiring a file upload in questionnaire .
3
+ In order to use this plugin
4
+ As a teacher
5
+ I need to add a a file question to a questionnaire created in my course
6
+ and a student answers to it. Then the file has to be accessible.
3
7
4
8
Background :
5
9
Given the following "users" exist:
6
- | username | firstname | lastname | email |
7
- | teacher1 | Teacher | 1 | teacher1 @example .com |
8
- | student1 | Student | 1 | student1 @example .com |
10
+ | username | firstname | lastname | email |
11
+ | teacher1 | Teacher | 1 | teacher1 @example .com |
12
+ | student1 | Student | 1 | student1 @example .com |
9
13
And the following "courses" exist:
10
14
| fullname | shortname | category |
11
- | Course 1 | C1 | 0 |
15
+ | Course 1 | C1 | 0 |
12
16
And the following "course enrolments" exist:
13
- | user | course | role |
14
- | teacher1 | C1 | editingteacher |
15
- | student1 | C1 | student |
17
+ | user | course | role |
18
+ | teacher1 | C1 | editingteacher |
19
+ | student1 | C1 | student |
16
20
And the following "activities" exist:
17
- | activity | name | description | course | idnumber | resume | navigate |
18
- | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 |
21
+ | activity | name | description | course | idnumber | resume | navigate |
22
+ | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 |
19
23
20
24
@javascript @_file_upload
21
- Scenario : As a teacher, I create a questionnaire in my course with a file question and a student answers to it. Then the file has to be accessible .
25
+ Scenario : Add a single file question to a questionnaire and view an answer with an uploaded file .
22
26
Given I log in as "teacher1"
23
27
When I am on the "Test questionnaire" "questionnaire activity" page
24
28
And I navigate to "Questions" in current page administration
25
29
And I should see "Add questions"
26
30
And I add a "File" question and I fill the form with:
27
- | Question Name | File question |
28
- | Yes | Yes |
31
+ | Question Name | File question |
32
+ | Yes | Yes |
29
33
| Question Text | Add a file as an answer |
30
34
And I log out
31
35
And I log in as "student1"
32
36
And I am on the "Test questionnaire" "questionnaire activity" page
33
37
And I navigate to "Answer the questions..." in current page administration
34
- And I upload "mod/questionnaire/tests/fixtures/testfilequestion.pdf" to questionnaire filemanager
38
+ And I upload "mod/questionnaire/tests/fixtures/testfilequestion.pdf" to questionnaire "Add a file as an answer" filemanager
35
39
And I press "Submit questionnaire"
36
40
And I should see "Thank you for completing this Questionnaire"
37
41
And I press "Continue"
@@ -42,3 +46,35 @@ Feature: In questionnaire, we can add a question requiring a file upload.
42
46
And I am on the "Test questionnaire" "questionnaire activity" page
43
47
And I navigate to "View all responses" in current page administration
44
48
Then I should see "testfilequestion.pdf"
49
+
50
+ @javascript @_file_upload
51
+ Scenario : Add two file questions to a questionnaire and view an answer with two uploaded file.
52
+ Given I log in as "teacher1"
53
+ When I am on the "Test questionnaire" "questionnaire activity" page
54
+ And I navigate to "Questions" in current page administration
55
+ And I should see "Add questions"
56
+ And I add a "File" question and I fill the form with:
57
+ | Question Name | File question one |
58
+ | Yes | Yes |
59
+ | Question Text | Add a first file as an answer |
60
+ And I add a "File" question and I fill the form with:
61
+ | Question Name | File question two |
62
+ | Yes | Yes |
63
+ | Question Text | Add a second file as an answer |
64
+ And I log out
65
+ And I log in as "student1"
66
+ And I am on the "Test questionnaire" "questionnaire activity" page
67
+ And I navigate to "Answer the questions..." in current page administration
68
+ And I upload "mod/questionnaire/tests/fixtures/testfilequestion.pdf" to questionnaire "Add a first file as an answer" filemanager
69
+ And I upload "mod/questionnaire/tests/fixtures/testfilequestion2.pdf" to questionnaire "Add a second file as an answer" filemanager
70
+ And I press "Submit questionnaire"
71
+ And I should see "Thank you for completing this Questionnaire"
72
+ And I press "Continue"
73
+ And I should see "View your response(s)"
74
+ And ".resourcecontent.resourcepdf" "css_element" should exist
75
+ And I log out
76
+ And I log in as "teacher1"
77
+ And I am on the "Test questionnaire" "questionnaire activity" page
78
+ And I navigate to "View all responses" in current page administration
79
+ Then I should see "testfilequestion.pdf"
80
+ And I should see "testfilequestion2.pdf"
0 commit comments