1 |
efrain |
1 |
@block @block_dash
|
|
|
2 |
Feature: Add My Groups widget in dash block
|
|
|
3 |
In order to enable the contacts widgets in dash block on the dashboard
|
|
|
4 |
As an admin
|
|
|
5 |
I can add the dash block to the dashboard
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "categories" exist:
|
|
|
9 |
| name | category | idnumber |
|
|
|
10 |
| Category 1 | 0 | CAT1 |
|
|
|
11 |
| Category 2 | 0 | CAT2 |
|
|
|
12 |
| Category 3 | CAT2 | CAT3 |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category | enablecompletion |
|
|
|
15 |
| Course 1 | C1 | 0 | 1 |
|
|
|
16 |
| Course 2 | C2 | CAT1 | 0 |
|
|
|
17 |
| Course 3 | C3 | CAT2 | 1 |
|
|
|
18 |
| Course 4 | C4 | CAT3 | 1 |
|
|
|
19 |
And the following "users" exist:
|
|
|
20 |
| username | firstname | lastname | email |
|
|
|
21 |
| student1 | Student | First | student1@example.com |
|
|
|
22 |
| student2 | Student | Two | student2@example.com |
|
|
|
23 |
| student3 | Student | Three | student3@example.com |
|
|
|
24 |
| student4 | Student | Four | student4@example.com |
|
|
|
25 |
| student5 | Student | Five | student5@example.com |
|
|
|
26 |
| teacher1 | Teacher | First | teacher1@example.com |
|
|
|
27 |
| manager | Max | Manager | man@example.com |
|
|
|
28 |
And the following "role assigns" exist:
|
|
|
29 |
| user | role | contextlevel | reference |
|
|
|
30 |
| manager | manager | System | |
|
|
|
31 |
And the following "course enrolments" exist:
|
|
|
32 |
| user | course | role |
|
|
|
33 |
| manager | C1 | manager |
|
|
|
34 |
| manager | C2 | manager |
|
|
|
35 |
| manager | C3 | manager |
|
|
|
36 |
| manager | C4 | manager |
|
|
|
37 |
| student1 | C1 | student |
|
|
|
38 |
| student2 | C1 | student |
|
|
|
39 |
| student1 | C2 | student |
|
|
|
40 |
| student2 | C2 | student |
|
|
|
41 |
| student1 | C3 | student |
|
|
|
42 |
| student2 | C3 | student |
|
|
|
43 |
| student3 | C2 | student |
|
|
|
44 |
|
|
|
45 |
And the following "groups" exist:
|
|
|
46 |
| name | course | idnumber | enablemessaging |
|
|
|
47 |
| Group C1 1 | C1 | G1 | 1 |
|
|
|
48 |
| Group C1 2 | C1 | G2 | 1 |
|
|
|
49 |
| Group C2 1 | C2 | G3 | 1 |
|
|
|
50 |
And the following "group members" exist:
|
|
|
51 |
| user | group |
|
|
|
52 |
| student1 | G1 |
|
|
|
53 |
| student2 | G1 |
|
|
|
54 |
| student1 | G2 |
|
|
|
55 |
| student1 | G3 |
|
|
|
56 |
| manager | G1 |
|
|
|
57 |
| manager | G2 |
|
|
|
58 |
|
|
|
59 |
And I log in as "admin"
|
|
|
60 |
And I navigate to "Appearance > Default Dashboard page" in site administration
|
|
|
61 |
And I turn dash block editing mode on
|
|
|
62 |
And I add the "Dash" block
|
|
|
63 |
And I click on "My groups" "radio"
|
|
|
64 |
And I configure the "New Dash" block
|
|
|
65 |
And I set the following fields to these values:
|
|
|
66 |
| Block title | My groups |
|
|
|
67 |
| Region | content |
|
|
|
68 |
And I press "Save changes"
|
|
|
69 |
And I click on "Reset Dashboard for all users" "button"
|
|
|
70 |
And I log out
|
|
|
71 |
|
|
|
72 |
@javascript
|
|
|
73 |
Scenario: User groups widget in Dash Block
|
|
|
74 |
Given I log in as "student1"
|
|
|
75 |
And I should see "Group C1 1" in the "My groups" "block"
|
|
|
76 |
And I should see "Group C2 1" in the "My groups" "block"
|
|
|
77 |
Then the "title" attribute of ".block_dash-community-block .list-block:nth-child(1) img" "css_element" should contain "Max Manager"
|
|
|
78 |
And I click on ".dropdown-toggle" "css_element" in the ".block_dash-community-block .list-block:nth-child(1)" "css_element"
|
|
|
79 |
And I click on ".group-widget-viewmembers" "css_element" in the ".block_dash-community-block .list-block:nth-child(1)" "css_element"
|
|
|
80 |
And "Student Two" "table_row" should exist
|
|
|
81 |
And I click on ".close" "css_element" in the ".modal-header" "css_element"
|
|
|
82 |
And I click on ".dropdown-toggle" "css_element" in the ".block_dash-community-block .list-block:nth-child(3)" "css_element"
|
|
|
83 |
And I click on ".group-widget-viewmembers" "css_element" in the ".block_dash-community-block .list-block:nth-child(3)" "css_element"
|
|
|
84 |
Then I should see "Nothing to display" in the ".modal-body h2" "css_element"
|
|
|
85 |
|
|
|
86 |
@javascript
|
|
|
87 |
Scenario: Leave group using dash block
|
|
|
88 |
Given I log in as "student1"
|
|
|
89 |
And I should see "Group C2 1" in the "My groups" "block"
|
|
|
90 |
And I click on ".dropdown-toggle" "css_element" in the ".block_dash-community-block .list-block:nth-child(3)" "css_element"
|
|
|
91 |
And I click on ".group-widget-leavegroup" "css_element" in the ".block_dash-community-block .list-block:nth-child(3)" "css_element"
|
|
|
92 |
And I should see "Do you really want to leave the group Group C2 1" in the ".modal-body" "css_element"
|
|
|
93 |
And I click on "Confirm" "button"
|
|
|
94 |
And I should not see "Group C2 1" in the "My groups" "block"
|
|
|
95 |
|
|
|
96 |
@javascript
|
|
|
97 |
Scenario: Add User to existing group using dash block
|
|
|
98 |
Given I log in as "manager"
|
|
|
99 |
And I should see "Group C1 2" in the "My groups" "block"
|
|
|
100 |
And I click on ".dropdown-toggle" "css_element" in the ".block_dash-community-block .list-block:nth-child(2)" "css_element"
|
|
|
101 |
And I click on ".add-group-users" "css_element" in the ".block_dash-community-block .list-block:nth-child(2)" "css_element"
|
|
|
102 |
And I set the following fields to these values:
|
|
|
103 |
| User | Student Two |
|
|
|
104 |
And I click on "Save changes" "button" in the ".modal-footer" "css_element"
|
|
|
105 |
Then the "title" attribute of ".block_dash-community-block .list-block:nth-child(2) .img-block:nth-child(2) img" "css_element" should contain "Student Two"
|
|
|
106 |
And I click on ".dropdown-toggle" "css_element" in the ".block_dash-community-block .list-block:nth-child(2)" "css_element"
|
|
|
107 |
And I click on ".group-widget-viewmembers" "css_element" in the ".block_dash-community-block .list-block:nth-child(2)" "css_element"
|
|
|
108 |
And "Student Two" "table_row" should exist
|
|
|
109 |
|
|
|
110 |
@javascript
|
|
|
111 |
Scenario: Create a new group using dash block
|
|
|
112 |
Given I log in as "manager"
|
|
|
113 |
And I should not see "Group C4 1" in the "My groups" "block"
|
|
|
114 |
And I click on ".dropdown-toggle" "css_element" in the ".edit-block" "css_element"
|
|
|
115 |
And I click on ".create-group" "css_element" in the ".edit-block" "css_element"
|
|
|
116 |
And I set the following fields to these values:
|
|
|
117 |
| Group name | Group C4 1 |
|
|
|
118 |
And I open the autocomplete suggestions list
|
|
|
119 |
And I click on "Course 4" item in the autocomplete list
|
|
|
120 |
And I click on "Save changes" "button" in the ".modal-footer" "css_element"
|
|
|
121 |
And I should see "Group C4 1" in the "My groups" "block"
|