diff --git a/mod/assignment/tests/behat/app_basic_usage.feature b/mod/assignment/tests/behat/app_basic_usage.feature index 778cfe1ec..ecd892b82 100755 --- a/mod/assignment/tests/behat/app_basic_usage.feature +++ b/mod/assignment/tests/behat/app_basic_usage.feature @@ -1,4 +1,4 @@ -@mod @mod_assign @app @app_upto3.9.4 @javascript +@mod @mod_assign @app @javascript Feature: Test basic usage of assignment activity in app In order to participate in the assignment while using the mobile app I need basic assignment functionality to work @@ -19,7 +19,6 @@ Feature: Test basic usage of assignment activity in app | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | duedate | attemptreopenmethod | | assign | C1 | assign1 | assignment1 | Test assignment description1 | 1 | 1029844800 | manual | - @app @3.8.0 Scenario: View assign description, due date & View list of student submissions (as teacher) & View own submission or student submission # Create, edit and submit as a student When I enter the app @@ -27,27 +26,27 @@ Feature: Test basic usage of assignment activity in app And I press "Course 1" near "Recently accessed courses" in the app And I press "assignment1" in the app Then the header should be "assignment1" in the app - And I should see "Test assignment description1" - And I should see "Due date" - And I should see "Tuesday, 20 August 2002, 12:00 PM" + And I should find "Test assignment description1" in the app + And I should find "Due:" in the app + And I should find "20 August 2002, 12:00 PM" in the app When I press "Add submission" in the app And I set the field "Online text submissions" to "Submission test" in the app And I press "Save" in the app - Then I should see "Draft (not submitted)" - And I should see "Not graded" + Then I should find "Draft (not submitted)" in the app + And I should find "Not graded" in the app When I press "Edit submission" in the app And I set the field "Online text submissions" to "Submission test edited" in the app And I press "Save" in the app And I press "OK" in the app - Then I should see "Submission test edited" + Then I should find "Submission test edited" in the app When I press "Submit assignment" in the app And I press "OK" in the app - Then I should see "Submitted for grading" - And I should see "Not graded" - And I should see "Submission test edited" + Then I should find "Submitted for grading" in the app + And I should find "Not graded" in the app + And I should find "Submission test edited" in the app # View as a teacher When I enter the app @@ -57,14 +56,13 @@ Feature: Test basic usage of assignment activity in app Then the header should be "assignment1" in the app When I press "Submitted" in the app - Then I should see "Student student" - And I should see "Not graded" + Then I should find "Student student" in the app + And I should find "Not graded" in the app When I press "Student student" near "assignment1" in the app - Then I should see "Online text submissions" - And I should see "Submission test edited" + Then I should find "Online text submissions" in the app + And I should find "Submission test edited" in the app - @app @3.8.0 Scenario: Edit/Add submission (online text) & Add new attempt from previous submission & Submit for grading # Submit first attempt as a student Given I enter the app @@ -86,23 +84,23 @@ Feature: Test basic usage of assignment activity in app And I press "Student student" near "assignment1" in the app And I press "Grade" in the app And I press "Allow another attempt" in the app - And I press "Done" - Then I should see "Reopened" - And I should see "Not graded" + And I press "Done" in the app + Then I should find "Reopened" in the app + And I should find "Not graded" in the app # Submit second attempt as a student When I enter the app And I log in as "student1" And I press "Course 1" near "Recently accessed courses" in the app And I press "assignment1" in the app - Then I should see "Reopened" - And I should see "2 out of Unlimited" - And I should see "Add a new attempt based on previous submission" - And I should see "Add a new attempt" + Then I should find "Reopened" in the app + And I should find "2 out of Unlimited" in the app + And I should find "Add a new attempt based on previous submission" in the app + And I should find "Add a new attempt" in the app When I press "Add a new attempt based on previous submission" in the app And I press "OK" in the app - Then I should see "Submission test 1st attempt" + Then I should find "Submission test 1st attempt" in the app When I set the field "Online text submissions" to "Submission test 2nd attempt" in the app And I press "Save" in the app @@ -117,10 +115,9 @@ Feature: Test basic usage of assignment activity in app And I press "assignment1" in the app And I press "Participants" in the app And I press "Student student" near "assignment1" in the app - Then I should see "Online text submissions" - And I should see "Submission test 2nd attempt" + Then I should find "Online text submissions" in the app + And I should find "Submission test 2nd attempt" in the app - @app @3.8.0 Scenario: Add submission offline (online text) & Submit for grading offline & Sync submissions When I enter the app And I log in as "student1" @@ -132,17 +129,16 @@ Feature: Test basic usage of assignment activity in app And I press "Save" in the app And I press "Submit assignment" in the app And I press "OK" in the app - Then I should see "This Assignment has offline data to be synchronised." + Then I should find "This Assignment has offline data to be synchronised." in the app When I switch offline mode to "false" And I press the back button in the app And I press "assignment1" in the app And I press "Display options" in the app And I press "Refresh" in the app - Then I should see "Submitted for grading" - But I should not see "This Assignment has offline data to be synchronised." + Then I should find "Submitted for grading" in the app + But I should not find "This Assignment has offline data to be synchronised." in the app - @app @3.8.0 Scenario: Edit an offline submission before synchronising it When I enter the app And I log in as "student1" @@ -152,23 +148,23 @@ Feature: Test basic usage of assignment activity in app And I switch offline mode to "true" And I set the field "Online text submissions" to "Submission test original offline" in the app And I press "Save" in the app - Then I should see "This Assignment has offline data to be synchronised." - And I should see "Submission test original offline" + Then I should find "This Assignment has offline data to be synchronised." in the app + And I should find "Submission test original offline" in the app When I press "Edit submission" in the app And I set the field "Online text submissions" to "Submission test edited offline" in the app And I press "Save" in the app - Then I should see "This Assignment has offline data to be synchronised." - And I should see "Submission test edited offline" - But I should not see "Submission test original offline" + Then I should find "This Assignment has offline data to be synchronised." in the app + And I should find "Submission test edited offline" in the app + But I should not find "Submission test original offline" in the app When I press "Submit assignment" in the app And I press "OK" in the app - Then I should see "This Assignment has offline data to be synchronised." + Then I should find "This Assignment has offline data to be synchronised." in the app When I switch offline mode to "false" And I press the back button in the app And I press "assignment1" in the app - Then I should see "Submitted for grading" - And I should see "Submission test edited offline" - But I should not see "This Assignment has offline data to be synchronised." + Then I should find "Submitted for grading" in the app + And I should find "Submission test edited offline" in the app + But I should not find "This Assignment has offline data to be synchronised." in the app diff --git a/mod/login/tests/behat/app_basic_usage.feature b/mod/login/tests/behat/app_basic_usage.feature index fc0f78236..e3b5c3bab 100755 --- a/mod/login/tests/behat/app_basic_usage.feature +++ b/mod/login/tests/behat/app_basic_usage.feature @@ -1,4 +1,4 @@ -@mod @mod_login @app @app_upto3.9.4 @javascript +@mod @mod_login @app @javascript Feature: Test basic usage of login in app I need basic login functionality to work @@ -17,50 +17,48 @@ Feature: Test basic usage of login in app | student2 | C1 | student | | teacher1 | C1 | editingteacher | - @app @3.8.0 Scenario: Add a new site in the app & Site name in displayed when adding a new site When I enter the app And I press the back button in the app - And I set the field "https://campus.example.edu" to "$WWWROOT" in the app + And I set the field "Your site" to "$WWWROOT" in the app And I press "Connect to your site" in the app - Then I should see "Acceptance test site" + Then I should find "Acceptance test site" in the app When I set the field "Username" to "student1" in the app And I set the field "Password" to "student1" in the app And I press "Log in" near "Forgotten your username or password?" in the app - Then I should see "Acceptance test site" - But I should not see "Log in" + Then I should find "Acceptance test site" in the app + But I should not find "Log in" in the app - @app @3.8.0 Scenario: Add a non existing site When I enter the app And I log in as "student1" - And I press "menu" in the app + And I press the main menu button in the app And I press "Change site" in the app - And I press "add" in the app - And I set the field "https://campus.example.edu" to "Wrong Site Address" in the app + And I press "Add" in the app + And I set the field "Your site" to "Wrong Site Address" in the app And I press enter in the app - Then I should see "Cannot connect" - And I should see "Please check the address is correct." + Then I should find "Cannot connect" in the app + And I should find "Please check the address is correct." in the app - @app @3.8.0 Scenario: Delete a site When I enter the app And I log in as "student1" - And I press "menu" in the app + And I press the main menu button in the app And I press "Change site" in the app - Then I should see "Acceptance test site" + Then I should find "Acceptance test site" in the app And I press "Delete" in the app - And I press "trash" in the app - And I press "Delete" in the app - Then I should see "Connect to Moodle" - But I should not see "Acceptance test site" + And I press "Delete" near "Acceptance test site" in the app + And I press "Delete" near "Are you sure you want to delete the site Acceptance test site?" in the app + Then I should find "Connect to Moodle" in the app + But I should not find "Acceptance test site" in the app - @app @3.8.0 Scenario: Require minium version of the app for a site + + # Log in with a previous required version When I enter the app And I log in as "teacher1" - And I press "menu" in the app + And I press the main menu button in the app And I press "Website" in the app And I switch to the browser tab opened by the app And I follow "Log in" @@ -72,8 +70,11 @@ Feature: Test basic usage of login in app And I press "Save changes" And I close the browser tab opened by the app And I enter the app - And I log in as "teacher1" - And I press "menu" in the app + Then I should not find "App update required" in the app + + # Log in with a future required version + When I log in as "teacher1" + And I press the main menu button in the app And I press "Website" in the app And I switch to the browser tab opened by the app And I follow "Log in" @@ -85,4 +86,4 @@ Feature: Test basic usage of login in app And I press "Save changes" And I close the browser tab opened by the app And I enter the app - Then I should see "App update required" + Then I should find "App update required" in the app diff --git a/mod/quiz/tests/behat/app_basic_usage.feature b/mod/quiz/tests/behat/app_basic_usage.feature index 7b2f92086..d03e3c9db 100755 --- a/mod/quiz/tests/behat/app_basic_usage.feature +++ b/mod/quiz/tests/behat/app_basic_usage.feature @@ -1,4 +1,4 @@ -@mod @mod_quiz @app @app_upto3.9.4 @javascript +@mod @mod_quiz @app @javascript Feature: Attempt a quiz in app As a student In order to demonstrate what I know @@ -42,7 +42,7 @@ Feature: Attempt a quiz in app | Test questions | shortanswer | TF4 | Text of the second question | | Test questions | numerical | TF5 | Text of the third question | | Test questions | essay | TF6 | Text of the fourth question | - | Test questions | ddwtos | TF7 | Text of the fifth question | + | Test questions | ddwtos | TF7 | The [[1]] brown [[2]] jumped over the [[3]] dog. | | Test questions | truefalse | TF8 | Text of the sixth question | | Test questions | match | TF9 | Text of the seventh question | And quiz "Quiz 2" contains the following questions: @@ -55,60 +55,58 @@ Feature: Attempt a quiz in app | TF8 | 6 | | TF9 | 7 | - @app @3.8.0 Scenario: View a quiz entry page (attempts, status, etc.) When I enter the app And I log in as "student1" And I press "Course 1" near "Course overview" in the app And I press "Quiz 1" in the app And I press "Attempt quiz now" in the app - Then I should see "Text of the first question" - But I should not see "Text of the second question" + Then I should find "Text of the first question" in the app + But I should not find "Text of the second question" in the app When I press "Next" near "Question 1" in the app - Then I should see "Text of the second question" - But I should not see "Text of the first question" + Then I should find "Text of the second question" in the app + But I should not find "Text of the first question" in the app When I press "Previous" near "Question 2" in the app - Then I should see "Text of the first question" - But I should not see "Text of the second question" + Then I should find "Text of the first question" in the app + But I should not find "Text of the second question" in the app When I press "Next" near "Quiz 1" in the app - Then I should see "Text of the second question" - But I should not see "Text of the first question" + Then I should find "Text of the second question" in the app + But I should not find "Text of the first question" in the app When I press "Previous" near "Quiz 1" in the app - Then I should see "Text of the first question" - But I should not see "Text of the second question" + Then I should find "Text of the first question" in the app + But I should not find "Text of the second question" in the app When I press "Next" near "Question 1" in the app And I press "Next" near "Quiz 1" in the app - Then I should see "Summary of attempt" + Then I should find "Summary of attempt" in the app When I press "Return to attempt" in the app - Then I should see "Text of the second question" - But I should not see "Text of the first question" + Then I should find "Text of the second question" in the app + But I should not find "Text of the first question" in the app When I press "Next" in the app And I press "Submit all and finish" in the app - Then I should see "Once you submit" + Then I should find "Once you submit" in the app When I press "Cancel" near "Once you submit" in the app - Then I should see "Summary of attempt" + Then I should find "Summary of attempt" in the app When I press "Submit all and finish" in the app And I press "OK" near "Once you submit" in the app - Then I should see "Review of attempt 1" - And I should see "Started on" - And I should see "State" - And I should see "Completed on" - And I should see "Time taken" - And I should see "Marks" - And I should see "Grade" - And I should see "Question 1" - And I should see "Question 2" + Then I should find "Review of attempt 1" in the app + And I should find "Started on" in the app + And I should find "State" in the app + And I should find "Completed on" in the app + And I should find "Time taken" in the app + And I should find "Marks" in the app + And I should find "Grade" in the app + And I should find "Question 1" in the app + And I should find "Question 2" in the app - @app @3.8.0 Scenario: Attempt a quiz (all question types) When I enter the app And I log in as "student1" @@ -117,31 +115,37 @@ Feature: Attempt a quiz in app And I press "Attempt quiz now" in the app And I press "Four" in the app And I press "Three" in the app - And I press "Next" near "Question 1" in the app + And I press "Next" "ion-button" near "Quiz 2" in the app And I set the field "Answer" to "testing" in the app - And I press "Next" near "Question 2" in the app + And I press "Next" "ion-button" near "Question 2" in the app And I set the field "Answer" to "5" in the app - And I press "Next" near "Question 3" in the app + And I press "Next" "ion-button" near "Question 3" in the app And I set the field "Answer" to "Testing an essay" in the app - And I press "Next" near "Question 4" in the app - And I press "lazy" in the app - And I press "Next" near "Question 5" in the app + And I press "Next" "ion-button" near "Question 4" in the app + And I press "quick" ".drag" in the app + And I press "" ".place1.drop" in the app + And I press "fox" ".drag" in the app + And I press "" ".place2.drop" in the app + And I press "lazy" ".drag" in the app + And I press "" ".place3.drop" in the app + And I press "Next" "ion-button" near "Question 5" in the app And I press "True" in the app - And I press "Next" near "Question 6" in the app - And I press "Choose..." near "frog" in the app + And I press "Next" "ion-button" near "Question 6" in the app + And I press "Choose... , frog" in the app And I press "amphibian" in the app - And I press "Choose..." near "newt" in the app + And I press "Choose... , newt" in the app And I press "insect" in the app - And I press "Choose..." near "cat" in the app + And I press "Choose... , cat" in the app And I press "mammal" in the app - And I press "Next" near "Question 7" in the app - And I press "Submit all and finish" in the app - And I press "OK" in the app - Then I should see "Review of attempt 1" - And I should see "Finished" - And I should see "Not yet graded" + And I press "Next" "ion-button" near "Question 7" in the app + Then I should not find "Not yet answered" in the app + + When I press "Submit all and finish" in the app + And I press "OK" in the app + Then I should find "Review of attempt 1" in the app + And I should find "Finished" in the app + And I should find "Not yet graded" in the app - @app @3.8.0 Scenario: Submit a quiz & Review a quiz attempt When I enter the app And I log in as "student1" @@ -154,7 +158,7 @@ Feature: Attempt a quiz in app And I press "Next" near "Question 2" in the app And I press "Submit all and finish" in the app And I press "OK" in the app - Then I should see "Review of attempt 1" + Then I should find "Review of attempt 1" in the app When I enter the app And I log in as "teacher1" diff --git a/mod/quiz/tests/behat/app_quiz_navigation.feature b/mod/quiz/tests/behat/app_quiz_navigation.feature index 75b8b7a9d..cf8a69dd4 100644 --- a/mod/quiz/tests/behat/app_quiz_navigation.feature +++ b/mod/quiz/tests/behat/app_quiz_navigation.feature @@ -1,4 +1,4 @@ -@mod @mod_quiz @app @app_upto3.9.4 @javascript +@mod @mod_quiz @app @javascript Feature: Attempt a quiz in app As a student In order to demonstrate what I know @@ -29,81 +29,42 @@ Feature: Attempt a quiz in app | TF1 | 1 | | TF2 | 2 | - @app_upto3.7.0 - Scenario: Next and previous navigation in the 3.6 app + Scenario: Next and previous navigation Given I enter the app And I log in as "student1" When I press "Course 1" near "Course overview" in the app And I press "Quiz 1" in the app And I press "Attempt quiz now" in the app - Then I should see "Text of the first question" - And I should not see "Text of the second question" + Then I should find "Text of the first question" in the app + And I should not find "Text of the second question" in the app And I press "Next" near "Question 1" in the app - And I should see "Text of the second question" - And I should not see "Text of the first question" + And I should find "Text of the second question" in the app + And I should not find "Text of the first question" in the app And I press "Previous" near "Question 2" in the app - And I should not see "Text of the second question" - And I should see "Text of the first question" + And I should not find "Text of the second question" in the app + And I should find "Text of the first question" in the app And I press "Next" near "Quiz 1" in the app - And I should see "Text of the second question" - And I should not see "Text of the first question" + And I should find "Text of the second question" in the app + And I should not find "Text of the first question" in the app And I press "Previous" near "Quiz 1" in the app - And I should not see "Text of the second question" - And I should see "Text of the first question" + And I should not find "Text of the second question" in the app + And I should find "Text of the first question" in the app And I press "Next" near "Question 1" in the app And I press "Next" near "Quiz 1" in the app - And I should see "Summary of attempt" + And I should find "Summary of attempt" in the app And I press "Return to attempt" in the app - And I should see "Text of the second question" - And I should not see "Text of the first question" + And I should find "Text of the second question" in the app + And I should not find "Text of the first question" in the app And I press "Next" in the app And I press "Submit all and finish" in the app - And I should see "Once you submit" + And I should find "Once you submit" in the app And I press "Cancel" near "Once you submit" in the app - And I should see "Summary of attempt" + And I should find "Summary of attempt" in the app And I press "Submit all and finish" in the app And I press "OK" near "Once you submit" in the app - And I should see "Review" - And I press "home" in the app - And I should see "Acceptance test site" - - @app_from3.7.1 - Scenario: Next and previous navigation in the 3.7 app - Given I enter the app - And I log in as "student1" - When I press "Course 1" near "Course overview" in the app - And I press "Quiz 1" in the app - And I press "Attempt quiz now" in the app - Then I should see "Text of the first question" - And I should not see "Text of the second question" - And I press "Next" near "Question 1" in the app - And I should see "Text of the second question" - And I should not see "Text of the first question" - And I press "Previous" near "Question 2" in the app - And I should not see "Text of the second question" - And I should see "Text of the first question" - And I press "Next" near "Quiz 1" in the app - And I should see "Text of the second question" - And I should not see "Text of the first question" - And I press "Previous" near "Quiz 1" in the app - And I should not see "Text of the second question" - And I should see "Text of the first question" - And I press "Next" near "Question 1" in the app - And I press "Next" near "Quiz 1" in the app - And I should see "Summary of attempt" - And I press "Return to attempt" in the app - And I should see "Text of the second question" - And I should not see "Text of the first question" - And I press "Next" in the app - And I press "Submit all and finish" in the app - And I should see "Once you submit" - And I press "Cancel" near "Once you submit" in the app - And I should see "Summary of attempt" - And I press "Submit all and finish" in the app - And I press "OK" near "Once you submit" in the app - And I should see "Review" - And I press "home" in the app - And I should see "Are you sure" - And I should see "OK" + And I should find "Review" in the app + And I press "Home" in the app + And I should find "Are you sure" in the app + And I should find "OK" in the app And I press "OK" in the app - And I should see "Acceptance test site" + And I should find "Acceptance test site" in the app diff --git a/tests/behat/behat_app.php b/tests/behat/behat_app.php index a7cb59a8b..f74f8c888 100644 --- a/tests/behat/behat_app.php +++ b/tests/behat/behat_app.php @@ -812,7 +812,7 @@ class behat_app extends behat_base { * @return object */ public function parse_element_locator($text): object { - preg_match('/^"((?:[^"]|\\")+?)"(?: "([^"]+?)")?(?: near "((?:[^"]|\\")+?)"(?: "([^"]+?)")?)?$/', $text, $matches); + preg_match('/^"((?:[^"]|\\")*?)"(?: "([^"]*?)")?(?: near "((?:[^"]|\\")*?)"(?: "([^"]*?)")?)?$/', $text, $matches); $locator = [ 'text' => str_replace('\\"', '"', $matches[1]),