Skip to content

Commit

Permalink
MOBILE-4600 data: Fix related behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed May 24, 2024
1 parent 98126cb commit 067fea2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
53 changes: 36 additions & 17 deletions src/addons/mod/data/tests/behat/entries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Feature: Users can manage entries in database activities
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
And I press "Save" near "Web links" in the app
And I press "Show more" near "Moodle community site" in the app
And I press "Actions menu" near "Moodle community site" in the app
And I press "Show more" in the app
Then I should find "Moodle community site" in the app
And I should not find "Comments" in the app
And I should be able to press "Previous" in the app
Expand All @@ -83,14 +84,16 @@ Feature: Users can manage entries in database activities
And I set the following fields to these values in the app:
| Description | Moodle community site |
And I press "Save" near "Data with comments" in the app
And I press "Show more" near "Moodle community site" in the app
And I press "Actions menu" near "Moodle community site" in the app
And I press "Show more" in the app
Then I should find "Moodle community site" in the app
And I should find "Comments" in the app

Given the following config values are set as admin:
| usecomments | 0 |
And I entered the data activity "Data with comments" on course "Course 1" as "student1" in the app
When I press "Show more" near "Moodle community site" in the app
When I press "Actions menu" near "Moodle community site" in the app
And I press "Show more" in the app
Then I should not find "Comments" in the app
But the following events should have been logged for "student1" in the app:
| name | activity | activityname | course |
Expand All @@ -106,9 +109,11 @@ Feature: Users can manage entries in database activities
And I press "Save" near "Web links" in the app
And I entered the course "Course 1" as "student2" in the app
When I press "Web links" near "General" in the app
And I press "Actions menu" in the app
Then "Edit" "link" should not exist
And "Delete" "link" should not exist
And I press "Show more" in the app
When I press "Show more" in the app
And "Actions menu" "link" should not exist
And "Edit" "link" should not exist
And "Delete" "link" should not exist

Expand All @@ -121,7 +126,8 @@ Feature: Users can manage entries in database activities
And I press "Save" near "Web links" in the app

# Edit the entry from list view.
When I press "Edit" in the app
When I press "Actions menu" in the app
And I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
Expand All @@ -132,11 +138,13 @@ Feature: Users can manage entries in database activities
And I should find "Moodle Cloud" in the app

# Delete the entry from list view.
When I press "Delete" in the app
When I press "Actions menu" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
When I press "Delete" in the app
When I press "Actions menu" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app
Expand All @@ -149,7 +157,9 @@ Feature: Users can manage entries in database activities
And I press "Save" near "Web links" in the app

# Edit the entry from single view.
When I press "Show more" in the app
When I press "Actions menu" in the app
And I press "Show more" in the app
And I press "Actions menu" in the app
And I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
Expand All @@ -161,11 +171,13 @@ Feature: Users can manage entries in database activities
And I should find "Moodle Cloud" in the app

# Delete the entry from list view.
When I press "Delete" in the app
When I press "Actions menu" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
When I press "Delete" in the app
When I press "Actions menu" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app
Expand All @@ -190,7 +202,8 @@ Feature: Users can manage entries in database activities
And I should find "Moodle community site" in the app

# Edit the entry from list view.
When I press "Edit" near "Moodle community site" in the app
When I press "Actions menu" near "Moodle community site" in the app
And I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
Expand All @@ -201,19 +214,23 @@ Feature: Users can manage entries in database activities
And I should find "Moodle Cloud" in the app

# Delete the entry from list view.
When I press "Delete" near "Moodle Cloud" in the app
When I press "Actions menu" near "Moodle Cloud" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
When I press "Delete" near "Moodle Cloud" in the app
When I press "Actions menu" near "Moodle Cloud" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app

# Edit the entry from single view.
When I press "Show more" in the app
When I press "Actions menu" in the app
And I press "Show more" in the app
And I should find "https://telegram.org/" in the app
And I should find "Telegram" in the app
And I press "Actions menu" in the app
And I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
Expand All @@ -225,11 +242,13 @@ Feature: Users can manage entries in database activities
And I should find "Moodle Cloud" in the app

# Delete the entry from single view.
When I press "Delete" in the app
When I press "Actions menu" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Cancel" in the app
And I should find "Moodle Cloud" in the app
When I press "Delete" in the app
When I press "Actions menu" in the app
And I press "Delete" in the app
Then I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should not find "Moodle Cloud" in the app
Expand All @@ -250,5 +269,5 @@ Feature: Users can manage entries in database activities
And I set the following fields to these values in the app:
| Number | 0 |
And I press "Save" near "Number DB" in the app
Then I should find "0" near "Number:" in the app
Then I should find "0" in the app
But I should not find "Save" in the app
6 changes: 5 additions & 1 deletion src/addons/mod/data/tests/behat/sync.feature
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ Feature: Users can store entries in database activities when offline and sync wh
And I wait until the page is ready
And I close the popup in the app
And I switch network connection to offline
When I press "Edit" in the app
When I press "Actions menu" in the app
And I press "Edit" in the app
And I set the following fields to these values in the app:
| URL | https://moodlecloud.com/ |
| Description | Moodle Cloud |
Expand All @@ -83,6 +84,7 @@ Feature: Users can store entries in database activities when offline and sync wh
And I press "Refresh" in the app
And I wait until the page is ready
And I switch network connection to offline
And I press "Actions menu" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
Expand Down Expand Up @@ -111,12 +113,14 @@ Feature: Users can store entries in database activities when offline and sync wh
And I wait until the page is ready
And I close the popup in the app
When I switch network connection to offline
And I press "Actions menu" in the app
And I press "Delete" in the app
And I should find "Are you sure you want to delete this entry?" in the app
And I press "Delete" in the app
And I should find "https://moodle.org/" in the app
And I should find "Moodle community site" in the app
And I should find "This Database has offline data to be synchronised" in the app
And I press "Actions menu" in the app
And I press "Restore" in the app
And I press the back button in the app
And I switch network connection to wifi
Expand Down
3 changes: 3 additions & 0 deletions src/core/features/comments/tests/behat/basic_usage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Feature: Test basic usage of comments in app
And I press "Add entries" in the app
And I set the field "Test field name" to "Test" in the app
And I press "Save" in the app
And I press "Actions menu" in the app
And I press "Show more" in the app
And I press "Comments (0)" in the app
And I set the field "Add a comment..." to "comment test teacher" in the app
Expand All @@ -45,6 +46,7 @@ Feature: Test basic usage of comments in app

# Create and delete comments as a student
Given I entered the data activity "Data" on course "Course 1" as "student1" in the app
And I press "Actions menu" in the app
And I press "Show more" in the app
And I press "Comments (1)" in the app
And I set the field "Add a comment..." to "comment test student" in the app
Expand All @@ -70,6 +72,7 @@ Feature: Test basic usage of comments in app
And I press "Add entries" in the app
And I set the field "Test field name" to "Test" in the app
And I press "Save" in the app
And I press "Actions menu" in the app
And I press "Show more" in the app
And I press "Comments (0)" in the app
And I switch network connection to offline
Expand Down

0 comments on commit 067fea2

Please sign in to comment.