Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe @javascript
2
Feature: Users can save the current state of an H5P activity
3
  In order to continue an H5P activity where I left
4
  As a user
5
  I need to be able to save the current state
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | student1 | Student   | 1        | student1@example.com |
11
      | student2 | Student   | 2        | student2@example.com |
12
      | teacher1 | Teacher   | 1        | teacher1@example.com |
13
    And the following "course" exists:
14
      | fullname  | Course 1 |
15
      | shortname | C1       |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | student1 | C1     | student        |
19
      | student2 | C1     | student        |
20
      | teacher1 | C1     | editingteacher |
21
    And the following "permission overrides" exist:
22
      | capability                 | permission | role           | contextlevel | reference |
23
      | moodle/h5p:updatelibraries | Allow      | editingteacher | System       |           |
24
    And the following "activity" exists:
25
      | activity        | h5pactivity                             |
26
      | course          | C1                                      |
27
      | name            | Awesome H5P package                     |
28
      | packagefilepath | h5p/tests/fixtures/filltheblanks.h5p    |
29
 
30
  Scenario: Content state is not saved when enablesavestate is disabled
31
    Given the following config values are set as admin:
32
      | enablesavestate | 0 | mod_h5pactivity|
33
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
34
    And I switch to "h5p-player" class iframe
35
    And I switch to "h5p-iframe" class iframe
36
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
37
    And I switch to the main frame
38
    And I am on the "Course 1" course page
39
    When I am on the "Awesome H5P package" "h5pactivity activity" page
40
    And I switch to "h5p-player" class iframe
41
    And I switch to "h5p-iframe" class iframe
42
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
43
 
44
  Scenario: Content state is saved when enablesavestate is enabled
45
    Given the following config values are set as admin:
46
      | enablesavestate | 1 | mod_h5pactivity|
47
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
48
    And I switch to "h5p-player" class iframe
49
    And I switch to "h5p-iframe" class iframe
50
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
51
    And I switch to the main frame
52
    And I am on the "Course 1" course page
53
    When I am on the "Awesome H5P package" "h5pactivity activity" page
54
    And I switch to "h5p-player" class iframe
55
    And I switch to "h5p-iframe" class iframe
56
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Narnia"
57
 
58
  Scenario: Content state is not saved for teachers when enablesavestate is enabled
59
    Given the following config values are set as admin:
60
      | enablesavestate | 1 | mod_h5pactivity|
61
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as teacher1
62
    And I switch to "h5p-player" class iframe
63
    And I switch to "h5p-iframe" class iframe
64
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
65
    And I switch to the main frame
66
    And I am on the "Course 1" course page
67
    When I am on the "Awesome H5P package" "h5pactivity activity" page
68
    And I switch to "h5p-player" class iframe
69
    And I switch to "h5p-iframe" class iframe
70
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
71
 
72
  Scenario: Content state is reseted when content changes
73
    Given the following config values are set as admin:
74
      | enablesavestate | 1 | mod_h5pactivity|
75
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
76
    And I switch to "h5p-player" class iframe
77
    And I switch to "h5p-iframe" class iframe
78
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
79
    And I switch to the main frame
80
    And I am on the "Course 1" course page
81
    When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as admin
82
    # Change the content.
83
    And I follow "Edit H5P content"
84
    And I switch to "h5p-editor-iframe" class iframe
85
    And I set the field "Title" to "Capitals"
86
    And I switch to the main frame
87
    And I click on "Save changes" "button"
88
    And I switch to "h5p-player" class iframe
89
    And I switch to "h5p-iframe" class iframe
90
    And I should see "Check"
91
    # Check the content state has been reseted.
92
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
93
    And I switch to "h5p-player" class iframe
94
    And I switch to "h5p-iframe" class iframe
95
    Then I should see "Data Reset"
96
    And I should see "This content has changed since you last used it."
97
    And I click on "OK" "button"
98
    And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
99
 
100
  Scenario: Content state is not reseted when content edition is cancelled
101
    Given the following config values are set as admin:
102
      | enablesavestate | 1 | mod_h5pactivity|
103
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
104
    And I switch to "h5p-player" class iframe
105
    And I switch to "h5p-iframe" class iframe
106
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
107
    And I switch to the main frame
108
    And I am on the "Course 1" course page
109
    When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as admin
110
    # Start content edition.
111
    And I follow "Edit H5P content"
112
    And I switch to "h5p-editor-iframe" class iframe
113
    And I set the field "Title" to "Capitals"
114
    And I switch to the main frame
115
    And I click on "Cancel" "button"
116
    And I switch to "h5p-player" class iframe
117
    And I switch to "h5p-iframe" class iframe
118
    And I should see "Check"
119
    # Check the content state hasn't been reseted.
120
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
121
    And I should see "Awesome H5P package"
122
    And I switch to "h5p-player" class iframe
123
    And I switch to "h5p-iframe" class iframe
124
    Then I should not see "Data Reset"
125
    And I should not see "This content has changed since you last used it."
126
    And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Narnia"
127
 
128
  Scenario: Content state is removed when an attempt is created
129
    Given the following config values are set as admin:
130
      | enablesavestate | 1 | mod_h5pactivity|
131
    # Save state content for student2, to check this data is not removed when student1 finishes their attempt.
132
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2
133
    And I switch to "h5p-player" class iframe
134
    And I switch to "h5p-iframe" class iframe
135
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Vallhonesta"
136
    # Confirm the content state has been saved properly.
137
    And I reload the page
138
    And I switch to "h5p-player" class iframe
139
    And I switch to "h5p-iframe" class iframe
140
    And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Vallhonesta"
141
    # Create an attempt for student1.
142
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
143
    And I should not see "Attempts report"
144
    When I switch to "h5p-player" class iframe
145
    And I switch to "h5p-iframe" class iframe
146
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
147
    And I click on "Check" "button"
148
    # Check the state content has been removed.
149
    And I reload the page
150
    Then I should see "Attempts report"
151
    And I am on the "Awesome H5P package" "h5pactivity activity" page
152
    And I switch to "h5p-player" class iframe
153
    And I switch to "h5p-iframe" class iframe
154
    And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
155
    And I switch to the main frame
156
    # Check the state content for student2 is still there.
157
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student2
158
    And I switch to "h5p-player" class iframe
159
    And I switch to "h5p-iframe" class iframe
160
    And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Vallhonesta"