From 57cddebb3eaeef2f9a8a1e707475e1288b0aed15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Castell=C3=B3n?= Date: Thu, 2 Jan 2020 10:06:02 +0100 Subject: [PATCH] MOBILE-3295 MOBILE-3296 behat: Behat basic test for forum and choice --- mod/forum/tests/behat/app_basic_usage.feature | 25 +++--- .../tests/behat/app_basic_usage.feature | 78 ++++++++++++++++++- 2 files changed, 88 insertions(+), 15 deletions(-) diff --git a/mod/forum/tests/behat/app_basic_usage.feature b/mod/forum/tests/behat/app_basic_usage.feature index 145ba3261..56a1651eb 100755 --- a/mod/forum/tests/behat/app_basic_usage.feature +++ b/mod/forum/tests/behat/app_basic_usage.feature @@ -85,7 +85,7 @@ Feature: Test basic usage in app And I close the browser tab opened by the app And I press the back button in the app - @app @mobile @3.8.0 + @app @3.8.0 Scenario: Student star a discussion When I enter the app And I log in as "student1" @@ -117,7 +117,7 @@ Feature: Test basic usage in app And I pause - @app @mobile @3.8.0 + @app @3.8.0 Scenario: Teacher star and pin a discussion When I enter the app And I log in as "teacher1" @@ -163,7 +163,7 @@ Feature: Test basic usage in app And I should see "Auto-test pin" And I pause - @app @mobile @3.6 @OK + @app @3.6 @OK Scenario: Teacher checks pin and star in 3.6 When I enter the app And I log in as "teacher1" @@ -180,7 +180,7 @@ Feature: Test basic usage in app And I should not see "Pin this discussion" - @app @mobile @3.8.0 + @app @3.8.0 Scenario: Edit a forum post (only online) When I enter the app And I log in as "student1" @@ -199,13 +199,13 @@ Feature: Test basic usage in app And I press "Auto-test" in the app And I wait "2" seconds And I pause - And I press "More" in the app + And I press "" in the app And I should see "Edit" And I pause And I switch offline mode to "true" And I pause - @app @mobile @3.8.0 + @app @3.8.0 Scenario: Add/view ratings When I enter the app And I log in as "student1" @@ -367,7 +367,7 @@ Feature: Test basic usage in app And I should not see "There was a problem connecting to the site. Please check your connection and try again." - @app @3.8.0 @tablet + @app @3.8.0 @tablet @OK Scenario: Prefetch tablet When I enter the app And I change viewport size to "1280x1080" @@ -392,15 +392,18 @@ Feature: Test basic usage in app And I should see "DiscussionSubject 2" And I press "arrow back" in the app And I switch offline mode to "true" - And I press "Test forum name" in the app - And I pause - And I press "DiscussionSubject 2" in the app + And I press "refresh" near "Test forum name" in the app Then I should see "There was a problem connecting to the site. Please check your connection and try again." And I press "OK" in the app + And I press "Test forum name" in the app And I press "DiscussionSubject" in the app Then I should see "DiscussionSubject" And I should see "DiscussionMessage" - + And I press "arrow back" in the app + And I switch offline mode to "false" + And I press "refresh" near "Test forum name" in the app + Then I should not see "There was a problem connecting to the site. Please check your connection and try again." + @app @3.8.0 Scenario: Student sorts a forum discussion When I enter the app diff --git a/mod/survey/tests/behat/app_basic_usage.feature b/mod/survey/tests/behat/app_basic_usage.feature index 957c2fd09..390cafdde 100755 --- a/mod/survey/tests/behat/app_basic_usage.feature +++ b/mod/survey/tests/behat/app_basic_usage.feature @@ -20,8 +20,8 @@ Feature: Test basic usage in app | activity | name | intro | course | idnumber | groupmode | | survey | Test survey name | Test survey | C1 | survey | 0 | - @Mobile @3.8.0 @OK - Scenario: Student answer a survey and see results + @app @3.8.0 @mobile @OK + Scenario: Student answers a survey ATTLS and see results mobile When I enter the app And I log in as "student1" And I press "Course 1" near "Course overview" in the app @@ -74,13 +74,83 @@ Feature: Test basic usage in app Then I should see "You've completed this survey. The graph below shows a summary of your results compared to the class averages." And I should see "1 people have completed this survey so far" - @Tablet @3.8.0 - Scenario: Student answer a survey and see results tablet + @app @3.8.0 @tablet + Scenario: Student answer a survey ATTLS and see results tablet When I enter the app And I change viewport size to "1280x1080" And I log in as "student1" And I press "Course 1" near "Course overview" in the app And I press "Test survey name" in the app And I pause + + @app @3.8.0 + Scenario: Student answers a survey of critical incidents and see results + Given the following "activities" exist: + | activity | name | intro | template |course | idnumber | groupmode | + | survey | Test survey critical incidents | Test survey1 | 5 | C1 | survey1 | 0 | + 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 "Test survey critical incidents" in the app + And I press "Submit" in the app + And I press "OK" in the app + Then I should see "Results" + And I press "Results" in the app + And I switch to the browser tab opened by the app + And I log in as "student1" + Then I should see "Test survey critical incidents" + And I pause + + @app @3.8.0 @OK + Scenario: Sync survey + Given the following "activities" exist: + | activity | name | intro | template |course | idnumber | groupmode | + | survey | Test survey critical incidents | Test survey1 | 5 | C1 | survey1 | 0 | + 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 "Test survey critical incidents" in the app + And I switch offline mode to "true" + And I press "Submit" in the app + And I press "OK" in the app + And I switch offline mode to "false" + And I press "arrow back" in the app + And I press "Test survey critical incidents" in the app + And I press "Information" in the app + And I press "Refresh" in the app + Then I should see "Results" + + + @app @3.8.0 @OK + Scenario: Prefetch and auto-sync + Given the following "activities" exist: + | activity | name | intro | template |course | idnumber | groupmode | + | survey | Test survey critical incidents | Test survey1 | 5 | C1 | survey1 | 0 | + 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 "Information" in the app + And I press "Show download options" in the app + And I press "cloud download" near "Test survey critical incidents" in the app + And I switch offline mode to "true" + And I press "Test survey name" in the app + Then I should see "There was a problem connecting to the site. Please check your connection and try again." + And I press "OK" in the app + And I press "arrow back" in the app + And I press "Test survey critical incidents" in the app + And I press "Submit" in the app + And I press "OK" in the app + Then I should see "This Survey has offline data to be synchronised." + And I switch offline mode to "false" + And I wait "600" seconds + Then I should not see "This Survey has offline data to be synchronised." + And I should see "You have completed this survey." + + + @app @3.8.0 + Scenario: Student answers a survey offline + When I enter the app + And I log in as "student1" + And I pause