From 039e9d6e10f26e4566fe3bf9cf20a109cf7e7508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Castell=C3=B3n?= Date: Thu, 13 Feb 2020 10:53:27 +0100 Subject: [PATCH] MOBILE-3342 behat: Behat basic test for comments --- .../tests/behat/app_basic_usage.feature | 342 ++++++++++++++++++ 1 file changed, 342 insertions(+) diff --git a/mod/comments/tests/behat/app_basic_usage.feature b/mod/comments/tests/behat/app_basic_usage.feature index 6b7ae1e64..1971374f4 100755 --- a/mod/comments/tests/behat/app_basic_usage.feature +++ b/mod/comments/tests/behat/app_basic_usage.feature @@ -152,4 +152,346 @@ Feature: Test basic usage of comments in app Then I should not see "There are offline comments to be synchronised." And I should not see "comment test" And I press the back button in the app + And I should see "Comments (0)" + + @app @3.8.0 @OK + Scenario: Add comments and delete comments (glossary) + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "Test glossary" in the app + And I press "close" in the app + And I set the field "Concept" to "potato" in the app + And I set the field "Definition" to "The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae." in the app + And I press "Save" in the app + And I press "potato" in the app + And I press "Comments (0)" in the app + And I press "close" in the app + And I set the field "Add a comment..." to "comment test" in the app + And I press "Save comment" in the app + Then I should see "Comment created" + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "Test glossary" in the app + And I press "potato" in the app + And I press "Comments (1)" in the app + And I press "close" in the app + And I set the field "Add a comment..." to "comment test student" in the app + And I press "Save comment" in the app + Then I should see "Comment created" + And I should see "comment test" + And I should see "comment test student" + And I press the back button in the app + And I should see "Comments (2)" + And I press "Comments (2)" in the app + And I press "Delete" in the app + And I press "trash" in the app + And I press "Delete" near "Cancel" in the app + Then I should see "Comment deleted" + And I should see "comment test" + And I should not see "comment test student" + And I press the back button in the app + And I should see "Comments (1)" + + @app @3.8.0 @OK + Scenario: Add comments offline, delete comments offline and sync (glossary) + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "Test glossary" in the app + And I press "close" in the app + And I set the field "Concept" to "potato" in the app + And I set the field "Definition" to "The potato is a root vegetable native to the Americas, a starchy tuber of the plant Solanum tuberosum, and the plant itself, a perennial in the family Solanaceae." in the app + And I press "Save" in the app + And I press "potato" in the app + And I press "Comments (0)" in the app + And I switch offline mode to "true" + And I press "close" in the app + And I set the field "Add a comment..." to "comment test" in the app + And I press "Save comment" in the app + Then I should see "Data stored in the device because it couldn't be sent. It will be sent automatically later." + And I should see "There are offline comments to be synchronised." + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I switch offline mode to "false" + And I press "Display options" in the app + And I press "Synchronise now" in the app + Then I should not see "There are offline comments to be synchronised." + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I switch offline mode to "true" + And I press "Delete" in the app + And I press "trash" in the app + And I press "Delete" near "Cancel" in the app + Then I should see "Comment deleted" + And I should see "There are offline comments to be synchronised." + And I should see "Deleted offline" + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I switch offline mode to "false" + And I press "Display options" in the app + And I press "Synchronise now" in the app + Then I should not see "There are offline comments to be synchronised." + And I should not see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + + @app @3.8.0 @mobile @OK + Scenario: Add comments and delete comments mobile (blogs) + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "menu" 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" + And I log in as "teacher1" + And I click on "Side panel" "button" + And I follow "C1" + And I press "Actions menu" + And I follow "Turn editing on" + And I click on "Side panel" "button" + And I follow "Add a block" + And I follow "Blog menu" + And I follow "Add an entry about this course" + And I set the field "Entry title" to "Blog test" + And I set the field "Blog entry body" to "Blog body" + And I press "Save changes" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "menu" in the app + And I press "Site blog" in the app + Then I should see "Blog test" + And I should see "Blog body" + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I press "close" in the app + And I set the field "Add a comment..." to "comment test" in the app + And I press "Save comment" in the app + Then I should see "Comment created" + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I press "Delete" in the app + And I press "trash" in the app + And I press "Delete" near "Cancel" in the app + Then I should see "Comment deleted" + And I should not see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + + @app @3.8.0 @tablet @OK + Scenario: Add comments and delete comments tablet (blogs) + When I enter the app + And I change viewport size to "1280x1080" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "menu" 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" + And I log in as "teacher1" + And I follow "C1" + And I press "Actions menu" + And I follow "Turn editing on" + And I follow "Add a block" + And I follow "Blog menu" + And I follow "Add an entry about this course" + And I set the field "Entry title" to "Blog test" + And I set the field "Blog entry body" to "Blog body" + And I press "Save changes" + And I close the browser tab opened by the app + When I enter the app + And I change viewport size to "1280x1080" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "Site blog" in the app + Then I should see "Blog test" + And I should see "Blog body" + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I press "close" in the app + And I set the field "Add a comment..." to "comment test" in the app + And I press "Save comment" in the app + Then I should see "Comment created" + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I press "Delete" in the app + And I press "trash" in the app + And I press "Delete" near "Cancel" in the app + Then I should see "Comment deleted" + And I should not see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + + @app @3.8.0 @mobile @OK + Scenario: Add comments offline, delete comments offline and sync mobile (blogs) + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "menu" 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" + And I log in as "teacher1" + And I click on "Side panel" "button" + And I follow "C1" + And I press "Actions menu" + And I follow "Turn editing on" + And I click on "Side panel" "button" + And I follow "Add a block" + And I follow "Blog menu" + And I follow "Add an entry about this course" + And I set the field "Entry title" to "Blog test" + And I set the field "Blog entry body" to "Blog body" + And I press "Save changes" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "menu" in the app + And I press "Site blog" in the app + Then I should see "Blog test" + And I should see "Blog body" + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I switch offline mode to "true" + And I press "close" in the app + And I set the field "Add a comment..." to "comment test" in the app + And I press "Save comment" in the app + Then I should see "Data stored in the device because it couldn't be sent. It will be sent automatically later." + And I should see "There are offline comments to be synchronised." + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I switch offline mode to "false" + And I press "Display options" in the app + And I press "Synchronise now" in the app + Then I should not see "There are offline comments to be synchronised." + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I switch offline mode to "true" + And I press "Delete" in the app + And I press "trash" in the app + And I press "Delete" near "Cancel" in the app + Then I should see "Comment deleted" + And I should see "There are offline comments to be synchronised." + And I should see "Deleted offline" + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I switch offline mode to "false" + And I press "Display options" in the app + And I press "Synchronise now" in the app + Then I should not see "There are offline comments to be synchronised." + And I should not see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + + @app @3.8.0 @tablet @OK + Scenario: Add comments offline, delete comments offline and sync tablet (blogs) + When I enter the app + And I change viewport size to "1280x1080" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "menu" 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" + And I log in as "teacher1" + And I follow "C1" + And I press "Actions menu" + And I follow "Turn editing on" + And I follow "Add a block" + And I follow "Blog menu" + And I follow "Add an entry about this course" + And I set the field "Entry title" to "Blog test" + And I set the field "Blog entry body" to "Blog body" + And I press "Save changes" + And I close the browser tab opened by the app + When I enter the app + And I change viewport size to "1280x1080" + 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 press "Course 1" near "Recently accessed courses" in the app + And I press "Site blog" in the app + Then I should see "Blog test" + And I should see "Blog body" + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I switch offline mode to "true" + And I press "close" in the app + And I set the field "Add a comment..." to "comment test" in the app + And I press "Save comment" in the app + Then I should see "Data stored in the device because it couldn't be sent. It will be sent automatically later." + And I should see "There are offline comments to be synchronised." + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (0)" + And I press "Comments (0)" in the app + And I switch offline mode to "false" + And I press "Display options" in the app + And I press "Synchronise now" in the app + Then I should not see "There are offline comments to be synchronised." + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I switch offline mode to "true" + And I press "Delete" in the app + And I press "trash" in the app + And I press "Delete" near "Cancel" in the app + Then I should see "Comment deleted" + And I should see "There are offline comments to be synchronised." + And I should see "Deleted offline" + And I should see "comment test" + And I press the back button in the app + And I should see "Comments (1)" + And I press "Comments (1)" in the app + And I switch offline mode to "false" + And I press "Display options" in the app + And I press "Synchronise now" in the app + Then I should not see "There are offline comments to be synchronised." + And I should not see "comment test" + And I press the back button in the app And I should see "Comments (0)" \ No newline at end of file