diff --git a/mod/lesson/tests/behat/completion_condition_time_spent.feature b/mod/lesson/tests/behat/completion_condition_time_spent.feature index 821b152b9c1..43576a5e87d 100644 --- a/mod/lesson/tests/behat/completion_condition_time_spent.feature +++ b/mod/lesson/tests/behat/completion_condition_time_spent.feature @@ -4,7 +4,6 @@ Feature: Set time spent as a completion condition for a lesson As a teacher I need to set time spent to mark the lesson activity as completed - @javascript Scenario: Set time spent as a condition Given the following "users" exist: | username | firstname | lastname | email | @@ -31,8 +30,8 @@ Feature: Set time spent as a completion condition for a lesson | Description | Test lesson description | | Completion tracking | Show activity as complete when conditions are met | | completiontimespentenabled | 1 | - | completiontimespent[timeunit] | 60 | - | completiontimespent[number] | 1 | + | completiontimespent[timeunit] | 1 | + | completiontimespent[number] | 10 | And I follow "Test lesson" And I follow "Add a content page" And I set the following fields to these values: @@ -56,15 +55,17 @@ Feature: Set time spent as a completion condition for a lesson Then the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete And I follow "Test lesson" And I press "Next page" + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "Next page" And I should see "You completed this lesson in" - And I should see ", which is less than the required time of 1 min. You might need to attempt the lesson again." + And I should see ", which is less than the required time of 10 secs. You might need to attempt the lesson again." And I follow "Course 1" And the "Test lesson" "lesson" activity with "auto" completion should be marked as not complete And I follow "Course 1" And I follow "Test lesson" And I press "Next page" - And I wait "61" seconds + And I wait "11" seconds And I press "Next page" And I should not see "You might need to attempt the lesson again." And I follow "Course 1" diff --git a/mod/lesson/tests/behat/date_availability.feature b/mod/lesson/tests/behat/date_availability.feature index a730490aa1c..c94eda39669 100644 --- a/mod/lesson/tests/behat/date_availability.feature +++ b/mod/lesson/tests/behat/date_availability.feature @@ -20,11 +20,10 @@ Feature: A teacher can set available from and deadline dates to access a lesson And I follow "Course 1" And I turn editing mode on - @javascript Scenario: Forbidding lesson accesses until a specified date Given I add a "Lesson" to section "1" And I expand all fieldsets - And I click on "id_available_enabled" "checkbox" + And I set the field "id_available_enabled" to "1" And I set the following fields to these values: | Name | Test lesson | | Description | Test lesson description | @@ -48,11 +47,9 @@ Feature: A teacher can set available from and deadline dates to access a lesson Then I should see "This lesson will be open on Wednesday, 1 January 2020, 8:00" And I should not see "First page contents" - @javascript Scenario: Forbidding lesson accesses until a specified date Given I add a "Lesson" to section "1" - And I expand all fieldsets - And I click on "id_deadline_enabled" "checkbox" + And I set the field "id_deadline_enabled" to "1" And I set the following fields to these values: | Name | Test lesson | | Description | Test lesson description | diff --git a/mod/lesson/tests/behat/lesson_student_resume.feature b/mod/lesson/tests/behat/lesson_student_resume.feature index 34a0cf88213..946c5905513 100644 --- a/mod/lesson/tests/behat/lesson_student_resume.feature +++ b/mod/lesson/tests/behat/lesson_student_resume.feature @@ -25,7 +25,6 @@ Feature: In a lesson activity a student should And I press "Save and return to course" And I follow "Test lesson name" - @javascript Scenario: resume a lesson with both content then question pages Given I follow "Add a content page" And I set the following fields to these values: @@ -34,7 +33,7 @@ Feature: In a lesson activity a student should | id_answer_editor_0 | Next page | | id_jumpto_0 | Next page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -47,7 +46,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -60,7 +59,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Third page name | | Page contents | Third page contents | @@ -69,7 +68,7 @@ Feature: In a lesson activity a student should | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Second page name | | Page contents | Second page contents | @@ -84,6 +83,8 @@ Feature: In a lesson activity a student should And I follow "Test lesson name" And I should see "First page contents" And I press "Next page" + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I should see "Second page contents" And I press "Next page" And I should see "Third page contents" @@ -92,6 +93,8 @@ Feature: In a lesson activity a student should And I should see "Do you want to start at the last page you saw?" And I follow "Yes" Then I should see "Third page contents" + # Add 1 sec delay so lesson knows differentiate 3rd and paper attempts. + And I wait "1" seconds And I press "Next page" And I should see "Paper is made from trees." And I follow "Test lesson name" @@ -115,7 +118,6 @@ Feature: In a lesson activity a student should And I press "Continue" And I should see "Congratulations - end of lesson reached" - @javascript Scenario: resume a lesson with only content pages Given I follow "Add a content page" And I set the following fields to these values: @@ -124,7 +126,7 @@ Feature: In a lesson activity a student should | id_answer_editor_0 | Next page | | id_jumpto_0 | Next page | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Fourth page name | | Page contents | Fourth page contents | @@ -133,7 +135,7 @@ Feature: In a lesson activity a student should | id_answer_editor_1 | End of lesson | | id_jumpto_1 | End of lesson | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Third page name | | Page contents | Third page contents | @@ -142,7 +144,7 @@ Feature: In a lesson activity a student should | id_answer_editor_1 | Next page | | id_jumpto_1 | Next page | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Second page name | | Page contents | Second page contents | @@ -158,6 +160,8 @@ Feature: In a lesson activity a student should And I should see "First page contents" And I press "Next page" And I should see "Second page contents" + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "Next page" And I should see "Third page contents" And I follow "Test lesson name" @@ -167,6 +171,8 @@ Feature: In a lesson activity a student should And I should see "Third page contents" And I press "Next page" And I should see "Fourth page contents" + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "End of lesson" And I log out And I log in as "student1" @@ -175,7 +181,6 @@ Feature: In a lesson activity a student should And I should see "First page contents" And I log out - @javascript Scenario: resume a lesson with both question then content pages Given I follow "Add a question page" And I set the field "Select a question type" to "True/false" @@ -190,7 +195,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -203,14 +208,14 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Content page 2 | | Page contents | Second content page | | id_answer_editor_0 | Next page | | id_jumpto_0 | Next page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -223,7 +228,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -236,7 +241,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -249,7 +254,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Add a content page" + And I select "Add a content page" from the "qtype" singleselect And I set the following fields to these values: | Page title | Content page 1 | | Page contents | First content page | @@ -275,6 +280,8 @@ Feature: In a lesson activity a student should And I should see "1+1=2" And I set the following fields to these values: | True | 1 | + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "Submit" And I press "Continue" And I should see "2+2=4" @@ -285,6 +292,8 @@ Feature: In a lesson activity a student should And I should see "2+2=4" And I set the following fields to these values: | True | 1 | + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "Submit" And I press "Continue" And I should see "Second content page" @@ -301,7 +310,6 @@ Feature: In a lesson activity a student should And I press "Continue" And I should see "Congratulations - end of lesson reached" - @javascript Scenario: resume a lesson with only question pages Given I follow "Add a question page" And I set the field "Select a question type" to "True/false" @@ -316,7 +324,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -329,7 +337,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -342,7 +350,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -355,7 +363,7 @@ Feature: In a lesson activity a student should | id_response_editor_1 | Wrong | | id_jumpto_1 | This page | And I press "Save page" - And I set the field "qtype" to "Question" + And I select "Question" from the "qtype" singleselect And I set the field "Select a question type" to "True/false" And I press "Add a question page" And I set the following fields to these values: @@ -385,6 +393,8 @@ Feature: In a lesson activity a student should And I should see "1+1=2" And I set the following fields to these values: | True | 1 | + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "Submit" And I press "Continue" And I should see "2+2=4" @@ -395,6 +405,8 @@ Feature: In a lesson activity a student should And I should see "2+2=4" And I set the following fields to these values: | True | 1 | + # Add 1 sec delay so lesson knows a valid attempt has been made in past. + And I wait "1" seconds And I press "Submit" And I press "Continue" And I should see "Kermit is a frog"