From 51434146e45470da004ca6109e52c3eba67a3533 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Sun, 14 Apr 2013 13:03:27 +0800 Subject: [PATCH] MDL-38948 behat: New test According to MDLQA-76, a teacher can set a time limit for a lesson activity. --- mod/lesson/tests/behat/time_limit.feature | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 mod/lesson/tests/behat/time_limit.feature diff --git a/mod/lesson/tests/behat/time_limit.feature b/mod/lesson/tests/behat/time_limit.feature new file mode 100644 index 00000000000..5375190d2f5 --- /dev/null +++ b/mod/lesson/tests/behat/time_limit.feature @@ -0,0 +1,48 @@ +@mod_lesson @mod +Feature: A teacher can set a time limit for a lesson + In order to restrict the time students have to complete a lesson + As a moodle teacher + I need to set a time limit + + @javascript + Scenario: Accessing as student to a lesson with time limit + Given the following "users" exists: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@asd.com | + | student1 | Student | 1 | student1@asd.com | + And the following "courses" exists: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exists: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And I log in as "teacher1" + And I follow "Course 1" + And I turn editing mode on + And I add a "Lesson" to section "1" and I fill the form with: + | Name | Test lesson | + | timed | 1 | + | maxtime | 1 | + And I follow "Test lesson" + And I follow "Add a content page" + And I fill the moodle form with: + | Page title | Lesson page name | + | Page contents | Single lesson page contents | + | Description | Single button | + And I press "Save page" + And I log out + And I log in as "student1" + And I follow "Course 1" + When I follow "Test lesson" + Then I should see "You have 1 minute(s) to finish the lesson." + And I wait "3" seconds + And I should see "Time remaining" + And I press "Single button" + And I should see " 0:00:" + And I should see "Warning: You have 1 minute or less to finish the lesson." + And I wait "60" seconds + And I press "Single button" + And I should see "Attention: You ran out of time for this lesson. Your last answer may not have counted if it was answered after the time was up." + And I should see "Congratulations - end of lesson reached" + And I should not see "Single lesson page contents" -- 2.11.4.GIT