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 |
| imagecaption | Test caption image |
|
|
|
29 |
# Create a site badge.
|
|
|
30 |
And the following "core_badges > Badge" exists:
|
|
|
31 |
| name | Testing site badge |
|
|
|
32 |
| status | inactive |
|
|
|
33 |
| version | 1.1 |
|
|
|
34 |
| language | ca |
|
|
|
35 |
| description | Testing site badge description |
|
|
|
36 |
| image | badges/tests/behat/badge.png |
|
|
|
37 |
| imagecaption | Test caption image |
|
|
|
38 |
And the following "core_badges > Criterias" exist:
|
|
|
39 |
| badge | role |
|
|
|
40 |
| Testing course badge | editingteacher |
|
|
|
41 |
| Testing site badge | editingteacher |
|
|
|
42 |
|
|
|
43 |
Scenario Outline: Check navigation as different users in a course context
|
|
|
44 |
Given I log in as "<user>"
|
|
|
45 |
And I am on "Course 1" course homepage
|
|
|
46 |
When I navigate to "Badges" in current page administration
|
1441 |
ariadna |
47 |
Then "Add a new badge" "button" <createbutton>
|
1 |
efrain |
48 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
49 |
And "Back" "button" should not exist
|
|
|
50 |
And I click on "Testing course badge" "link"
|
|
|
51 |
And "Add a new badge" "button" should not exist
|
|
|
52 |
And "Back" "button" should exist
|
|
|
53 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
54 |
And I click on "Back" "button"
|
|
|
55 |
And "Add a new badge" "button" <createbutton>
|
|
|
56 |
And I should see "<activetab>" is active in secondary navigation
|
|
|
57 |
|
|
|
58 |
Examples:
|
|
|
59 |
| user | createbutton | activetab |
|
|
|
60 |
| admin | should exist | More |
|
|
|
61 |
| teacher | should exist | More |
|
1441 |
ariadna |
62 |
| nonediting | should not exist | More |
|
1 |
efrain |
63 |
|
|
|
64 |
Scenario: Check navigation as a student
|
|
|
65 |
Given I am on the "C1" "Course" page logged in as "student1"
|
|
|
66 |
And "Badges" "link" should not exist in current page administration
|
|
|
67 |
And I log out
|
|
|
68 |
# Enable one badge.
|
|
|
69 |
When I am on the "C1" "Course" page logged in as "admin"
|
|
|
70 |
And I navigate to "Badges" in current page administration
|
|
|
71 |
And I press "Enable access" action in the "Testing course badge" report row
|
1441 |
ariadna |
72 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
1 |
efrain |
73 |
And I log out
|
|
|
74 |
# Now student should see the Badges link.
|
|
|
75 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
76 |
Then "Badges" "link" should exist in current page administration
|
|
|
77 |
And I navigate to "Badges" in current page administration
|
|
|
78 |
And "Back" "button" should not exist
|
|
|
79 |
And "Add a new badge" "button" should not exist
|
|
|
80 |
And I should see "Badges" is active in secondary navigation
|
|
|
81 |
|
|
|
82 |
Scenario: Check navigation as an admin in a site context
|
|
|
83 |
Given I log in as "admin"
|
|
|
84 |
When I navigate to "Badges > Manage badges" in site administration
|
1441 |
ariadna |
85 |
Then "Add a new badge" "button" should exist
|
1 |
efrain |
86 |
And I should see "General" is active in secondary navigation
|
|
|
87 |
And I click on "Testing site badge" "link"
|
|
|
88 |
And "Add a new badge" "button" should not exist
|
|
|
89 |
And "Back" "button" should exist
|
|
|
90 |
And I should see "General" is active in secondary navigation
|
|
|
91 |
And I click on "Back" "button"
|
|
|
92 |
And "Back" "button" should not exist
|
|
|
93 |
And "Add a new badge" "button" should exist
|
|
|
94 |
|
|
|
95 |
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in site admin
|
|
|
96 |
Given I log in as "admin"
|
|
|
97 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
98 |
And I click on "Testing site badge" "link"
|
|
|
99 |
When I select "<option>" from the "jump" singleselect
|
|
|
100 |
Then I should see "General" is active in secondary navigation
|
|
|
101 |
|
|
|
102 |
Examples:
|
|
|
103 |
| option |
|
|
|
104 |
| Overview |
|
|
|
105 |
| Edit details |
|
|
|
106 |
| Criteria |
|
|
|
107 |
| Message |
|
|
|
108 |
| Recipients (0) |
|
|
|
109 |
| Endorsement |
|
|
|
110 |
| Related badges (0) |
|
|
|
111 |
| Alignments (0) |
|
|
|
112 |
|
|
|
113 |
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in course as admin
|
|
|
114 |
Given I log in as "admin"
|
|
|
115 |
And I am on "Course 1" course homepage
|
|
|
116 |
And I navigate to "Badges" in current page administration
|
|
|
117 |
And I click on "Testing course badge" "link"
|
|
|
118 |
When I select "<option>" from the "jump" singleselect
|
|
|
119 |
Then I should see "More" is active in secondary navigation
|
|
|
120 |
|
|
|
121 |
Examples:
|
|
|
122 |
| option |
|
|
|
123 |
| Overview |
|
|
|
124 |
| Edit details |
|
|
|
125 |
| Criteria |
|
|
|
126 |
| Message |
|
|
|
127 |
| Recipients (0) |
|
|
|
128 |
| Endorsement |
|
|
|
129 |
| Related badges (0) |
|
|
|
130 |
| Alignments (0) |
|