1 |
efrain |
1 |
@core @core_badges @javascript
|
|
|
2 |
Feature: Test tertiary navigation as various users
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| student1 | Student | 1 | student1@example.com |
|
|
|
8 |
| teacher | Teacher | 1 | teacher@example.com |
|
|
|
9 |
| nonediting | Nonediting | 1 | nonediting@example.com |
|
|
|
10 |
And the following "courses" exist:
|
|
|
11 |
| fullname | shortname | format | enablecompletion |
|
|
|
12 |
| Course 1 | C1 | topics | 1 |
|
|
|
13 |
And the following "course enrolments" exist:
|
|
|
14 |
| user | course | role |
|
|
|
15 |
| teacher | C1 | editingteacher |
|
|
|
16 |
| student1 | C1 | student |
|
|
|
17 |
| nonediting | C1 | teacher |
|
|
|
18 |
# Create a course badge in our test course.
|
|
|
19 |
And the following "core_badges > Badge" exists:
|
|
|
20 |
| name | Testing course badge |
|
|
|
21 |
| status | inactive |
|
|
|
22 |
| type | 2 |
|
|
|
23 |
| course | C1 |
|
|
|
24 |
| version | 1.1 |
|
|
|
25 |
| language | ca |
|
|
|
26 |
| description | Testing course badge description |
|
|
|
27 |
| image | badges/tests/behat/badge.png |
|
|
|
28 |
| imageauthorurl | http://author.example.com |
|
|
|
29 |
| imagecaption | Test caption image |
|
|
|
30 |
# Create a site badge.
|
|
|
31 |
And the following "core_badges > Badge" exists:
|
|
|
32 |
| name | Testing site badge |
|
|
|
33 |
| status | inactive |
|
|
|
34 |
| version | 1.1 |
|
|
|
35 |
| language | ca |
|
|
|
36 |
| description | Testing site badge description |
|
|
|
37 |
| image | badges/tests/behat/badge.png |
|
|
|
38 |
| imageauthorurl | http://author.example.com |
|
|
|
39 |
| imagecaption | Test caption image |
|
|
|
40 |
And the following "core_badges > Criterias" exist:
|
|
|
41 |
| badge | role |
|
|
|
42 |
| Testing course badge | editingteacher |
|
|
|
43 |
| Testing site badge | editingteacher |
|
|
|
44 |
|
|
|
45 |
Scenario Outline: Check navigation as different users in a course context
|
|
|
46 |
Given I log in as "<user>"
|
|
|
47 |
And I am on "Course 1" course homepage
|
|
|
48 |
When I navigate to "Badges" in current page administration
|
|
|
49 |
Then "Manage badges" "button" should exist
|
|
|
50 |
And "Add a new badge" "button" <createbutton>
|
|
|
51 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
52 |
And I click on "Manage badges" "button"
|
|
|
53 |
And "Manage badges" "button" should not exist
|
|
|
54 |
And "Back" "button" should exist
|
|
|
55 |
And "Add a new badge" "button" <createbutton>
|
|
|
56 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
57 |
And I click on "Back" "button"
|
|
|
58 |
And "Back" "button" should not exist
|
|
|
59 |
And "Manage badges" "button" should exist
|
|
|
60 |
And "Add a new badge" "button" <createbutton>
|
|
|
61 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
62 |
And I click on "Manage badges" "button"
|
|
|
63 |
And I click on "Testing course badge" "link"
|
|
|
64 |
And "Manage badges" "button" should not exist
|
|
|
65 |
And "Add a new badge" "button" should not exist
|
|
|
66 |
And "Back" "button" should exist
|
|
|
67 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
68 |
And I click on "Back" "button"
|
|
|
69 |
And "Back" "button" should exist
|
|
|
70 |
And "Manage badges" "button" should not exist
|
|
|
71 |
And "Add a new badge" "button" <createbutton>
|
|
|
72 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
73 |
|
|
|
74 |
Examples:
|
|
|
75 |
| user | createbutton | activetab |
|
|
|
76 |
| admin | should exist | More |
|
|
|
77 |
| teacher | should exist | More |
|
|
|
78 |
| nonediting | should not exist | Badges |
|
|
|
79 |
|
|
|
80 |
Scenario: Check navigation as a student
|
|
|
81 |
Given I am on the "C1" "Course" page logged in as "student1"
|
|
|
82 |
And "Badges" "link" should not exist in current page administration
|
|
|
83 |
And I log out
|
|
|
84 |
# Enable one badge.
|
|
|
85 |
When I am on the "C1" "Course" page logged in as "admin"
|
|
|
86 |
And I navigate to "Badges" in current page administration
|
|
|
87 |
And I click on "Manage badges" "button"
|
|
|
88 |
And I press "Enable access" action in the "Testing course badge" report row
|
|
|
89 |
And I press "Continue"
|
|
|
90 |
And I log out
|
|
|
91 |
# Now student should see the Badges link.
|
|
|
92 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
93 |
Then "Badges" "link" should exist in current page administration
|
|
|
94 |
And I navigate to "Badges" in current page administration
|
|
|
95 |
And "Back" "button" should not exist
|
|
|
96 |
And "Manage badges" "button" should not exist
|
|
|
97 |
And "Add a new badge" "button" should not exist
|
|
|
98 |
And I should see "Badges" is active in secondary navigation
|
|
|
99 |
|
|
|
100 |
Scenario: Check navigation as an admin in a site context
|
|
|
101 |
Given I log in as "admin"
|
|
|
102 |
When I navigate to "Badges > Manage badges" in site administration
|
|
|
103 |
Then "Manage badges" "button" should not exist
|
|
|
104 |
And "Add a new badge" "button" should exist
|
|
|
105 |
And I should see "General" is active in secondary navigation
|
|
|
106 |
And I click on "Testing site badge" "link"
|
|
|
107 |
And "Manage badges" "button" should not exist
|
|
|
108 |
And "Add a new badge" "button" should not exist
|
|
|
109 |
And "Back" "button" should exist
|
|
|
110 |
And I should see "General" is active in secondary navigation
|
|
|
111 |
And I click on "Back" "button"
|
|
|
112 |
And "Back" "button" should not exist
|
|
|
113 |
And "Manage badges" "button" should not exist
|
|
|
114 |
And "Add a new badge" "button" should exist
|
|
|
115 |
|
|
|
116 |
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in site admin
|
|
|
117 |
Given I log in as "admin"
|
|
|
118 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
119 |
And I click on "Testing site badge" "link"
|
|
|
120 |
When I select "<option>" from the "jump" singleselect
|
|
|
121 |
Then I should see "General" is active in secondary navigation
|
|
|
122 |
|
|
|
123 |
Examples:
|
|
|
124 |
| option |
|
|
|
125 |
| Overview |
|
|
|
126 |
| Edit details |
|
|
|
127 |
| Criteria |
|
|
|
128 |
| Message |
|
|
|
129 |
| Recipients (0) |
|
|
|
130 |
| Endorsement |
|
|
|
131 |
| Related badges (0) |
|
|
|
132 |
| Alignments (0) |
|
|
|
133 |
|
|
|
134 |
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in course as admin
|
|
|
135 |
Given I log in as "admin"
|
|
|
136 |
And I am on "Course 1" course homepage
|
|
|
137 |
And I navigate to "Badges" in current page administration
|
|
|
138 |
And I click on "Manage badges" "button"
|
|
|
139 |
And I click on "Testing course badge" "link"
|
|
|
140 |
When I select "<option>" from the "jump" singleselect
|
|
|
141 |
Then I should see "More" is active in secondary navigation
|
|
|
142 |
|
|
|
143 |
Examples:
|
|
|
144 |
| option |
|
|
|
145 |
| Overview |
|
|
|
146 |
| Edit details |
|
|
|
147 |
| Criteria |
|
|
|
148 |
| Message |
|
|
|
149 |
| Recipients (0) |
|
|
|
150 |
| Endorsement |
|
|
|
151 |
| Related badges (0) |
|
|
|
152 |
| Alignments (0) |
|