From 47a9180a11a9d8f8ff6ddceba88a4e53700162ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Castell=C3=B3n?= Date: Tue, 21 Jan 2020 10:03:59 +0100 Subject: [PATCH] MOBILE-3300 behat: Behat basic tests for courses --- .../tests/behat/app_basic_usage.feature | 79 +++++++++- mod/data/tests/behat/app_data_entries.feature | 46 ------ mod/data/tests/behat/app_data_sync.feature | 136 ------------------ .../tests/behat/app_quiz_navigation.feature | 110 -------------- 4 files changed, 72 insertions(+), 299 deletions(-) delete mode 100755 mod/data/tests/behat/app_data_entries.feature delete mode 100755 mod/data/tests/behat/app_data_sync.feature delete mode 100755 mod/quiz/tests/behat/app_quiz_navigation.feature diff --git a/mod/courses/tests/behat/app_basic_usage.feature b/mod/courses/tests/behat/app_basic_usage.feature index 8b62c266f..a22581dec 100755 --- a/mod/courses/tests/behat/app_basic_usage.feature +++ b/mod/courses/tests/behat/app_basic_usage.feature @@ -9,12 +9,14 @@ Feature: Test basic usage of courses in app | 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 | | Course 2 | C2 | 0 | | Course 3 | C3 | 0 | | Course 4 | C4 | 0 | + And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | @@ -24,12 +26,17 @@ Feature: Test basic usage of courses in app | student1 | C1 | student | | student1 | C2 | student | | student1 | C3 | student | + And the following "activities" exist: - | activity | name | intro | course | idnumber | option | - | choice | Choice course 1 | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 | - | choice | Choice course 2 | Test choice description | C2 | choice1 | Option 1, Option 2, Option 3 | - | choice | Choice course 3 | Test choice description | C3 | choice1 | Option 1, Option 2, Option 3 | - | choice | Choice course 4 | Test choice description | C4 | choice1 | Option 1, Option 2, Option 3 | + | activity | name | intro | course | idnumber | option | + | choice | Choice course 1 | Test choice description | C1 | choice1 | Option 1, Option 2, Option 3 | + | choice | Choice course 2 | Test choice description | C2 | choice1 | Option 1, Option 2, Option 3 | + | choice | Choice course 3 | Test choice description | C3 | choice1 | Option 1, Option 2, Option 3 | + | choice | Choice course 4 | Test choice description | C4 | choice1 | Option 1, Option 2, Option 3 | + + And the following "activities" exist: + | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | + | assign | C1 | assign1 | assignment | Test assignment description | 1 | @app @3.8.0 @OK Scenario: Dashboard tab displayed in >= 3.3 sites @@ -72,7 +79,7 @@ Feature: Test basic usage of courses in app Then I should see "Choice course 3" And the header should be "Course 3" in the app - @app @3.8.0 + @app @3.8.0 @OK Scenario: Search for a course When I enter the app And I log in as "student1" @@ -94,4 +101,62 @@ Feature: Test basic usage of courses in app Then I should see "Course 1" And I should see "Course 2" And I should see "Course 3" - And I should see "Course 4" \ No newline at end of file + And I should see "Course 4" + + @app @3.8.0 @OK + Scenario: Links to actions in Timeline work for teachers/students + When I enter the app + And I log in as "teacher1" + Then the header should be "Acceptance test site" in the app + And I should see "Course 1" + And I should see "Course 2" + And I should see "Course 3" + And I should see "Timeline" + And I press "Course 1" near "Recently accessed courses" in the app + And I press "assignment" in the app + And I press "Information" in the app + And I press "Open in browser" in the app + And I switch to the browser tab opened by the app + And I log in as "teacher1" + And I press "Actions menu" + And I follow "Edit settings" + And I press "Expand all" + And I click on "duedate[enabled]" "checkbox" + And I click on "gradingduedate[enabled]" "checkbox" + And I press "Save and return to course" + And I close the browser tab opened by the app + When I enter the app + And I log in as "student1" + Then the header should be "Acceptance test site" in the app + And I should see "Course 1" + And I should see "Course 2" + And I should see "Course 3" + And I should see "Timeline" + And I press "Add submission" in the app + Then the header should be "assignment" in the app + And I should see "Test assignment description" + And I should see "No attempt" + And I should see "Due date" + And I press "Add submission" in the app + And I set the field "Online text submissions" to "test" in the app + And I press "Save" in the app + And I press "Submit assignment" in the app + And I press "OK" in the app + Then the header should be "assignment" in the app + And I should see "Test assignment description" + And I should see "Submitted for grading" + And I should see "Due date" + When I enter the app + And I log in as "teacher1" + Then the header should be "Acceptance test site" in the app + And I should see "Course 1" + And I should see "Course 2" + And I should see "Course 3" + And I should see "Timeline" + And I press "Grade" in the app + Then the header should be "assignment" in the app + And I should see "Test assignment description" + And I should see "Time remaining" + And I press "Needs grading" in the app + Then I should see "Student student" + And I should see "Not graded" \ No newline at end of file diff --git a/mod/data/tests/behat/app_data_entries.feature b/mod/data/tests/behat/app_data_entries.feature deleted file mode 100755 index 2517342ef..000000000 --- a/mod/data/tests/behat/app_data_entries.feature +++ /dev/null @@ -1,46 +0,0 @@ -@mod @mod_data @app @javascript -Feature: Trying options moodle mobile - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | student1 | Student | 1 | student1@example.com | - | student2 | Student | 2 | student2@example.com | - | teacher1 | Teacher | 1 | teacher1@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 | - | student2 | C1 | student | - And the following "activities" exist: - | activity | name | intro | course | idnumber | - | data | Web links | Useful links | C1 | data1 | - - Scenario: Teacher create an event - Given I enter the app - When I log in as "teacher1" - And I press "calendar" in the app - And I press "close" in the app - And I set the field "name" to "Holidays!" - And I press "No selection" in the app - And I press "Course 1" in the app - Then I press "Show more..." in the app - And I set the field "location" to "Moodle" - And I press "Save" in the app - - Scenario: Student change his moodle language - Given I enter the app - When I log in as "student1" - And I press "more" near "Timeline" in the app - And I press "App settings" in the app - And I press "General" in the app - And I press "Language" in the app - And I press "Español" in the app - And I pause - And I press "Text size" near "Español" in the app - And I pause - - diff --git a/mod/data/tests/behat/app_data_sync.feature b/mod/data/tests/behat/app_data_sync.feature deleted file mode 100755 index 025f1abcc..000000000 --- a/mod/data/tests/behat/app_data_sync.feature +++ /dev/null @@ -1,136 +0,0 @@ -@mod @mod_data @app @javascript -Feature: Users can store entries in database activities when offline and sync when online - In order to populate databases while offline - As a user - I need to add and manage entries to databases and sync then when online - - Background: - Given the following "users" exist: - | username | firstname | lastname | email | - | student1 | Student | 1 | student1@example.com | - | student2 | Student | 2 | student2@example.com | - | teacher1 | Teacher | 1 | teacher1@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 | - | student2 | C1 | student | - And the following "activities" exist: - | activity | name | intro | course | idnumber | - | data | Web links | Useful links | C1 | data1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I add a "Text input" field to "Web links" database and I fill the form with: - | Field name | URL | - | Field description | URL link | - And I add a "Text input" field to "Web links" database and I fill the form with: - | Field name | Description | - | Field description | Link description | - And I log out - - @app_from3.7 - Scenario: Students can add entries to a database in the app while offline - Given I enter the app - And I log in as "student1" - And I press "Course 1" near "Course overview" in the app - And I press "Web links" near "General" in the app - And I switch offline mode to "true" - And I should see "No entries in database" - When I press "Add entries" in the app - And I set the field "URL" to "https://moodle.org/" in the app - And I set the field "Description" to "Moodle community site" in the app - And I press "Save" near "Web links" in the app - Then I should see "https://moodle.org/" - And I should see "Moodle community site" - And I should see "This Database has offline data to be synchronised" - And I press "back" near "Web links" in the app - And I switch offline mode to "false" - And I press "Web links" near "General" in the app - And I should see "https://moodle.org/" - And I should see "Moodle community site" - And I should not see "This Database has offline data to be synchronised" - - @app_from3.7 - Scenario: Students can edit and delete entries to a database in the app while offline - Given I enter the app - And I log in as "student1" - And I press "Course 1" near "Course overview" in the app - And I press "Web links" near "General" in the app - And I should see "No entries in database" - And I press "Add entries" in the app - And I set the field "URL" to "https://moodle.org/" in the app - And I set the field "Description" to "Moodle community site" in the app - And I press "Save" near "Web links" in the app - And I should see "https://moodle.org/" - And I should see "Moodle community site" - And I press "Information" in the app - And I press "Download" in the app - And I wait until the page is ready - And I switch offline mode to "true" - When I press "Edit" in the app - And I set the field "URL" to "https://moodlecloud.com/" in the app - And I set the field "Description" to "Moodle Cloud" in the app - And I press "Save" near "Web links" in the app - Then I should not see "https://moodle.org/" - And I should not see "Moodle community site" - And I should see "https://moodlecloud.com/" - And I should see "Moodle Cloud" - And I should see "This Database has offline data to be synchronised" - And I press "back" near "Web links" in the app - And I switch offline mode to "false" - And I press "Web links" near "General" in the app - And I should not see "https://moodle.org/" - And I should not see "Moodle community site" - And I should see "https://moodlecloud.com/" - And I should see "Moodle Cloud" - And I should not see "This Database has offline data to be synchronised" - And I press "Information" in the app - And I press "Refresh" in the app - And I wait until the page is ready - And I switch offline mode to "true" - And I press "Delete" in the app - And I should see "Are you sure you want to delete this entry?" - And I press "OK" in the app - And I should see "https://moodlecloud.com/" - And I should see "Moodle Cloud" - And I should see "This Database has offline data to be synchronised" - And I press "back" near "Web links" in the app - And I switch offline mode to "false" - And I press "Web links" near "General" in the app - And I should not see "https://moodlecloud.com/" - And I should not see "Moodle Cloud" - And I should not see "This Database has offline data to be synchronised" - - @app_from3.7 - Scenario: Students can undo deleting entries to a database in the app while offline - Given I enter the app - And I log in as "student1" - And I press "Course 1" near "Course overview" in the app - And I press "Web links" near "General" in the app - And I should see "No entries in database" - And I press "Add entries" in the app - And I set the field "URL" to "https://moodle.org/" in the app - And I set the field "Description" to "Moodle community site" in the app - And I press "Save" near "Web links" in the app - And I should see "https://moodle.org/" - And I should see "Moodle community site" - And I press "Information" in the app - And I press "Download" in the app - And I wait until the page is ready - When I switch offline mode to "true" - And I press "Delete" in the app - And I should see "Are you sure you want to delete this entry?" - And I press "OK" in the app - And I should see "https://moodle.org/" - And I should see "Moodle community site" - And I should see "This Database has offline data to be synchronised" - And I press "Restore" in the app - And I press "back" near "Web links" in the app - And I switch offline mode to "false" - And I press "Web links" near "General" in the app - Then I should see "https://moodle.org/" - And I should see "Moodle community site" - And I should not see "This Database has offline data to be synchronised" diff --git a/mod/quiz/tests/behat/app_quiz_navigation.feature b/mod/quiz/tests/behat/app_quiz_navigation.feature deleted file mode 100755 index 63c0e71be..000000000 --- a/mod/quiz/tests/behat/app_quiz_navigation.feature +++ /dev/null @@ -1,110 +0,0 @@ -@mod @mod_quiz @app @javascript -Feature: Attempt a quiz in app - As a student - In order to demonstrate what I know - I need to be able to attempt quizzes - - Background: - Given the following "courses" exist: - | fullname | shortname | - | Course 1 | C1 | - And the following "users" exist: - | username | - | student1 | - And the following "course enrolments" exist: - | user | course | role | - | student1 | C1 | student | - And the following "activities" exist: - | activity | name | intro | course | idnumber | - | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | - And the following "question categories" exist: - | contextlevel | reference | name | - | Course | C1 | Test questions | - And the following "questions" exist: - | questioncategory | qtype | name | questiontext | - | Test questions | truefalse | TF1 | Text of the first question | - | Test questions | truefalse | TF2 | Text of the second question | - And quiz "Quiz 1" contains the following questions: - | question | page | - | TF1 | 1 | - | TF2 | 2 | - - @app_upto3.7.0 - Scenario: Next and previous navigation in the 3.6 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 "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 press "OK" in the app - And I pause - And I should see "Acceptance test site" \ No newline at end of file