MDL-75137 mod_data: Fix and improve behat tests

This commit is contained in:
Amaia Anabitarte 2022-07-13 12:45:37 +02:00
parent 8768a7adb9
commit e08458cc23
5 changed files with 60 additions and 5 deletions

View File

@ -73,7 +73,7 @@ Feature: Users can add entries to database activities
And I press "Select all"
And I press "Delete selected"
And I press "Delete"
And I should see "No entries in database"
And I should see "No entries yet"
@javascript @editor @editor_atto @atto @atto_h5p
Scenario: If a new text area entry is added, the filepicker is displayed in the H5P Atto button
@ -128,3 +128,21 @@ Feature: Users can add entries to database activities
And I log out
When I am on the "Test database name" "data activity" page logged in as "guest"
Then I should not see "Add entry"
@javascript
Scenario Outline: Users see the Add entry button in the view page when some field has been created only.
Given I am on the "Test database name" "data activity" page logged in as <user>
And I should not see "Add entry"
When I log out
And I am on the "Test database name" "data activity" page logged in as teacher1
And I add a "Text input" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
And I log out
And I am on the "Test database name" "data activity" page logged in as <user>
Then I should see "Add entry"
Examples:
| user |
| teacher1 |
| student1 |

View File

@ -42,6 +42,10 @@ Feature: View activity completion in the database activity
Scenario: View automatic completion items as a teacher
Given I am on the "Music history" "data activity" page logged in as teacher1
# We add an entry to let the user change to a different view.
When I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Make entries: 2" completion condition
And "Music history" should have the "Receive a grade" completion condition

View File

@ -55,9 +55,11 @@ Feature: Completion pass grade
And I log out
Scenario: View automatic completion items as a teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
When I follow "Music history"
Given I am on the "Music history" "data activity" page logged in as teacher1
# We add an entry to let the user change to a different view.
When I add an entry to "Music history" database with:
| Instrument types | Drums |
And I press "Save"
Then "Music history" should have the "View" completion condition
And "Music history" should have the "Make entries: 2" completion condition
And "Music history" should have the "Receive a grade" completion condition

View File

@ -151,7 +151,7 @@ Feature: Users can be required to specify certain fields when adding entries to
And ".alert" "css_element" should not exist in the "Not required Multimenu" "table_row"
And I am on "Course 1" course homepage
And I follow "Test database name"
And I should see "No entries in database"
And I should see "No entries yet"
Scenario: Students recieve no error for filled in required fields
When I log in as "student1"

View File

@ -0,0 +1,31 @@
@mod @mod_data
Feature: Zero state page (no fields created)
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| data | Test database name | n | C1 | data1 |
@javascript
Scenario: Teachers see buttons to manage database when there is no field created
Given I am on the "Test database name" "data activity" page logged in as "teacher1"
And "Import a preset" "button" should exist
When I click on "Import a preset" "button"
Then I should see "Import from zip file"
And I am on the "Test database name" "data activity" page
And "Create a new field" "button" should exist
And I click on "Create a new field" "button"
And I should see "Manage fields"
And I am on the "Test database name" "data activity" page
And "Use preset" "button" should exist
And I click on "Use preset" "button"
And I should see "Presets"