Skip to content

Commit

Permalink
MOBILE-4069 scorm: Add availability tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Oct 9, 2023
1 parent 7c16d58 commit f9e31e5
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/addons/mod/scorm/tests/behat/availability.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@mod @mod_scorm @app @javascript
Feature: Test availability options of SCORM activity in app
Only open SCORMs should be allowed to be played

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | teacher | teacher1@example.com |
| student1 | Student | student | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name | packagefilepath | timeopen | timeclose |
| scorm | C1 | Past SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##-2 days## | ##yesterday## |
| scorm | C1 | Current SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##yesterday## | ##tomorrow## |
| scorm | C1 | Future SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##tomorrow## | ##+2 days## |

Scenario: Only open SCORMs can be played
Given I entered the course "Course 1" as "student1" in the app
When I press "Past SCORM" in the app
Then I should find "Sorry, this activity closed on ## yesterday ##%A, %d %B %Y, %I:%M %p## and is no longer available" in the app
And I should find "## -2 days ##%d %B %Y, %I:%M %p##" near "Opened:" in the app
And I should find "## yesterday ##%d %B %Y, %I:%M %p##" near "Closed:" in the app
And I should not be able to press "Enter" in the app

When I press the back button in the app
And I press "Current SCORM" in the app
Then I should find "## yesterday ##%d %B %Y, %I:%M %p##" near "Opened:" in the app
And I should find "## tomorrow ##%d %B %Y, %I:%M %p##" near "Closes:" in the app
And I should be able to press "Enter" in the app

When I press the back button in the app
And I press "Future SCORM" in the app
Then I should find "Sorry, this activity is not available until ## tomorrow ##%A, %d %B %Y, %I:%M %p##" in the app
And I should find "## tomorrow ##%d %B %Y, %I:%M %p##" near "Opens:" in the app
And I should find "## +2days ##%d %B %Y, %I:%M %p##" near "Closes:" in the app
And I should not be able to press "Enter" in the app

0 comments on commit f9e31e5

Please sign in to comment.