1 |
efrain |
1 |
@mod @mod_questionnaire
|
|
|
2 |
Feature: Display a progress bar at the top of a questionnaire
|
|
|
3 |
When a student answers a questionnaire with multiple pages the progress bar will fill up as they go
|
|
|
4 |
|
|
|
5 |
Background:
|
|
|
6 |
Given the following "users" exist:
|
|
|
7 |
| username | firstname | lastname | email |
|
|
|
8 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
9 |
| student1 | Student | 1 | student1@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | category |
|
|
|
12 |
| Course 1 | C1 | 0 |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| teacher1 | C1 | editingteacher |
|
|
|
16 |
| student1 | C1 | student |
|
|
|
17 |
|
|
|
18 |
@javascript
|
|
|
19 |
Scenario: Progress bar should fill depending on progress through the pages
|
|
|
20 |
Given the following "activities" exist:
|
|
|
21 |
| activity | name | description | course | idnumber | resume | navigate | progressbar |
|
|
|
22 |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 1 |
|
|
|
23 |
And I log in as "teacher1"
|
|
|
24 |
And I am on "Course 1" course homepage
|
|
|
25 |
And I follow "Test questionnaire"
|
|
|
26 |
And I navigate to "Questions" in current page administration
|
|
|
27 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
28 |
| Question Name | Q1 |
|
|
|
29 |
| Yes | y |
|
|
|
30 |
| Question Text | Do you like questions? |
|
|
|
31 |
And I add a "Numeric" question and I fill the form with:
|
|
|
32 |
| Question Name | Q2 |
|
|
|
33 |
| No | y |
|
|
|
34 |
| Question Text | Are you sure? |
|
|
|
35 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
36 |
| Question Name | Q3 |
|
|
|
37 |
| Yes | y |
|
|
|
38 |
| Question Text | Would you like to answer another question? |
|
|
|
39 |
| id_dependquestions_and_0 | Q1->Yes |
|
|
|
40 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
41 |
| Question Name | Q4 |
|
|
|
42 |
| Yes | y |
|
|
|
43 |
| Question Text | Is that enough questions? |
|
|
|
44 |
| id_dependquestions_and_0 | Q3->Yes |
|
|
|
45 |
And I log out
|
|
|
46 |
And I log in as "student1"
|
|
|
47 |
And I am on "Course 1" course homepage
|
|
|
48 |
And I follow "Test questionnaire"
|
|
|
49 |
When I navigate to "Answer the questions..." in current page administration
|
|
|
50 |
Then I should see "0%" in the "#questionnaire-progressbar-percent" "css_element"
|
|
|
51 |
And I click on "Yes" "radio"
|
|
|
52 |
When I press "Next Page >>"
|
|
|
53 |
Then I should see "50%" in the "#questionnaire-progressbar-percent" "css_element"
|
|
|
54 |
And I click on "Yes" "radio"
|
|
|
55 |
When I press "Next Page >>"
|
|
|
56 |
Then I should see "75%" in the "#questionnaire-progressbar-percent" "css_element"
|
|
|
57 |
When I press "<< Previous Page"
|
|
|
58 |
Then I should see "50%" in the "#questionnaire-progressbar-percent" "css_element"
|
|
|
59 |
|
|
|
60 |
Scenario: Progress bar should not display on a single page questionnaire
|
|
|
61 |
Given the following "activities" exist:
|
|
|
62 |
| activity | name | description | course | idnumber | resume | navigate | progressbar |
|
|
|
63 |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 1 |
|
|
|
64 |
And I log in as "teacher1"
|
|
|
65 |
And I am on "Course 1" course homepage
|
|
|
66 |
And I follow "Test questionnaire"
|
|
|
67 |
And I navigate to "Questions" in current page administration
|
|
|
68 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
69 |
| Yes | y |
|
|
|
70 |
| Question Text | Do you like questions? |
|
|
|
71 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
72 |
| Yes | y |
|
|
|
73 |
| Question Text | Do you really like questions? |
|
|
|
74 |
And I log out
|
|
|
75 |
And I log in as "student1"
|
|
|
76 |
And I am on "Course 1" course homepage
|
|
|
77 |
And I follow "Test questionnaire"
|
|
|
78 |
When I navigate to "Answer the questions..." in current page administration
|
|
|
79 |
Then ".questionnaire-progressbar" "css_element" should not exist
|
|
|
80 |
|
|
|
81 |
Scenario: Progress bar should not display if turned off in settings
|
|
|
82 |
Given the following "activities" exist:
|
|
|
83 |
| activity | name | description | course | idnumber | resume | navigate | progressbar |
|
|
|
84 |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | 1 | 1 | 0 |
|
|
|
85 |
And I log in as "teacher1"
|
|
|
86 |
And I am on "Course 1" course homepage
|
|
|
87 |
And I follow "Test questionnaire"
|
|
|
88 |
And I navigate to "Questions" in current page administration
|
|
|
89 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
90 |
| Question Name | Q1 |
|
|
|
91 |
| Yes | y |
|
|
|
92 |
| Question Text | Do you like questions? |
|
|
|
93 |
And I add a "Yes/No" question and I fill the form with:
|
|
|
94 |
| Question Name | Q2 |
|
|
|
95 |
| Yes | y |
|
|
|
96 |
| Question Text | Do you really like questions? |
|
|
|
97 |
| id_dependquestions_and_0 | Q1->Yes |
|
|
|
98 |
And I log out
|
|
|
99 |
And I log in as "student1"
|
|
|
100 |
And I am on "Course 1" course homepage
|
|
|
101 |
And I follow "Test questionnaire"
|
|
|
102 |
When I navigate to "Answer the questions..." in current page administration
|
|
|
103 |
Then ".questionnaire-progressbar" "css_element" should not exist
|