1 |
efrain |
1 |
@mod @mod_h5pactivity @core_h5p @_file_upload @_switch_iframe
|
|
|
2 |
Feature: Do a H5P attempt
|
|
|
3 |
In order to let students do a H5P attempt
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to list students attempts on various reports
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "permission overrides" exist:
|
|
|
20 |
| capability | permission | role | contextlevel | reference |
|
|
|
21 |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
|
|
|
22 |
And the following "activity" exists:
|
|
|
23 |
| activity | h5pactivity |
|
|
|
24 |
| course | C1 |
|
|
|
25 |
| name | Awesome H5P package |
|
|
|
26 |
| packagefilepath | h5p/tests/fixtures/multiple-choice-2-6.h5p |
|
|
|
27 |
| grademethod | 2 |
|
|
|
28 |
|
|
|
29 |
Scenario: View an H5P as a teacher
|
|
|
30 |
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as teacher1
|
|
|
31 |
Then I should see "You are in preview mode."
|
|
|
32 |
|
|
|
33 |
@javascript
|
|
|
34 |
Scenario: Do an attempt and check on course log report
|
|
|
35 |
When I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
|
|
|
36 |
And I should not see "You are in preview mode."
|
|
|
37 |
And I switch to "h5p-player" class iframe
|
|
|
38 |
And I switch to "h5p-iframe" class iframe
|
|
|
39 |
And I click on "Correct one" "text" in the ".h5p-question-content" "css_element"
|
|
|
40 |
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
41 |
And I switch to the main frame
|
|
|
42 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
43 |
And I navigate to course participants
|
|
|
44 |
And I follow "Student 1"
|
|
|
45 |
Then I follow "Today's logs"
|
|
|
46 |
And I should see "xAPI statement received"
|
|
|
47 |
|
|
|
48 |
@javascript
|
|
|
49 |
Scenario: Do various attempts and check them with the attempts and user grades reports
|
|
|
50 |
Given I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
|
|
|
51 |
And I should not see "You are in preview mode."
|
|
|
52 |
And I switch to "h5p-player" class iframe
|
|
|
53 |
And I switch to "h5p-iframe" class iframe
|
|
|
54 |
And I click on "Wrong one" "text" in the ".h5p-question-content" "css_element"
|
|
|
55 |
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
56 |
And I click on "Retry" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
57 |
# We need to wait 1 second here because, in very quick environments, the 2nd
|
|
|
58 |
# attempts happen too close to the 1st one and it's not sent properly. See MDL-76010.
|
|
|
59 |
And I wait "1" seconds
|
|
|
60 |
And I click on "Correct one" "text" in the ".h5p-question-content" "css_element"
|
|
|
61 |
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
62 |
# H5P does not allow to Retry if the user checks the correct answer, we need to refresh the page.
|
|
|
63 |
And I switch to the main frame
|
|
|
64 |
And I reload the page
|
|
|
65 |
And I switch to "h5p-player" class iframe
|
|
|
66 |
And I switch to "h5p-iframe" class iframe
|
|
|
67 |
# Because of the steps above, the 2nd and 3rd attempts are enough "separated" and we don't
|
|
|
68 |
# need to add any wait here.
|
|
|
69 |
And I click on "Wrong one" "text" in the ".h5p-question-content" "css_element"
|
|
|
70 |
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
71 |
And I click on "Retry" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
72 |
# Again, the wait between 3rd and 4th attempt, to separate them a little bit.
|
|
|
73 |
And I wait "1" seconds
|
|
|
74 |
And I click on "Correct one" "text" in the ".h5p-question-content" "css_element"
|
|
|
75 |
And I click on "Check" "button" in the ".h5p-question-buttons" "css_element"
|
|
|
76 |
And I switch to the main frame
|
|
|
77 |
When I navigate to "Attempts report" in current page administration
|
|
|
78 |
And "1" row "Score" column of "table" table should contain "0"
|
|
|
79 |
And "2" row "Score" column of "table" table should contain "1"
|
|
|
80 |
And "3" row "Score" column of "table" table should contain "0"
|
|
|
81 |
And "4" row "Score" column of "table" table should contain "1"
|
|
|
82 |
And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
|
|
|
83 |
And I click on "Student 1" in the "user" search widget
|
|
|
84 |
Then the following should exist in the "user-grade" table:
|
|
|
85 |
| Grade item | Grade | Percentage |
|
|
|
86 |
| Awesome H5P package | 50.00 | 50.00 % |
|