MDL-76169 behat: Add improved steps for using action menus

This commit adds new steps related to action menus to support:
* Choosing an item in a named action menu
* Choosing an item in a named action menu within a container
* Confirming that an action menu item does or does not exist in a named
  action menu
* Confirming that an action menu item does or does not exist in a named
  action menu within a container

The existing action menu steps were insufficient as they assume that
there is only one action menu within he container, which is not
necessarily the case.

The existing action menu steps are not non-JS friendly and will error if
JS is disabled, without providing any fallback when one is easily
available.

Unfortunately these steps cannot be used to replace the existing steps
without manual intervention.
This commit is contained in:
Andrew Nicols 2022-11-02 10:36:37 +08:00
parent 720bd60fc6
commit 232ebac338
3 changed files with 159 additions and 29 deletions

View file

@ -1,27 +1,27 @@
@mod @mod_data
Feature: Users can view and manage data presets
In order to use presets
As a user
I need to view, manage and use presets
In order to use presets
As a user
I need to view, manage and use presets
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Mountain landscapes | n | C1 | data1 |
And the following "mod_data > presets" exist:
| database | name | description | user |
| data1 | Saved preset 1 | The preset1 has description | admin |
| data1 | Saved preset 2 | | admin |
| data1 | Saved preset by teacher1 | This preset has also a description | teacher1 |
| database | name | description | user |
| data1 | Saved preset 1 | The preset1 has description | admin |
| data1 | Saved preset 2 | | admin |
| data1 | Saved preset by teacher1 | This preset has also a description | teacher1 |
@javascript
Scenario: Admins can delete saved presets
@ -71,11 +71,11 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Only users with the viewalluserpresets capability can see presets created by other users
Given the following "permission override" exists:
| role | editingteacher |
| capability | mod/data:viewalluserpresets |
| permission | Prohibit |
| contextlevel | System |
| reference | |
| role | editingteacher |
| capability | mod/data:viewalluserpresets |
| permission | Prohibit |
| contextlevel | System |
| reference | |
When I am on the "Mountain landscapes" "data activity" page logged in as teacher1
And I follow "Presets"
Then I should see "Image gallery"
@ -86,8 +86,8 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Teachers can save presets
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Test field name | Test field description |
| database | type | name | description |
| data1 | text | Test field name | Test field description |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
And I follow "Templates"
When I click on "Save as preset" "button"
@ -173,10 +173,10 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Teachers can edit presets and overwrite them if they are the authors
Given the following "mod_data > preset" exists:
| database | data1 |
| name | Another preset created by teacher1 |
| description | This description will be overwritten |
| user | teacher1 |
| database | data1 |
| name | Another preset created by teacher1 |
| description | This description will be overwritten |
| user | teacher1 |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
When I follow "Presets"
And I open the action menu in "Saved preset by teacher1" "table_row"
@ -240,11 +240,11 @@ Feature: Users can view and manage data presets
@javascript
Scenario: Teachers can delete their own presets
Given the following "mod_data > fields" exist:
| database | type | name | description |
| data1 | text | Test field name | Test field description |
| database | type | name | description |
| data1 | text | Test field name | Test field description |
And the following "mod_data > presets" exist:
| database | name | description | user |
| data1 | Saved preset by teacher1 | My funny description goes here. | teacher1 |
| database | name | description | user |
| data1 | Saved preset by teacher1 | My funny description goes here. | teacher1 |
And I am on the "Mountain landscapes" "data activity" page logged in as teacher1
When I follow "Presets"
And I should see "Image gallery"