MDL-74057 behat: SCORM behat generators use UI

Replace steps that manually add SCORM instances via the UI and use
Behat generators. This improves the speed of Behat test runs.
This commit is contained in:
Angelia Dela Cruz
2022-07-25 18:01:00 +08:00
parent 940e4da0fa
commit df62f09a4c
3 changed files with 33 additions and 109 deletions
@@ -16,22 +16,9 @@ Feature: Scorm multi-sco review mode.
@javascript
Scenario: Test review mode with a single sco completion.
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Enable completion tracking | Yes |
And I press "Save and display"
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Basic Multi-sco SCORM package |
| Description | Description |
| Force new attempt | No |
And I set the field "Completed" to "1"
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "Basic Multi-sco SCORM package"
And I log out
When the following "activities" exist:
| activity | course | name | packagefilepath | forcenewattempt |
| scorm | C1 | Basic Multi-sco SCORM package | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip | 0 |
And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1
And I should see "Normal"
And I press "Enter"
@@ -48,24 +35,9 @@ Feature: Scorm multi-sco review mode.
@javascript
Scenario: Test review mode with all scos completed.
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Enable completion tracking | Yes |
And I press "Save and display"
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | ADV Multi-sco SCORM package |
| Description | Description |
| Completion tracking | Show activity as complete when conditions are met |
| Require all scos to return completion status | 1 |
| Force new attempt | No |
And I set the field "Completed" to "1"
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "ADV Multi-sco SCORM package"
And I log out
When the following "activities" exist:
| activity | course | name | packagefilepath | forcenewattempt |
| scorm | C1 | ADV Multi-sco SCORM package | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12.zip | 0 |
And I am on the "ADV Multi-sco SCORM package" "scorm activity" page logged in as student1
And I should see "Normal"
And I press "Enter"
@@ -167,17 +139,9 @@ Feature: Scorm multi-sco review mode.
@javascript
Scenario: Test force completed set to Always.
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Basic Multi-sco SCORM package |
| Description | Description |
| Force new attempt | Always |
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "Basic Multi-sco SCORM package"
And I log out
When the following "activities" exist:
| activity | course | name | packagefilepath | forcenewattempt |
| scorm | C1 | Basic Multi-sco SCORM package | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip | 2 |
And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1
And I should see "Normal"
And I press "Enter"
@@ -197,17 +161,9 @@ Feature: Scorm multi-sco review mode.
@javascript
Scenario: Test force completed set to when previous complete/passed/failed.
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Basic Multi-sco SCORM package |
| Description | Description |
| Force new attempt | When previous attempt completed, passed or failed |
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "Basic Multi-sco SCORM package"
And I log out
When the following "activities" exist:
| activity | course | name | packagefilepath | forcenewattempt |
| scorm | C1 | Basic Multi-sco SCORM package | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip | 1 |
And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1
And I should see "Normal"
And I press "Enter"
@@ -272,18 +228,9 @@ Feature: Scorm multi-sco review mode.
@javascript
Scenario: Test force completed set to Always and student skipview
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Basic Multi-sco SCORM package |
| Description | Description |
| Force new attempt | Always |
| Student skip content structure page | Always |
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "Basic Multi-sco SCORM package"
And I log out
When the following "activities" exist:
| activity | course | name | packagefilepath | forcenewattempt | skipview |
| scorm | C1 | Basic Multi-sco SCORM package | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip | 2 | 2 |
And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1
And I switch to "scorm_object" iframe
And I should see "Play of the game"
@@ -298,18 +245,9 @@ Feature: Scorm multi-sco review mode.
@javascript
Scenario: Test force completed set to when previous complete/passed/failed.
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Basic Multi-sco SCORM package |
| Description | Description |
| Force new attempt | When previous attempt completed, passed or failed |
| Student skip content structure page | Always |
And I upload "mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "Basic Multi-sco SCORM package"
And I log out
When the following "activities" exist:
| activity | course | name | packagefilepath | forcenewattempt | skipview |
| scorm | C1 | Basic Multi-sco SCORM package | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip | 1 | 2 |
And I am on the "Basic Multi-sco SCORM package" "scorm activity" page logged in as student1
And I switch to "scorm_object" iframe
And I should see "Play of the game"
@@ -364,3 +302,4 @@ Feature: Scorm multi-sco review mode.
Then I should not see "Review mode"
And I switch to "scorm_object" iframe
And I should see "Play of the game"
@@ -19,16 +19,11 @@ Feature: Confirm progress gets saved on unload events
@javascript
Scenario: Test progress gets saved correctly when the user navigates away from the scorm activity
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Runtime Basic Calls SCORM 2004 3rd Edition package |
| Description | Description |
And I upload "mod/scorm/tests/packages/RuntimeBasicCalls_SCORM20043rdEdition.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I should see "Runtime Basic Calls SCORM 2004 3rd Edition package"
And I log out
Given the following "activity" exists:
| activity | scorm |
| course | C1 |
| name | Runtime Basic Calls SCORM 2004 3rd Edition package |
| packagefilepath | mod/scorm/tests/packages/RuntimeBasicCalls_SCORM20043rdEdition.zip |
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Runtime Basic Calls SCORM 2004 3rd Edition package"
@@ -14,6 +14,13 @@ Feature: Scorm with no calendar capabilites
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | scorm |
| course | C1 |
| name | Test scorm name |
| timeopen | ##first day of January 2017## |
| timeclose | ##first day of February 2017## |
| packagefilepath | mod/scorm/tests/packages/singlesco_scorm12.zip |
And I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
@@ -24,25 +31,8 @@ Feature: Scorm with no calendar capabilites
@javascript @_file_upload @_switch_iframe
Scenario: Editing a scorm activity without calendar permission
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "SCORM package" to section "1"
And I set the following fields to these values:
| Name | Test scorm name |
| Description | Test scorm description |
| id_timeopen_enabled | 1 |
| id_timeopen_day | 1 |
| id_timeopen_month | 1 |
| id_timeopen_year | 2017 |
| id_timeclose_enabled | 1 |
| id_timeclose_day | 1 |
| id_timeclose_month | 2 |
| id_timeclose_year | 2017 |
And I upload "mod/scorm/tests/packages/singlesco_scorm12.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I log out
When I am on the "Test scorm name" "scorm activity editing" page logged in as teacher1
And I set the following fields to these values:
Given I am on the "Test scorm name" "scorm activity editing" page logged in as teacher1
When I set the following fields to these values:
| id_timeopen_year | 2018 |
| id_timeclose_year | 2018 |
And I press "Save and return to course"