Merge pull request #23 from NoelDeMartin/MOBILE-3320

MOBILE-3320: Update forum & courses tests
main
Dani Palou 2021-06-08 13:00:34 +02:00 committed by GitHub
commit 475811518a
5 changed files with 200 additions and 272 deletions

View File

@ -1,4 +1,4 @@
@mod @mod_courses @app @app_upto3.9.4 @javascript @mod @mod_courses @app @javascript
Feature: Test basic usage of courses in app Feature: Test basic usage of courses in app
In order to participate in the courses while using the mobile app In order to participate in the courses while using the mobile app
As a student As a student
@ -34,81 +34,77 @@ Feature: Test basic usage of courses in app
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled | | activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
| assign | C1 | assign1 | assignment | Test assignment description | 1 | | assign | C1 | assign1 | assignment | Test assignment description | 1 |
@app @3.8.0
Scenario: "Dashboard" tab displayed in >= 3.3 sites Scenario: "Dashboard" tab displayed in >= 3.3 sites
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
Then I should see "Dashboard" Then I should see "Dashboard"
And the header should be "Acceptance test site" in the app And the header should be "Acceptance test site" in the app
And I should see "Course 1" And I should find "Course 1" in the app
And I should see "Course 2" And I should find "Course 2" in the app
And I should see "Course 3" And I should find "Course 3" in the app
When I press "Site home" in the app When I press "Site home" in the app
Then I should see "Dashboard" Then I should find "Dashboard" in the app
And the header should be "Acceptance test site" in the app And the header should be "Acceptance test site" in the app
When I press "Dashboard" in the app When I press "Dashboard" in the app
Then I should see "Course 1" Then I should find "Course 1" in the app
And I should see "Course 2" And I should find "Course 2" in the app
And I should see "Course 3" And I should find "Course 3" in the app
@app @3.8.0
Scenario: See my courses Scenario: See my courses
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
Then the header should be "Acceptance test site" in the app Then the header should be "Acceptance test site" in the app
And I should see "Course 1" And I should find "Course 1" in the app
And I should see "Course 2" And I should find "Course 2" in the app
And I should see "Course 3" And I should find "Course 3" in the app
When I press "Course 1" near "Recently accessed courses" in the app When I press "Course 1" near "Recently accessed courses" in the app
Then I should see "Choice course 1" Then I should find "Choice course 1" in the app
And the header should be "Course 1" in the app And the header should be "Course 1" in the app
When I press "Choice course 1" in the app When I press "Choice course 1" in the app
Then I should see "Test choice description" Then I should find "Test choice description" in the app
And the header should be "Choice course 1" in the app And the header should be "Choice course 1" in the app
When I press the back button in the app When I press the back button in the app
And I press the back button in the app And I press the back button in the app
And I press "Course 2" near "Recently accessed courses" in the app And I press "Course 2" near "Recently accessed courses" in the app
Then I should see "Choice course 2" Then I should find "Choice course 2" in the app
And the header should be "Course 2" in the app And the header should be "Course 2" in the app
When I press the back button in the app When I press the back button in the app
And I press "Course 3" near "Recently accessed courses" in the app And I press "Course 3" near "Recently accessed courses" in the app
Then I should see "Choice course 3" Then I should find "Choice course 3" in the app
And the header should be "Course 3" in the app And the header should be "Course 3" in the app
@app @3.8.0
Scenario: Search for a course Scenario: Search for a course
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
And I press "Search courses" in the app And I press "Search courses" in the app
And I set the field "Search" to "Course 4" in the app And I set the field "Search" to "Course 4" in the app
And I press "Search" in the app And I press "Search" "button" in the app
Then I should see "Course 4" Then I should find "Course 4" in the app
And the header should be "Search courses" in the app And the header should be "Search courses" in the app
When I press "Course 4" in the app When I press "Course 4" in the app
Then I should see "Course 4" Then I should find "Course 4" in the app
And the header should be "Course 4" in the app And the header should be "Course 4" in the app
When I press the back button in the app When I press the back button in the app
And I set the field "Search" to "Course" in the app And I set the field "Search" to "Course" in the app
And I press "Search" in the app And I press "Search" "button" in the app
Then I should see "Course 1" Then I should find "Course 1" in the app
And I should see "Course 2" And I should find "Course 2" in the app
And I should see "Course 3" And I should find "Course 3" in the app
And I should see "Course 4" And I should find "Course 4" in the app
@app @3.8.0
Scenario: Links to actions in Timeline work for teachers/students Scenario: Links to actions in Timeline work for teachers/students
# Configure assignment as teacher # Configure assignment as teacher
When I enter the app When I enter the app
And I log in as "teacher1" And I log in as "teacher1"
Then I should see "Timeline" Then I should find "Timeline" in the app
Given I press "Course 1" near "Recently accessed courses" in the app Given I press "Course 1" near "Recently accessed courses" in the app
And I press "assignment" in the app And I press "assignment" in the app
@ -129,9 +125,9 @@ Feature: Test basic usage of courses in app
And I log in as "student1" And I log in as "student1"
And I press "Add submission" in the app And I press "Add submission" in the app
Then the header should be "assignment" in the app Then the header should be "assignment" in the app
And I should see "Test assignment description" And I should find "Test assignment description" in the app
And I should see "No attempt" And I should find "No attempt" in the app
And I should see "Due date" And I should find "Due:" in the app
When I press "Add submission" in the app When I press "Add submission" in the app
And I set the field "Online text submissions" to "test" in the app And I set the field "Online text submissions" to "test" in the app
@ -139,18 +135,18 @@ Feature: Test basic usage of courses in app
And I press "Submit assignment" in the app And I press "Submit assignment" in the app
And I press "OK" in the app And I press "OK" in the app
Then the header should be "assignment" in the app Then the header should be "assignment" in the app
And I should see "Test assignment description" And I should find "Test assignment description" in the app
And I should see "Submitted for grading" And I should find "Submitted for grading" in the app
And I should see "Due date" And I should find "Due:" in the app
# Grade assignment as teacher # Grade assignment as teacher
When I enter the app When I enter the app
And I log in as "teacher1" And I log in as "teacher1"
And I press "Grade" in the app And I press "Grade" in the app
Then the header should be "assignment" in the app Then the header should be "assignment" in the app
And I should see "Test assignment description" And I should find "Test assignment description" in the app
And I should see "Time remaining" And I should find "Time remaining" in the app
When I press "Needs grading" in the app When I press "Needs grading" in the app
Then I should see "Student student" Then I should find "Student student" in the app
And I should see "Not graded" And I should find "Not graded" in the app

View File

@ -1,4 +1,4 @@
@mod @mod_forum @app @app_upto3.9.4 @javascript @mod @mod_forum @app @javascript
Feature: Test basic usage of forum activity in app Feature: Test basic usage of forum activity in app
In order to participate in the forum while using the mobile app In order to participate in the forum while using the mobile app
As a student As a student
@ -24,7 +24,6 @@ Feature: Test basic usage of forum activity in app
| activity | name | intro | course | idnumber | groupmode | assessed | scale | | activity | name | intro | course | idnumber | groupmode | assessed | scale |
| forum | Test forum name | Test forum | C1 | forum | 0 | 1 | 1 | | forum | Test forum name | Test forum | C1 | forum | 0 | 1 | 1 |
@app @3.8.0
Scenario: Create new discussion Scenario: Create new discussion
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -34,12 +33,11 @@ Feature: Test basic usage of forum activity in app
And I set the field "Subject" to "My happy subject" 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 set the field "Message" to "An awesome message" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "My happy subject" Then I should find "My happy subject" in the app
When I press "My happy subject" in the app When I press "My happy subject" in the app
Then I should see "An awesome message" Then I should find "An awesome message" in the app
@app_from3.7
Scenario: Reply a post Scenario: Reply a post
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -50,15 +48,14 @@ Feature: Test basic usage of forum activity in app
And I set the field "Message" to "DiscussionMessage" 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 "Post to forum" in the app
And I press "DiscussionSubject" in the app And I press "DiscussionSubject" in the app
Then I should see "Reply" Then I should find "Reply" in the app
When I press "Reply" in the app When I press "Reply" in the app
And I set the field "Write your reply" to "ReplyMessage" in the app And I set the field "Message" to "ReplyMessage" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "DiscussionMessage" Then I should find "DiscussionMessage" in the app
And I should see "ReplyMessage" And I should find "ReplyMessage" in the app
@app @3.8.0
Scenario: Star and pin discussions (student) Scenario: Star and pin discussions (student)
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -73,29 +70,28 @@ Feature: Test basic usage of forum activity in app
And I set the field "Message" to "normal message" in the app And I set the field "Message" to "normal message" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
And I press "starred subject" in the app And I press "starred subject" in the app
Then I should see "starred message" Then I should find "starred message" in the app
When I press the back button in the app When I press the back button in the app
And I press "Display options" near "starred subject" in the app And I press "Display options" near "starred subject" in the app
And I press "Star this discussion" in the app And I press "Star this discussion" in the app
And I press "starred subject" in the app And I press "starred subject" in the app
Then I should see "starred message" Then I should find "starred message" in the app
When I press the back button in the app When I press the back button in the app
And I press "normal subject" in the app And I press "normal subject" in the app
Then I should see "normal message" Then I should find "normal message" in the app
When I press the back button in the app When I press the back button in the app
And I press "Display options" near "starred subject" in the app And I press "Display options" near "starred subject" in the app
And I press "Unstar this discussion" in the app And I press "Unstar this discussion" in the app
And I press "starred subject" in the app And I press "starred subject" in the app
Then I should see "starred message" Then I should find "starred message" in the app
When I press the back button in the app When I press the back button in the app
And I press "normal subject" in the app And I press "normal subject" in the app
Then I should see "normal message" Then I should find "normal message" in the app
@app @3.8.0
Scenario: Star and pin discussions (teacher) Scenario: Star and pin discussions (teacher)
When I enter the app When I enter the app
And I log in as "teacher1" And I log in as "teacher1"
@ -117,35 +113,17 @@ Feature: Test basic usage of forum activity in app
And I press "Star this discussion" in the app And I press "Star this discussion" in the app
And I press "Display options" near "Auto-test pin" in the app And I press "Display options" near "Auto-test pin" in the app
And I press "Pin this discussion" in the app And I press "Pin this discussion" in the app
Then I should see "Auto-test pin" Then I should find "Auto-test pin" in the app
And I should see "Auto-test star" And I should find "Auto-test star" in the app
And I should see "Auto-test plain" And I should find "Auto-test plain" in the app
When I press "Display options" near "Auto-test pin" in the app When I press "Display options" near "Auto-test pin" in the app
And I press "Unpin this discussion" in the app And I press "Unpin this discussion" in the app
And I press "Display options" near "Auto-test star" in the app And I press "Display options" near "Auto-test star" in the app
And I press "Unstar this discussion" in the app And I press "Unstar this discussion" in the app
Then I should see "Auto-test star" Then I should find "Auto-test star" in the app
And I should see "Auto-test pin" And I should find "Auto-test pin" in the app
@app_upto3.6.0
Scenario: Star and pin discussions (teacher in 3.6)
When I enter the app
And I log in as "teacher1"
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 "Auto-test" in the app
And I set the field "Message" to "Auto-test message" in the app
And I press "Post to forum" in the app
And I press "Auto-test" in the app
Then I should see "Reply"
When I press "Information" in the app
Then I should not see "Star this discussion"
And I should not see "Pin this discussion"
@app @3.8.0
Scenario: Edit a not sent reply offline Scenario: Edit a not sent reply offline
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -156,32 +134,31 @@ Feature: Test basic usage of forum activity in app
And I set the field "Message" to "Auto-test message" in the app And I set the field "Message" to "Auto-test message" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
And I press "Auto-test" near "Sort by last post creation date in descending order" in the app And I press "Auto-test" near "Sort by last post creation date in descending order" in the app
And I should see "Reply" And I should find "Reply" in the app
When I press the back button in the app When I press the back button in the app
And I switch offline mode to "true" And I switch offline mode to "true"
And I press "Auto-test" near "Sort by last post creation date in descending order" in the app And I press "Auto-test" near "Sort by last post creation date in descending order" in the app
Then I should see "Reply" Then I should find "Reply" in the app
When I press "Reply" in the app When I press "Reply" in the app
And I set the field "Write your reply..." to "not sent reply" in the app And I set the field "Message" to "not sent reply" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
And I press "Display options" near "not sent reply" in the app And I press "Display options" near "not sent reply" in the app
Then I should see "Edit" Then I should find "Edit" in the app
When I press "Edit" in the app When I press "Edit" in the app
And I set the field "Write your reply..." to "not sent reply edited" in the app And I set the field "Message" to "not sent reply edited" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "Not sent" Then I should find "Not sent" in the app
And I should see "This Discussion has offline data to be synchronised" And I should find "This Discussion has offline data to be synchronised" in the app
When I switch offline mode to "false" When I switch offline mode to "false"
And I press the back button in the app And I press the back button in the app
And I press "Auto-test" near "Sort by last post creation date in descending order" in the app And I press "Auto-test" near "Sort by last post creation date in descending order" in the app
Then I should not see "Not sent" Then I should not find "Not sent" in the app
And I should not see "This Discussion has offline data to be synchronised" And I should not find "This Discussion has offline data to be synchronised" in the app
@app @3.8.0
Scenario: Edit a not sent new discussion offline Scenario: Edit a not sent new discussion offline
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -195,19 +172,18 @@ Feature: Test basic usage of forum activity in app
And I press "Auto-test" in the app And I press "Auto-test" in the app
And I set the field "Message" to "Auto-test message edited" in the app And I set the field "Message" to "Auto-test message edited" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "This Forum has offline data to be synchronised." Then I should find "This Forum has offline data to be synchronised." in the app
When I switch offline mode to "false" When I switch offline mode to "false"
And I press "Auto-test" in the app And I press "Auto-test" in the app
Then I should see "Post to forum" Then I should find "Post to forum" in the app
When I press "Post to forum" in the app When I press "Post to forum" in the app
Then I should not see "This Forum has offline data to be synchronised." Then I should not find "This Forum has offline data to be synchronised." in the app
When I press "Auto-test" near "Sort by last post creation date in descending order" in the app When I press "Auto-test" near "Sort by last post creation date in descending order" in the app
And I should see "Auto-test message edited" And I should find "Auto-test message edited" in the app
@app @3.8.0
Scenario: Edit a forum post (only online) Scenario: Edit a forum post (only online)
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -217,26 +193,25 @@ Feature: Test basic usage of forum activity in app
And I set the field "Subject" to "Auto-test" in the app And I set the field "Subject" to "Auto-test" in the app
And I set the field "Message" to "Auto-test message" in the app And I set the field "Message" to "Auto-test message" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "Auto-test" Then I should find "Auto-test" in the app
When I press the back button in the app When I press the back button in the app
And I press "Display options" in the app And I press "Display options" in the app
And I press "Show download options" in the app And I press "Show download options" in the app
And I press "cloud download" near "Test forum name" in the app And I press "Download" near "Test forum name" in the app
And I press "Test forum name" in the app And I press "Test forum name" in the app
And I press "Auto-test" near "Sort by last post creation date in descending order" in the app And I press "Auto-test" near "Sort by last post creation date in descending order" in the app
Then I should see "Reply" Then I should find "Reply" in the app
When I press "Display options" near "Reply" in the app When I press "Display options" near "Reply" in the app
Then I should see "Edit" Then I should find "Edit" in the app
When I press "Edit" in the app When I press "Edit" in the app
And I switch offline mode to "true" And I switch offline mode to "true"
And I set the field "Write your reply..." to "Auto-test message edited" in the app And I set the field "Message" to "Auto-test message edited" in the app
And I press "Save changes" in the app And I press "Save changes" in the app
Then I should see "There was a problem connecting to the site. Please check your connection and try again." Then I should find "There was a problem connecting to the site. Please check your connection and try again." in the app
@app @3.8.0
Scenario: Delete a forum post (only online) Scenario: Delete a forum post (only online)
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -246,32 +221,31 @@ Feature: Test basic usage of forum activity in app
And I set the field "Subject" to "Auto-test" in the app And I set the field "Subject" to "Auto-test" in the app
And I set the field "Message" to "Auto-test message" in the app And I set the field "Message" to "Auto-test message" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "Auto-test" Then I should find "Auto-test" in the app
When I press the back button in the app When I press the back button in the app
And I press "Display options" in the app And I press "Display options" in the app
And I press "Show download options" in the app And I press "Show download options" in the app
And I press "cloud download" near "Test forum name" in the app And I press "Download" near "Test forum name" in the app
And I press "Test forum name" in the app And I press "Test forum name" in the app
And I press "Auto-test" near "Sort by last post creation date in descending order" in the app And I press "Auto-test" near "Sort by last post creation date in descending order" in the app
Then I should see "Reply" Then I should find "Reply" in the app
When I press "Display options" near "Reply" in the app When I press "Display options" near "Reply" in the app
Then I should see "Delete" Then I should find "Delete" in the app
When I press "Delete" in the app When I press "Delete" in the app
And I press "Cancel" in the app And I press "Cancel" in the app
And I switch offline mode to "true" And I switch offline mode to "true"
And I press "Display options" near "Reply" in the app And I press "Display options" near "Reply" in the app
Then I should not see "Delete" Then I should not find "Delete" in the app
When I switch offline mode to "false" When I switch offline mode to "false"
And I press "Display options" near "Reply" in the app And I press "Display options" near "Reply" in the app
And I press "Delete" in the app And I press "Delete" in the app
And I press "Delete" in the app And I press "Delete" in the app
Then I should not see "Auto-test" Then I should not find "Auto-test" in the app
@app @3.8.0
Scenario: Add/view ratings Scenario: Add/view ratings
Given I enter the app Given I enter the app
And I log in as "student1" And I log in as "student1"
@ -282,50 +256,49 @@ Feature: Test basic usage of forum activity in app
And I set the field "Message" to "Auto-test message" in the app And I set the field "Message" to "Auto-test message" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
And I press "Auto-test" in the app And I press "Auto-test" in the app
Then I should see "Reply" Then I should find "Reply" in the app
When I press "Reply" in the app When I press "Reply" in the app
And I set the field "Write your reply..." to "test2" in the app And I set the field "Message" to "test2" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
When I enter the app When I enter the app
And I log in as "teacher1" And I log in as "teacher1"
And I press "Course 1" near "Course overview" in the app And I press "Course 1" near "Course overview" in the app
And I press "Test forum name" in the app And I press "Test forum name" in the app
And I press "Auto-test" in the app And I press "Auto-test" in the app
Then I should see "Reply" Then I should find "Reply" in the app
When I press "None" near "Auto-test message" in the app When I press "None" near "Auto-test message" in the app
And I press "1" near "Cancel" in the app And I press "1" near "Cancel" in the app
And I switch offline mode to "true" And I switch offline mode to "true"
And I press "None" near "test2" in the app And I press "None" near "test2" in the app
And I press "0" near "Cancel" in the app And I press "0" near "Cancel" in the app
Then I should see "Data stored in the device because it couldn't be sent. It will be sent automatically later." Then I should find "Data stored in the device because it couldn't be sent. It will be sent automatically later." in the app
And I should see "Average of ratings: -" And I should find "Average of ratings: -" in the app
And I should see "Average of ratings: 1" And I should find "Average of ratings: 1" in the app
When I switch offline mode to "false" When I switch offline mode to "false"
And I press the back button in the app And I press the back button in the app
Then I should see "This Forum has offline data to be synchronised." Then I should find "This Forum has offline data to be synchronised." in the app
When I press "Display options" near "Test forum name" in the app When I press "Display options" near "Test forum name" in the app
And I press "Synchronise now" in the app And I press "Synchronise now" in the app
Then I should not see "This Forum has offline data to be synchronised." Then I should not find "This Forum has offline data to be synchronised." in the app
When I press "Auto-test" in the app When I press "Auto-test" in the app
Then I should see "Average of ratings: 1" Then I should find "Average of ratings: 1" in the app
And I should see "Average of ratings: 0" And I should find "Average of ratings: 0" in the app
But I should not see "Average of ratings: -" But I should not find "Average of ratings: -" in the app
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
And I press "Course 1" near "Course overview" in the app And I press "Course 1" near "Course overview" in the app
And I press "Test forum name" in the app And I press "Test forum name" in the app
And I press "Auto-test" in the app And I press "Auto-test" in the app
Then I should see "Average of ratings: 1" Then I should find "Average of ratings: 1" in the app
And I should see "Average of ratings: 0" And I should find "Average of ratings: 0" in the app
But I should not see "Average of ratings: -" But I should not find "Average of ratings: -" in the app
@app @3.8.0
Scenario: Reply a post offline Scenario: Reply a post offline
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -338,27 +311,26 @@ Feature: Test basic usage of forum activity in app
And I press the back button in the app And I press the back button in the app
And I press "Display options" in the app And I press "Display options" in the app
And I press "Show download options" in the app And I press "Show download options" in the app
And I press "cloud download" near "Test forum name" in the app And I press "Download" near "Test forum name" in the app
And I press "Test forum name" in the app And I press "Test forum name" in the app
And I press "DiscussionSubject" in the app And I press "DiscussionSubject" in the app
And I switch offline mode to "true" And I switch offline mode to "true"
Then I should see "Reply" Then I should find "Reply" in the app
When I press "Reply" in the app When I press "Reply" in the app
And I set the field "Write your reply" to "ReplyMessage" in the app And I set the field "Message" to "ReplyMessage" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "DiscussionMessage" Then I should find "DiscussionMessage" in the app
And I should see "ReplyMessage" And I should find "ReplyMessage" in the app
And I should see "Not sent" And I should find "Not sent" in the app
When I press the back button in the app When I press the back button in the app
And I switch offline mode to "false" And I switch offline mode to "false"
And I press "DiscussionSubject" in the app And I press "DiscussionSubject" in the app
Then I should see "DiscussionMessage" Then I should find "DiscussionMessage" in the app
And I should see "ReplyMessage" And I should find "ReplyMessage" in the app
But I should not see "Not sent" But I should not find "Not sent" in the app
@app @3.8.0
Scenario: New discussion offline & Sync Forum Scenario: New discussion offline & Sync Forum
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -369,9 +341,9 @@ Feature: Test basic usage of forum activity in app
And I set the field "Subject" to "DiscussionSubject" 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 set the field "Message" to "DiscussionMessage" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "DiscussionSubject" Then I should find "DiscussionSubject" in the app
And I should see "Not sent" And I should find "Not sent" in the app
And I should see "This Forum has offline data to be synchronised." And I should find "This Forum has offline data to be synchronised." in the app
When I switch offline mode to "false" When I switch offline mode to "false"
And I press the back button in the app And I press the back button in the app
@ -379,12 +351,11 @@ Feature: Test basic usage of forum activity in app
And I press "Display options" near "Test forum name" in the app And I press "Display options" near "Test forum name" in the app
And I press "Refresh discussions" in the app And I press "Refresh discussions" in the app
And I press "DiscussionSubject" near "Sort by last post creation date in descending order" in the app And I press "DiscussionSubject" near "Sort by last post creation date in descending order" in the app
Then I should see "DiscussionSubject" Then I should find "DiscussionSubject" in the app
And I should see "DiscussionMessage" And I should find "DiscussionMessage" in the app
But I should not see "Not sent" But I should not find "Not sent" in the app
And I should not see "This Forum has offline data to be synchronised." And I should not find "This Forum has offline data to be synchronised." in the app
@app @3.8.0
Scenario: New discussion offline & Auto-sync forum Scenario: New discussion offline & Auto-sync forum
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -395,22 +366,21 @@ Feature: Test basic usage of forum activity in app
And I set the field "Subject" to "DiscussionSubject" 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 set the field "Message" to "DiscussionMessage" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "DiscussionSubject" Then I should find "DiscussionSubject" in the app
And I should see "Not sent" And I should find "Not sent" in the app
And I should see "This Forum has offline data to be synchronised." And I should find "This Forum has offline data to be synchronised." in the app
When I switch offline mode to "false" When I switch offline mode to "false"
And I run cron tasks in the app And I run cron tasks in the app
And I wait loading to finish in the app And I wait loading to finish in the app
Then I should not see "Not sent" Then I should not find "Not sent" in the app
When I press "DiscussionSubject" near "Sort by last post creation date in descending order" in the app When I press "DiscussionSubject" near "Sort by last post creation date in descending order" in the app
Then I should see "DiscussionSubject" Then I should find "DiscussionSubject" in the app
And I should see "DiscussionMessage" And I should find "DiscussionMessage" in the app
But I should not see "Not sent" But I should not find "Not sent" in the app
And I should not see "This Forum has offline data to be synchronised." And I should not find "This Forum has offline data to be synchronised." in the app
@app @3.8.0
Scenario: Prefetch Scenario: Prefetch
When I enter the app When I enter the app
And I log in as "student1" And I log in as "student1"
@ -420,29 +390,31 @@ Feature: Test basic usage of forum activity in app
And I set the field "Subject" to "DiscussionSubject 1" in the app And I set the field "Subject" to "DiscussionSubject 1" in the app
And I set the field "Message" to "DiscussionMessage 1" in the app And I set the field "Message" to "DiscussionMessage 1" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "DiscussionSubject 1" Then I should find "DiscussionSubject 1" in the app
When I press the back button in the app When I press the back button in the app
And I press "Display options" in the app And I press "Display options" in the app
And I press "Show download options" in the app And I press "Show download options" in the app
And I press "cloud download" near "Test forum name" in the app And I press "Download" near "Test forum name" in the app
And I press "Test forum name" in the app Then I should find "Downloaded" near "Test forum name" in the app
When I press "Test forum name" in the app
And I press "Add a new discussion topic" in the app And I press "Add a new discussion topic" in the app
And I set the field "Subject" to "DiscussionSubject 2" in the app And I set the field "Subject" to "DiscussionSubject 2" in the app
And I set the field "Message" to "DiscussionMessage 2" in the app And I set the field "Message" to "DiscussionMessage 2" in the app
And I press "Post to forum" in the app And I press "Post to forum" in the app
Then I should see "DiscussionSubject 1" Then I should find "DiscussionSubject 1" in the app
And I should see "DiscussionSubject 2" And I should find "DiscussionSubject 2" in the app
When I press the back button in the app When I press the back button in the app
And I switch offline mode to "true" And I switch offline mode to "true"
And I press "Test forum name" in the app And I press "Test forum name" in the app
And I press "DiscussionSubject 2" in the app And I press "DiscussionSubject 2" in the app
Then I should see "There was a problem connecting to the site. Please check your connection and try again." Then I should find "There was a problem connecting to the site. Please check your connection and try again." in the app
When I press "OK" in the app When I press "OK" in the app
And I press the back button in the app And I press the back button in the app
And I press "DiscussionSubject 1" in the app And I press "DiscussionSubject 1" in the app
Then I should see "DiscussionSubject 1" Then I should find "DiscussionSubject 1" in the app
And I should see "DiscussionMessage 1" And I should find "DiscussionMessage 1" in the app
But I should not see "There was a problem connecting to the site. Please check your connection and try again." But I should not find "There was a problem connecting to the site. Please check your connection and try again." in the app

View File

@ -734,7 +734,7 @@
return 'ERROR: No matches for text'; return 'ERROR: No matches for text';
} }
} else { } else {
found = findElementsBasedOnText({ text: field, selector: 'input, textarea' })[0]; found = findElementsBasedOnText({ text: field, selector: 'input, textarea, [contenteditable="true"]' })[0];
if (!found) { if (!found) {
return 'ERROR: No matches for text'; return 'ERROR: No matches for text';

View File

@ -683,7 +683,7 @@ class behat_app extends behat_base {
* @Given /^the app should( not)? have opened a browser tab$/ * @Given /^the app should( not)? have opened a browser tab$/
* @param bool $not * @param bool $not
*/ */
public function the_app_should_have_opened_a_browser_tab(bool $not) { public function the_app_should_have_opened_a_browser_tab(bool $not = false) {
$this->spin(function() use ($not) { $this->spin(function() use ($not) {
$openedbrowsertab = count($this->getSession()->getWindowNames()) === 2; $openedbrowsertab = count($this->getSession()->getWindowNames()) === 2;
@ -716,6 +716,66 @@ class behat_app extends behat_base {
$this->getSession()->switchToWindow($names[1]); $this->getSession()->switchToWindow($names[1]);
} }
/**
* Force cron tasks instead of waiting for the next scheduled execution.
*
* @When /^I run cron tasks in the app$/
*/
public function i_run_cron_tasks_in_the_app() {
$session = $this->getSession();
// Force cron tasks execution and wait until they are completed.
$operationid = random_string();
$session->executeScript(
"cronProvider.forceSyncExecution().then(() => { window['behat_{$operationid}_completed'] = true; });"
);
$this->spin(
function() use ($session, $operationid) {
return $session->evaluateScript("window['behat_{$operationid}_completed'] || false");
},
false,
60,
new ExpectationException('Forced cron tasks in the app took too long to complete', $session)
);
// Trigger Angular change detection multiple times in case some changes have
// side-effects that result in further pending operations.
for ($ticks = 5; $ticks > 0; $ticks--) {
$session->executeScript($this->islegacy ? 'appRef.tick();' : 'changeDetector.detectChanges();');
}
}
/**
* Wait until loading has finished.
*
* @When /^I wait loading to finish in the app$/
*/
public function i_wait_loading_to_finish_in_the_app() {
$session = $this->getSession();
$this->spin(
function() use ($session) {
$session->executeScript($this->islegacy ? 'appRef.tick();' : 'changeDetector.detectChanges();');
$nodes = $this->find_all('css', 'core-loading ion-spinner');
foreach ($nodes as $node) {
if (!$node->isVisible()) {
continue;
}
return false;
}
return true;
},
false,
60,
new ExpectationException('"Loading took too long to complete', $session)
);
}
/** /**
* Closes the current browser tab. * Closes the current browser tab.
* *
@ -780,4 +840,17 @@ class behat_app extends behat_base {
return !empty($not); return !empty($not);
} }
/**
* Replaces $WWWROOT for the url of the Moodle site.
*
* @Transform /^(.*\$WWWROOT.*)$/
* @param string $text Text.
* @return string
*/
public function replace_wwwroot($text) {
global $CFG;
return str_replace('$WWWROOT', $CFG->behat_wwwroot, $text);
}
} }

View File

@ -1,113 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Behat step definitions.
*
* @package local_apps
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use Behat\Mink\Exception\ExpectationException;
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
/**
* Behat step definitions.
*
* @package local_apps
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_local_moodlemobileapp extends behat_base {
/**
* Force cron tasks instead of waiting for the next scheduled execution.
*
* @When /^I run cron tasks in the app$/
*/
public function i_run_cron_tasks_in_the_app() {
$session = $this->getSession();
// Force cron tasks execution and wait until they are completed.
$operationid = random_string();
$session->executeScript(
"cronProvider.forceSyncExecution().then(() => { window['behat_{$operationid}_completed'] = true; });"
);
$this->spin(
function() use ($session, $operationid) {
return $session->evaluateScript("window['behat_{$operationid}_completed'] || false");
},
false,
60,
new ExpectationException('Forced cron tasks in the app took too long to complete', $session)
);
// Trigger Angular digest cycle multiple times in case some changes have
// side-effects that result in further pending operations.
for ($ticks = 5; $ticks > 0; $ticks--) {
$session->executeScript('appRef.tick();');
}
}
/**
* Wait until loading has finished.
*
* @When /^I wait loading to finish in the app$/
*/
public function i_wait_loading_to_finish_in_the_app() {
$session = $this->getSession();
$this->spin(
function() use ($session) {
$session->executeScript('appRef.tick();');
$nodes = $this->find_all('css', 'core-loading ion-spinner');
foreach ($nodes as $node) {
if (!$node->isVisible()) {
continue;
}
return false;
}
return true;
},
false,
60,
new ExpectationException('"Loading took too long to complete', $session)
);
}
/**
* Replaces $WWWROOT for the url of the Moodle site.
*
* @Transform /^(.*\$WWWROOT.*)$/
* @param string $text Text.
* @return string
*/
public function arg_replace_wwwroot($text) {
global $CFG;
return str_replace('$WWWROOT', $CFG->behat_wwwroot, $text);
}
}