diff --git a/src/addons/mod/lesson/tests/behat/numerical_decimal_separator-311.feature b/src/addons/mod/lesson/tests/behat/numerical_decimal_separator-311.feature new file mode 100755 index 000000000..f7f550f7b --- /dev/null +++ b/src/addons/mod/lesson/tests/behat/numerical_decimal_separator-311.feature @@ -0,0 +1,96 @@ +@mod @mod_lesson @app @javascript @lms_upto3.11 +Feature: Test decimal separators in lesson + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | teacher | teacher1@example.com | + | student1 | Student | student | student1@example.com | + 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 the following "activities" exist: + | activity | name | intro | course | idnumber | modattempts | review | maxattempts | retake | allowofflineattempts | + | lesson | Basic lesson | Basic lesson descr | C1 | lesson | 1 | 1 | 0 | 1 | 0 | + | lesson | Offline lesson | Offline lesson descr | C1 | lesson | 1 | 1 | 0 | 1 | 1 | + # Currently there are no generators for pages. See MDL-77581. + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Basic lesson" + And I follow "Add a question page" + And I set the field "Select a question type" to "Numerical" + And I press "Add a question page" + And I set the following fields to these values: + | Page title | Hardest question ever | + | Page contents | 1 + 1.87? | + | id_answer_editor_0 | 2.87 | + | id_response_editor_0 | Correct answer | + | id_jumpto_0 | End of lesson | + | id_score_0 | 1 | + | id_answer_editor_1 | 2.1:2.8 | + | id_response_editor_1 | Incorrect answer | + | id_jumpto_1 | This page | + | id_score_1 | 0 | + And I press "Save page" + And I am on "Course 1" course homepage + And I follow "Offline lesson" + And I follow "Add a question page" + And I set the field "Select a question type" to "Numerical" + And I press "Add a question page" + And I set the following fields to these values: + | Page title | Hardest question ever | + | Page contents | 1 + 1.87? | + | id_answer_editor_0 | 2.87 | + | id_response_editor_0 | Correct answer | + | id_jumpto_0 | End of lesson | + | id_score_0 | 1 | + | id_answer_editor_1 | 2.1:2.8 | + | id_response_editor_1 | Incorrect answer | + | id_jumpto_1 | This page | + | id_score_1 | 0 | + And I press "Save page" + And I log out + + # This scenario needs to be duplicated because of MDL-77550 + Scenario: Attempt an online lesson successfully as a student (custom separator) and review as teacher + Given the following "language customisations" exist: + | component | stringid | value | + | core_langconfig | decsep | , | + And the following config values are set as admin: + | customlangstrings | "core.decsep|,|en" | tool_mobile | + And I entered the course "Course 1" as "student1" in the app + And I press "Basic lesson" in the app + When I press "Start" in the app + Then I should find "1 + 1.87?" in the app + + When I set the field "Your answer" to "2,87" in the app + And I press "Submit" in the app + Then I should find "Correct answer" in the app + And I should find "2.87" in the app + And I should not find "Incorrect answer" in the app + + When I press "Continue" in the app + Then I should find "Congratulations - end of lesson reached" in the app + And I should find "Your score is 1 (out of 1)." in the app + + When I press "Review lesson" in the app + Then the field "Your answer" matches value "2,87" in the app + + When I press the back button in the app + And I press "Start" in the app + And I set the field "Your answer" to "2.87" in the app + And I press "Submit" in the app + Then I should find "Correct answer" in the app + And I should find "2.87" in the app + And I should not find "Incorrect answer" in the app + + When I press "Continue" in the app + Then I should find "Congratulations - end of lesson reached" in the app + And I should find "Your score is 1 (out of 1)." in the app + + When I press "Review lesson" in the app + Then the field "Your answer" matches value "2,87" in the app diff --git a/src/addons/mod/lesson/tests/behat/numerical_decimal_separator.feature b/src/addons/mod/lesson/tests/behat/numerical_decimal_separator.feature index 1484b9960..2991ffe3b 100755 --- a/src/addons/mod/lesson/tests/behat/numerical_decimal_separator.feature +++ b/src/addons/mod/lesson/tests/behat/numerical_decimal_separator.feature @@ -76,6 +76,7 @@ Feature: Test decimal separators in lesson Then I should find "Congratulations - end of lesson reached" in the app And I should find "Your score is 1 (out of 1)." in the app + @lms_from4.0 Scenario: Attempt an online lesson successfully as a student (custom separator) and review as teacher Given the following "language customisations" exist: | component | stringid | value | @@ -102,8 +103,7 @@ Feature: Test decimal separators in lesson When I press the back button in the app And I press "Start" in the app - And I set the following fields to these values in the app: - | Your answer | 2.87 | + And I set the field "Your answer" to "2.87" in the app And I press "Submit" in the app Then I should find "Correct answer" in the app And I should find "2,87" in the app @@ -178,9 +178,9 @@ Feature: Test decimal separators in lesson And I press the back button in the app Then I should find "An offline attempt was synchronised" in the app - When I press "Start" in the app - And I set the following fields to these values in the app: - | Your answer | 2.87 | + When I switch network connection to offline + And I press "Start" in the app + And I set the field "Your answer" to "2.87" in the app And I press "Submit" in the app Then I should find "Correct answer" in the app And I should find "2,87" in the app