From 81ff190dfba15aa8cc25fd1a9f30d3df78134505 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Tue, 20 Dec 2022 16:34:02 +0800 Subject: [PATCH] MDL-76653 behat: add coverage for SCORM availability --- .../tests/behat/scorm_availability.feature | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 mod/scorm/tests/behat/scorm_availability.feature diff --git a/mod/scorm/tests/behat/scorm_availability.feature b/mod/scorm/tests/behat/scorm_availability.feature new file mode 100644 index 00000000000..d0eb7d9c253 --- /dev/null +++ b/mod/scorm/tests/behat/scorm_availability.feature @@ -0,0 +1,44 @@ +@mod @mod_scorm +Feature: Scorm availability + In order to control when a SCORM activity is available to students + As a teacher + I need be able to set availability dates for the SCORM + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | 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 | ##yesterday## | ##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## | ##tomorrow## | + + Scenario: Scorm activity with dates in the past should not be available. + When I am on the "Past SCORM" "scorm activity" page logged in as "student1" + Then the activity date in "Past SCORM" should contain "Opened:" + And the activity date in "Past SCORM" should contain "##yesterday noon##%A, %d %B %Y, %I:%M##" + And the activity date in "Past SCORM" should contain "Closed:" + And the activity date in "Past SCORM" should contain "##yesterday noon##%A, %d %B %Y, %I:%M##" + And "Enter" "button" should not exist + And I should not see "Preview" + And I am on the "Current SCORM" "scorm activity" page + And the activity date in "Current SCORM" should contain "Opened:" + And the activity date in "Current SCORM" should contain "##yesterday noon##%A, %d %B %Y, %I:%M##" + And the activity date in "Current SCORM" should contain "Closes:" + And the activity date in "Current SCORM" should contain "##tomorrow noon##%A, %d %B %Y, %I:%M##" + And "Enter" "button" should exist + And I should see "Preview" + And I am on the "Future SCORM" "scorm activity" page + And the activity date in "Future SCORM" should contain "Opens:" + And the activity date in "Future SCORM" should contain "##tomorrow noon##%A, %d %B %Y, %I:%M##" + And the activity date in "Future SCORM" should contain "Closes:" + And the activity date in "Future SCORM" should contain "##tomorrow noon##%A, %d %B %Y, %I:%M##" + And "Enter" "button" should not exist + And I should not see "Preview"