<commit_before>@mod @mod_lesson
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 teacher
  I need to set a time limit

  @javascript
  Scenario: Accessing as student to a lesson with time limit
    Given the following "users" exist:
      | username | firstname | lastname | email |
      | teacher1 | Teacher | 1 | <EMAIL> |
      | student1 | Student | 1 | <EMAIL> |
    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 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 |
      | Description | Test lesson description |
      | timelimit | 60 |
    And I follow "Test lesson"
    And I follow "Add a content page"
    And I set the following fields to these values:
      | 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 "You ran out of time for this lesson."
    And I should see "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"<commit_msg>MDL-48962 mod_lesson: Fixed behat with new timeout setting and string<commit_after>@mod @mod_lesson
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 teacher
  I need to set a time limit

  @javascript
  Scenario: Accessing as student to a lesson with time limit
    Given the following "users" exist:
      | username | firstname | lastname | email |
      | teacher1 | Teacher | 1 | <EMAIL> |
      | student1 | Student | 1 | <EMAIL> |
    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 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 |
      | Description | Test lesson description |
      | timelimit[enabled] | 1 |
      | timelimit[timeunit] | 60 |
      | timelimit[number]   | 1  |
    And I follow "Test lesson"
    And I follow "Add a content page"
    And I set the following fields to these values:
      | 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 min 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 "You ran out of time for this lesson."
    And I should see "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"
{'fraction_non_alphanumeric': 0.06640625, 'fraction_numerical': 0.014404296875, 'mean_word_length': 2.550259965337955, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5438624', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1151, 'n_words': 608}