From f2970942952a29b961beef71530c1c5279cb78c6 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 2 Jul 2024 15:37:55 +0800 Subject: [PATCH] MDL-81296 mod_data: Behat test for data activity readonly availability --- .../data_activity_read_only_dates.feature | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 mod/data/tests/behat/data_activity_read_only_dates.feature diff --git a/mod/data/tests/behat/data_activity_read_only_dates.feature b/mod/data/tests/behat/data_activity_read_only_dates.feature new file mode 100644 index 00000000000..ec061bca754 --- /dev/null +++ b/mod/data/tests/behat/data_activity_read_only_dates.feature @@ -0,0 +1,33 @@ +@mod @mod_data +Feature: Control database activity entry based on read-only dates + In order to restrict or allow student entries based on specific dates + As a teacher + I need to be able to set read-only dates for the database activity + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@example.com | + And the following "courses" exist: + | fullname | shortname | + | Course 1 | C1 | + And the following "course enrolments" exist: + | user | course | role | + | student1 | C1 | student | + + Scenario Outline: Student can add entries only when the current date falls outside the read-only date range + Given the following "activities" exist: + | activity | course | name | idnumber | timeviewfrom | timeviewto | + | data | C1 | Data Activity 1 | DB1 | | | + And the following "mod_data > fields" exist: + | database | type | name | + | DB1 | text | DB Field 1 | + When I am on the "Data Activity 1" "data activity" page logged in as student1 + # The "Add entry" button is visible only when the current date falls outside the read-only date range. + Then "Add entry" "button" exist + + Examples: + | viewfrom | viewto | btnvisibility | + | ##yesterday## | ##tomorrow## | should not | + | ##tomorrow## | ##tomorrow +1day## | should | + | ##1 week ago## | ##yesterday## | should |