Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@block @block_online_users
2
Feature: The online users block allow you to see who is currently online
3
  In order to enable the online users block on an course page
4
  As a teacher
5
  I can add the online users block to a course page
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | category |
10
      | Course 1 | C1        | 0        |
11
    And the following "users" exist:
12
      | username | firstname | lastname | email                |
13
      | teacher1 | Teacher   | 1        | teacher1@example.com |
14
      | student1 | Student   | 1        | student1@example.com |
15
      | student2 | Student   | 2        | student2@example.com |
16
 
17
    And the following "course enrolments" exist:
18
      | user | course | role           |
19
      | teacher1 | C1 | editingteacher |
20
      | student1 | C1 | student        |
21
 
22
  Scenario: Add the online users on course page and see myself
23
    Given I log in as "teacher1"
24
    And I am on "Course 1" course homepage with editing mode on
25
    When I add the "Online users" block
26
    Then I should see "Teacher 1" in the "Online users" "block"
27
    And I should see "1 online user" in the "Online users" "block"
28
 
29
  Scenario: Add the online users on course page and see other logged in users
30
    Given I log in as "teacher1"
31
    And I am on "Course 1" course homepage with editing mode on
32
    And I add the "Online users" block
33
    And I log out
34
    And I log in as "student2"
35
    And I log out
36
    When I log in as "student1"
37
    And I am on "Course 1" course homepage
38
    Then I should see "Teacher 1" in the "Online users" "block"
39
    And I should see "Student 1" in the "Online users" "block"
40
    And I should not see "Student 2" in the "Online users" "block"
41
    And I should see "2 online users" in the "Online users" "block"
42
 
43
  @javascript
44
  Scenario: Hide/show user's online status from/to other users in the online users block on course page
45
    Given the following config values are set as admin:
46
      | block_online_users_onlinestatushiding | 1 |
47
    And I log in as "teacher1"
48
    And I am on "Course 1" course homepage with editing mode on
49
    And I add the "Online users" block
50
    And I log out
51
    When I log in as "student1"
52
    And I am on "Course 1" course homepage
53
    Then "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
54
    When I click on "#change-user-visibility" "css_element"
55
    And I wait "1" seconds
56
    Then "Show" "icon" should exist in the "#change-user-visibility" "css_element"
57
    And I log out
58
    When I log in as "teacher1"
59
    And I am on "Course 1" course homepage
60
    Then I should see "1 online user" in the "Online users" "block"
61
    And I should see "Teacher 1" in the "Online users" "block"
62
    And I should not see "Student 1" in the "Online users" "block"
63
    And I log out
64
    When I log in as "student1"
65
    And I am on "Course 1" course homepage
66
    Then "Show" "icon" should exist in the "#change-user-visibility" "css_element"
67
    When I click on "#change-user-visibility" "css_element"
68
    And I wait "1" seconds
69
    Then "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
70
    And I log out
71
    When I log in as "teacher1"
72
    And I am on "Course 1" course homepage
73
    Then I should see "2 online users" in the "Online users" "block"
74
    And I should see "Teacher 1" in the "Online users" "block"
75
    And I should see "Student 1" in the "Online users" "block"
76
 
77
  @javascript
78
  Scenario: Hide/show icon is not visible in the online users block on course page when the setting is disabled
79
    Given the following config values are set as admin:
80
      | block_online_users_onlinestatushiding | 1 |
81
    And I log in as "teacher1"
82
    And I am on "Course 1" course homepage with editing mode on
83
    And I add the "Online users" block
84
    And I log out
85
    And I log in as "student1"
86
    And I am on "Course 1" course homepage
87
    And "Hide" "icon" should exist in the ".block.block_online_users" "css_element"
88
    And I log out
89
    And the following config values are set as admin:
90
      | block_online_users_onlinestatushiding | 0 |
91
    When I log in as "student1"
92
    And I am on "Course 1" course homepage
93
    Then I should see "Student 1" in the "Online users" "block"
94
    And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
95
 
96
  @javascript
97
  Scenario: User is displayed in the online users block on course page when visibility setting is disabled,
98
            ignoring the previously set visibility state
99
    Given the following config values are set as admin:
100
      | block_online_users_onlinestatushiding | 1 |
101
    And I log in as "teacher1"
102
    And I am on "Course 1" course homepage with editing mode on
103
    And I add the "Online users" block
104
    And I log out
105
    And I log in as "student1"
106
    And I am on "Course 1" course homepage
107
    And "Hide" "icon" should exist in the "#change-user-visibility" "css_element"
108
    And I click on "#change-user-visibility" "css_element"
109
    And I wait "1" seconds
110
    And "Show" "icon" should exist in the "#change-user-visibility" "css_element"
111
    And I log out
112
    And the following config values are set as admin:
113
      | block_online_users_onlinestatushiding | 0 |
114
    And I log in as "teacher1"
115
    When I am on "Course 1" course homepage
116
    Then I should see "2 online users" in the "Online users" "block"
117
    And I should see "Teacher 1" in the "Online users" "block"
118
    And I should see "Student 1" in the "Online users" "block"