From f9e31e5d387b09683e18b50d5253ba518777f019 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 9 Oct 2023 11:20:04 +0200 Subject: [PATCH] MOBILE-4069 scorm: Add availability tests --- .../scorm/tests/behat/availability.feature | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 src/addons/mod/scorm/tests/behat/availability.feature diff --git a/src/addons/mod/scorm/tests/behat/availability.feature b/src/addons/mod/scorm/tests/behat/availability.feature new file mode 100755 index 000000000..fb459aa0a --- /dev/null +++ b/src/addons/mod/scorm/tests/behat/availability.feature @@ -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