From e289e3cf89571294fd90efb14019bf7013dd5ac6 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Fri, 7 Jun 2019 14:14:18 +0200 Subject: [PATCH 1/2] Move @app tests from core to this plugin It has been decided to have all the @app behat tests centralised on this plugin. These behat tests were created by Sam Marshall and Kiet.Chan. Thanks a lot! --- mod/forum/tests/behat/app_basic_usage.feature | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 mod/forum/tests/behat/app_basic_usage.feature diff --git a/mod/forum/tests/behat/app_basic_usage.feature b/mod/forum/tests/behat/app_basic_usage.feature new file mode 100644 index 000000000..1cd4db642 --- /dev/null +++ b/mod/forum/tests/behat/app_basic_usage.feature @@ -0,0 +1,62 @@ +@mod @mod_forum @app @javascript +Feature: Test basic usage in app + In order to participate in the forum while using the mobile app + As a student + I need basic forum functionality to work + + 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 | groupmode | + | forum | Test forum name | Test forum | C1 | forum | 0 | + + Scenario: Student starts a discussion + 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 forum name" in the app + And I press "Add a new discussion topic" in the app + And I set the field "Subject" to "My happy subject" in the app + And I set the field "Message" to "An awesome message" in the app + And I press "Post to forum" in the app + Then I should see "My happy subject" + And I should see "An awesome message" + + Scenario: Student posts a reply + 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 forum name" in the app + And I press "Add a new discussion topic" in the app + And I set the field "Subject" to "DiscussionSubject" in the app + And I set the field "Message" to "DiscussionMessage" in the app + And I press "Post to forum" in the app + And I press "DiscussionSubject" in the app + And I press "Reply" in the app + And I set the field "Message" to "ReplyMessage" in the app + And I press "Post to forum" in the app + Then I should see "DiscussionMessage" + And I should see "ReplyMessage" + + Scenario: Test that 'open in browser' works for forum + When I enter the app + And I change viewport size to "360x640" + And I log in as "student1" + And I press "Course 1" near "Course overview" in the app + And I press "Test forum name" in the app + And I press the page menu button 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 "student1" + Then I should see "Test forum name" + And I should see "Add a new discussion topic" + And I close the browser tab opened by the app + And I press the back button in the app From 8ad1df7a2fe7f75ceb6a53f3aa0f2c3a0ab54cc0 Mon Sep 17 00:00:00 2001 From: Amaia Anabitarte Date: Mon, 27 May 2019 18:37:19 +0200 Subject: [PATCH 2/2] Fixing behat failures on App3.7 --- mod/forum/tests/behat/app_basic_usage.feature | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mod/forum/tests/behat/app_basic_usage.feature b/mod/forum/tests/behat/app_basic_usage.feature index 1cd4db642..099472334 100644 --- a/mod/forum/tests/behat/app_basic_usage.feature +++ b/mod/forum/tests/behat/app_basic_usage.feature @@ -30,6 +30,7 @@ Feature: Test basic usage in app Then I should see "My happy subject" And I should see "An awesome message" + @app_upto3.6.1 Scenario: Student posts a reply When I enter the app And I log in as "student1" @@ -46,6 +47,23 @@ Feature: Test basic usage in app Then I should see "DiscussionMessage" And I should see "ReplyMessage" + @app_from3.7 + Scenario: Student posts a reply + 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 forum name" in the app + And I press "Add a new discussion topic" in the app + And I set the field "Subject" to "DiscussionSubject" in the app + And I set the field "Message" to "DiscussionMessage" in the app + And I press "Post to forum" in the app + And I press "DiscussionSubject" in the app + And I press "Reply" in the app + And I set the field "Write your reply" to "ReplyMessage" in the app + And I press "Post to forum" in the app + Then I should see "DiscussionMessage" + And I should see "ReplyMessage" + Scenario: Test that 'open in browser' works for forum When I enter the app And I change viewport size to "360x640"