Skip to content

Commit

Permalink
MDL-79496 webservice: Fix webservice behat tests
Browse files Browse the repository at this point in the history
- Move all webservice related behat tests to the correct namespace.
- Add missing @core_webservice tags
- Fix behat scenarios after systemreport conversion.
  • Loading branch information
roland04 committed Nov 3, 2023
1 parent 556a99b commit e1be190
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@core @core_admin
@core @core_admin @core_webservice
Feature: Manage external services tokens
In order to manage external service usage
As an admin
Expand All @@ -11,7 +11,6 @@ Feature: Manage external services tokens
| user2 | user2 | Firstname2 | Lastname2 |
| user3 | user3 | Firstname3 | Lastname3 |
| user4 | user4 | Firstname4 | Lastname4 |
And I change window size to "small"

@javascript
Scenario: Add a token to user identified by name and then delete that token
Expand All @@ -25,7 +24,7 @@ Feature: Manage external services tokens
And I set the field "IP restriction" to "127.0.0.1"
When I press "Save changes"
Then the following should exist in the "generaltable" table:
| Name | First name | Service | IP restriction | Last access |
| Name | User | Service | IP restriction | Last access |
| Webservice1 | Firstname1 Lastname1 | Moodle mobile web service | 127.0.0.1 | Never |

# Verify the message and the "Copy to clipboard" button.
Expand All @@ -38,7 +37,7 @@ Feature: Manage external services tokens
And "Copy to clipboard" "button" should not exist

# Delete token.
And I click on "Delete" "link" in the "Webservice1" "table_row"
And I press "Delete" action in the "Webservice1" report row
And I should see "Do you really want to delete this web service token for Firstname1 Lastname1 on the service Moodle mobile web service?"
And I press "Delete"
And "Webservice1" "table_row" should not exist
Expand All @@ -53,10 +52,10 @@ Feature: Manage external services tokens
| service | siteinfo |
| functions | core_webservice_get_site_info |
And the following "core_webservice > Tokens" exist:
| user | service | name |
| user2 | siteinfo | WEBservice1 |
| user3 | moodle_mobile_app | webservicE3 |
| user4 | siteinfo | New service2 |
| user | service | name | validuntil |
| user2 | siteinfo | WEBservice1 | ## yesterday ## |
| user3 | moodle_mobile_app | webservicE3 | ## +1 year ## |
| user4 | siteinfo | New service2 | ## +1 year ## |
When I log in as "admin"
And I navigate to "Server > Web services > Manage tokens" in site administration

Expand All @@ -66,38 +65,48 @@ Feature: Manage external services tokens
And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
And I should see "Site information" in the "Firstname4 Lastname4" "table_row"

# Filter tokens by by name (case-insensitive).
And I click on "Tokens filter" "link"
And I set the field "Name" to "webservice"
And I press "Show only matching tokens"
# Filter tokens by by name.
And I click on "Filters" "button"
And I set the following fields in the "Name" "core_reportbuilder > Filter" to these values:
| Name operator | Contains |
| Name value | webservice |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
And "Firstname4 Lastname4" "table_row" should not exist
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"

# Reset the filter.
And I press "Show all tokens"
# Filter tokens by user.
And I set the following fields in the "User" "core_reportbuilder > Filter" to these values:
| User operator | Contains |
| User value | Firstname2 |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then "Firstname3 Lastname3" "table_row" should not exist
And "Firstname4 Lastname4" "table_row" should not exist
And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"

# Filter tokens by service.
And I set the following fields in the "Service" "core_reportbuilder > Filter" to these values:
| Service value | Site information |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
And I should see "Site information" in the "Firstname4 Lastname4" "table_row"
And "Firstname3 Lastname3" "table_row" should not exist
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"

# Filter tokens by user (note we can select the user by the identity field here).
When I click on "Tokens filter" "link"
And I set the field "User" to "[email protected]"
And I press "Show only matching tokens"
# Filter tokens by valid date.
And I set the following fields in the "Valid until" "core_reportbuilder > Filter" to these values:
| Valid until operator | Last |
| Valid until value | 2 |
| Valid until unit | day(s) |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then "Firstname3 Lastname3" "table_row" should not exist
And "Firstname4 Lastname4" "table_row" should not exist
And I should see "Site information" in the "Firstname2 Lastname2" "table_row"

# Reset the filter.
And I press "Show all tokens"
# Reset the filters.
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
And I should see "Site information" in the "Firstname4 Lastname4" "table_row"

# Filter tokens by service.
And I click on "Tokens filter" "link"
And I set the field "Service" to "Site information"
And I press "Show only matching tokens"
And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
And I should see "Site information" in the "Firstname4 Lastname4" "table_row"
And "Firstname3 Lastname3" "table_row" should not exist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@core @core_admin @javascript
@core @core_admin @core_webservice @javascript
Feature: Verify the breadcrumbs in external webservice site administration pages
Whenever I navigate to external webservice page in site administration
As an admin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@core @core_admin @javascript
@core @core_admin @core_webservice @javascript
Feature: Verify the breadcrumbs in webservice tokens site administration pages
Whenever I navigate to manage tokens page in site administration
As an admin
Expand All @@ -19,7 +19,7 @@ Feature: Verify the breadcrumbs in webservice tokens site administration pages
And "Web services" "link" should exist in the ".breadcrumb" "css_element"
And I set the field "User" to "John Doe"
And I press "Save changes"
When I click on "Delete" "link"
When I press "Delete" action in the "John Doe" report row
Then "Delete token" "text" should exist in the ".breadcrumb" "css_element"
And "Manage tokens" "link" should exist in the ".breadcrumb" "css_element"
And "Web services" "link" should exist in the ".breadcrumb" "css_element"
File renamed without changes.

0 comments on commit e1be190

Please sign in to comment.