Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_backup @core_h5p @mod_h5pactivity @_switch_iframe @javascript
2
Feature: Backup xAPI states
3
  In order to save and restore xAPI states
4
  As an admin
5
  I need to create backups with xAPI states and restore them
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | student1 | Student   | 1        | student1@example.com |
11
    And the following "course" exists:
12
      | fullname  | Course 1 |
13
      | shortname | C1       |
14
    And the following "course enrolments" exist:
15
      | user     | course | role           |
16
      | student1 | C1     | student        |
17
    And the following "activity" exists:
18
      | activity        | h5pactivity                             |
19
      | course          | C1                                      |
20
      | name            | Awesome H5P package                     |
21
      | packagefilepath | h5p/tests/fixtures/filltheblanks.h5p    |
22
    And the following config values are set as admin:
23
      | enableasyncbackup | 0 |
24
    # Save state for the student user.
25
    And I am on the "Awesome H5P package" "h5pactivity activity" page logged in as student1
26
    And I switch to "h5p-player" class iframe
27
    And I switch to "h5p-iframe" class iframe
28
    And I set the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" to "Narnia"
29
    And I switch to the main frame
30
    And I am on the "Course 1" course page
31
    And I am on the "Awesome H5P package" "h5pactivity activity" page
32
    And I switch to "h5p-player" class iframe
33
    And I switch to "h5p-iframe" class iframe
34
    And the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Narnia"
35
    And I log out
36
 
37
  Scenario: Content state is backup/restored when user data is included
38
    # Backup and restore the course.
39
    Given I log in as "admin"
40
    And I backup "Course 1" course using this options:
41
      | Confirmation | Filename | test_backup.mbz |
42
    And I restore "test_backup.mbz" backup into a new course using this options:
43
      | Settings | Include enrolled users | 1        |
44
      | Schema   | User data              | 1        |
45
      | Schema   | Course name            | Course 2 |
46
      | Schema   | Course short name      | C2       |
47
    # Login as student and confirm xAPI state has been restored.
48
    When I am on the "Course 2" course page logged in as student1
49
    And I click on "Awesome H5P package" "link" in the "region-main" "region"
50
    And I switch to "h5p-player" class iframe
51
    And I switch to "h5p-iframe" class iframe
52
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" matches value "Narnia"
53
 
54
  Scenario: Content state is not restored when user data is not included in the backup
55
    # Backup course without user data and then restore it.
56
    When I log in as "admin"
57
    And I backup "Course 1" course using this options:
58
      | Initial      | Include enrolled users | 0               |
59
      | Confirmation | Filename               | test_backup.mbz |
60
    And I restore "test_backup.mbz" backup into a new course using this options:
61
      | Schema   | Course name            | Course 2 |
62
      | Schema   | Course short name      | C2       |
63
    # Enrol student to the new course.
64
    And the following "course enrolments" exist:
65
      | user     | course | role           |
66
      | student1 | C2     | student        |
67
    # Login as student and confirm xAPI state hasn't been restored.
68
    And I am on the "Course 2" course page logged in as student1
69
    And I click on "Awesome H5P package" "link" in the "region-main" "region"
70
    And I switch to "h5p-player" class iframe
71
    And I switch to "h5p-iframe" class iframe
72
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
73
 
74
  Scenario: Content state is not restored when user data is included in the backup but xAPI state is not restored
75
    # Backup with user data and restore it without user data the course.
76
    Given I log in as "admin"
77
    And I backup "Course 1" course using this options:
78
      | Confirmation | Filename | test_backup.mbz |
79
    And I restore "test_backup.mbz" backup into a new course using this options:
80
      | Settings | Include user's state in content such as H5P activities  | 0        |
81
      | Schema   | Course name                                             | Course 2 |
82
      | Schema   | Course short name                                       | C2       |
83
    # Login as student and confirm xAPI state hasn't been restored.
84
    When I am on the "Course 2" course page logged in as student1
85
    And I click on "Awesome H5P package" "link" in the "region-main" "region"
86
    And I switch to "h5p-player" class iframe
87
    And I switch to "h5p-iframe" class iframe
88
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"
89
 
90
  Scenario: Content state is not restored when it is not included explicitly in the backup
91
    # Backup course with user data but without xAPI state and then restore it.
92
    When I log in as "admin"
93
    And I backup "Course 1" course using this options:
94
      | Initial      | Include user's state in content such as H5P activities  | 0               |
95
      | Confirmation | Filename                                                | test_backup.mbz |
96
    And I restore "test_backup.mbz" backup into a new course using this options:
97
      | Schema   | Course name            | Course 2 |
98
      | Schema   | Course short name      | C2       |
99
    And I should see "Awesome H5P package"
100
    # Login as student and confirm xAPI state hasn't been restored.
101
    And I am on the "Course 2" course page logged in as student1
102
    And I click on "Awesome H5P package" "link" in the "region-main" "region"
103
    And I switch to "h5p-player" class iframe
104
    And I switch to "h5p-iframe" class iframe
105
    Then the field with xpath "//input[contains(@aria-label,\"Blank input 1 of 4\")]" does not match value "Narnia"