From 826ed6ace0aea038868cea042e871e380167939e Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Thu, 6 Nov 2025 18:29:38 +0800 Subject: [PATCH] MDL-86701 behat: Update Behat tests to press edit/delete buttons --- .../tests/behat/block_myoverview_customfield.feature | 3 ++- customfield/field/checkbox/tests/behat/field.feature | 6 +++--- customfield/field/date/tests/behat/field.feature | 2 +- customfield/field/number/tests/behat/field.feature | 8 ++++---- customfield/field/select/tests/behat/field.feature | 6 +++--- customfield/field/text/tests/behat/field.feature | 6 +++--- .../field/textarea/tests/behat/default_value.feature | 2 +- customfield/field/textarea/tests/behat/field.feature | 6 +++--- .../columnsortorder/tests/behat/admin_settings.feature | 3 ++- .../columnsortorder/tests/behat/question_bank.feature | 3 ++- 10 files changed, 24 insertions(+), 21 deletions(-) diff --git a/blocks/myoverview/tests/behat/block_myoverview_customfield.feature b/blocks/myoverview/tests/behat/block_myoverview_customfield.feature index 6e199691d22..3a4afb4cd49 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_customfield.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_customfield.feature @@ -181,13 +181,14 @@ Feature: The my overview block allows users to group courses by custom fields And I set the field "Custom field" to "1" Then the "Field to use" select box should not contain "Hidden field" + @core_customfield Scenario: Hidden fields not displayed in the filter Given the following config values are set as admin: | displaygroupingcustomfield | 1 | block_myoverview | | customfiltergrouping | textfield2 | block_myoverview | And I log in as "admin" And I navigate to "Courses > Default settings > Course custom fields" in site administration - And I click on "Edit" "link" in the "Text field 2" "table_row" + And I press "Edit custom field: Text field 2" And I set the field "Visible to" to "Nobody" And I press "Save changes" And I log out diff --git a/customfield/field/checkbox/tests/behat/field.feature b/customfield/field/checkbox/tests/behat/field.feature index 3db7eadd397..f34b607f9f3 100644 --- a/customfield/field/checkbox/tests/behat/field.feature +++ b/customfield/field/checkbox/tests/behat/field.feature @@ -1,4 +1,4 @@ -@customfield @customfield_checkbox @javascript +@core_customfield @customfield_checkbox @javascript Feature: Managers can manage course custom fields checkbox In order to have additional data on the course As a manager @@ -28,7 +28,7 @@ Feature: Managers can manage course custom fields checkbox | Name | Test field | | Short name | testfield | And I click on "Save changes" "button" in the "Adding a new Checkbox" "dialogue" - And I click on "Edit" "link" in the "Test field" "table_row" + And I press "Edit custom field: Test field" And I set the following fields to these values: | Name | Edited field | And I click on "Save changes" "button" in the "Updating Test field" "dialogue" @@ -42,7 +42,7 @@ Feature: Managers can manage course custom fields checkbox | Name | Test field | | Short name | testfield | And I click on "Save changes" "button" in the "Adding a new Checkbox" "dialogue" - And I click on "Delete" "link" in the "Test field" "table_row" + And I press "Delete custom field: Test field" And I click on "Yes" "button" in the "Confirm" "dialogue" Then I should not see "Test field" And I log out diff --git a/customfield/field/date/tests/behat/field.feature b/customfield/field/date/tests/behat/field.feature index 52589b1cc3a..81852b29539 100644 --- a/customfield/field/date/tests/behat/field.feature +++ b/customfield/field/date/tests/behat/field.feature @@ -1,4 +1,4 @@ -@customfield @customfield_date @javascript +@core_customfield @customfield_date @javascript Feature: Managers can manage course custom fields date In order to have additional data on the course As a manager diff --git a/customfield/field/number/tests/behat/field.feature b/customfield/field/number/tests/behat/field.feature index 57b8bdeb875..99a74a3f0da 100644 --- a/customfield/field/number/tests/behat/field.feature +++ b/customfield/field/number/tests/behat/field.feature @@ -1,4 +1,4 @@ -@customfield @customfield_number @javascript +@core_customfield @customfield_number @javascript Feature: Managers can manage course custom fields number In order to have additional data on the course As a manager @@ -36,7 +36,7 @@ Feature: Managers can manage course custom fields number | Short name | numberfield | And I click on "Save changes" "button" in the "Adding a new Number" "dialogue" Then I should see "Number field" - And I click on "Edit" "link" in the "Number field" "table_row" + And I press "Edit custom field: Number field" And I set the following fields to these values: | Name | Edited number field | And I click on "Save changes" "button" in the "Updating Number field" "dialogue" @@ -50,7 +50,7 @@ Feature: Managers can manage course custom fields number | Name | Number field | | Short name | numberfield | And I click on "Save changes" "button" in the "Adding a new Number" "dialogue" - And I click on "Delete" "link" in the "Number field" "table_row" + And I press "Delete custom field: Number field" And I click on "Yes" "button" in the "Confirm" "dialogue" And I wait until the page is ready And I wait until "Number field" "text" does not exist @@ -186,7 +186,7 @@ Feature: Managers can manage course custom fields number And I log in as "admin" And I navigate to "Courses > Default settings > Course custom fields" in site administration - And I click on "Edit" "link" in the "Number field" "table_row" + And I press "Edit custom field: Number field" And I set the following fields to these values: | Display when zero | | And I click on "Save changes" "button" in the "Updating Number field" "dialogue" diff --git a/customfield/field/select/tests/behat/field.feature b/customfield/field/select/tests/behat/field.feature index 3332cc8df30..e47c6f862e9 100644 --- a/customfield/field/select/tests/behat/field.feature +++ b/customfield/field/select/tests/behat/field.feature @@ -1,4 +1,4 @@ -@customfield @customfield_select @javascript +@core_customfield @customfield_select @javascript Feature: Managers can manage course custom fields select In order to have additional data on the course As a manager @@ -38,7 +38,7 @@ Feature: Managers can manage course custom fields select b """ And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" - And I click on "Edit" "link" in the "Test field" "table_row" + And I press "Edit custom field: Test field" And I set the following fields to these values: | Name | Edited field | And I click on "Save changes" "button" in the "Updating Test field" "dialogue" @@ -58,7 +58,7 @@ Feature: Managers can manage course custom fields select b """ And I click on "Save changes" "button" in the "Adding a new Dropdown menu" "dialogue" - And I click on "Delete" "link" in the "Test field" "table_row" + And I press "Delete custom field: Test field" And I click on "Yes" "button" in the "Confirm" "dialogue" Then I should not see "Test field" And I log out diff --git a/customfield/field/text/tests/behat/field.feature b/customfield/field/text/tests/behat/field.feature index 4dc4e77abf3..925c1170ab5 100644 --- a/customfield/field/text/tests/behat/field.feature +++ b/customfield/field/text/tests/behat/field.feature @@ -1,4 +1,4 @@ -@customfield @customfield_text @javascript +@core_customfield @customfield_text @javascript Feature: Managers can manage course custom fields text In order to have additional data on the course As a manager @@ -28,7 +28,7 @@ Feature: Managers can manage course custom fields text | Name | Test field | | Short name | testfield | And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue" - And I click on "Edit" "link" in the "Test field" "table_row" + And I press "Edit custom field: Test field" And I set the following fields to these values: | Name | Edited field | And I click on "Save changes" "button" in the "Updating Test field" "dialogue" @@ -44,7 +44,7 @@ Feature: Managers can manage course custom fields text | Name | Test field | | Short name | testfield | And I click on "Save changes" "button" in the "Adding a new Short text" "dialogue" - And I click on "Delete" "link" in the "Test field" "table_row" + And I press "Delete custom field: Test field" And I click on "Yes" "button" in the "Confirm" "dialogue" And I wait until the page is ready And I wait until "Test field" "text" does not exist diff --git a/customfield/field/textarea/tests/behat/default_value.feature b/customfield/field/textarea/tests/behat/default_value.feature index a1c39c26701..68097c91fe4 100644 --- a/customfield/field/textarea/tests/behat/default_value.feature +++ b/customfield/field/textarea/tests/behat/default_value.feature @@ -1,4 +1,4 @@ -@customfield @customfield_textarea @javascript @editor_tiny +@core_customfield @customfield_textarea @javascript @editor_tiny Feature: Default value for the textarea custom field can contain images In order to see images on custom fields As a manager diff --git a/customfield/field/textarea/tests/behat/field.feature b/customfield/field/textarea/tests/behat/field.feature index 4929fed95fe..a518ccc858a 100644 --- a/customfield/field/textarea/tests/behat/field.feature +++ b/customfield/field/textarea/tests/behat/field.feature @@ -1,4 +1,4 @@ -@customfield @customfield_textarea @javascript +@core_customfield @customfield_textarea @javascript Feature: Managers can manage course custom fields textarea In order to have additional data on the course As a manager @@ -28,7 +28,7 @@ Feature: Managers can manage course custom fields textarea | Name | Test field | | Short name | testfield | And I click on "Save changes" "button" in the "Adding a new Text area" "dialogue" - And I click on "Edit" "link" in the "Test field" "table_row" + And I press "Edit custom field: Test field" And I set the following fields to these values: | Name | Edited field | And I click on "Save changes" "button" in the "Updating Test field" "dialogue" @@ -43,7 +43,7 @@ Feature: Managers can manage course custom fields textarea | Name | Test field | | Short name | testfield | And I click on "Save changes" "button" in the "Adding a new Text area" "dialogue" - And I click on "Delete" "link" in the "Test field" "table_row" + And I press "Delete custom field: Test field" And I click on "Yes" "button" in the "Confirm" "dialogue" Then I should not see "Test field" And I log out diff --git a/question/bank/columnsortorder/tests/behat/admin_settings.feature b/question/bank/columnsortorder/tests/behat/admin_settings.feature index 251c169ee81..56a040f8cfc 100644 --- a/question/bank/columnsortorder/tests/behat/admin_settings.feature +++ b/question/bank/columnsortorder/tests/behat/admin_settings.feature @@ -115,6 +115,7 @@ Feature: Set default question bank column order and size And "Question" "table_row" should appear before "Comments" "table_row" And the field "Width of 'Question' in pixels" matches value "" + @core_customfield Scenario: Deleting a custom field which is removed from the Column sort order Given the following "custom field categories" exist: | name | component | area | itemid | @@ -132,7 +133,7 @@ Feature: Set default question bank column order and size # Delete a question custom field. And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration - And I click on "Delete" "link" in the "Field 1" "table_row" + And I press "Delete custom field: Field 1" And I click on "Yes" "button" in the "Confirm" "dialogue" And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration Then I should see "Column sort order" diff --git a/question/bank/columnsortorder/tests/behat/question_bank.feature b/question/bank/columnsortorder/tests/behat/question_bank.feature index e9153189c7a..64ac8490ace 100644 --- a/question/bank/columnsortorder/tests/behat/question_bank.feature +++ b/question/bank/columnsortorder/tests/behat/question_bank.feature @@ -139,6 +139,7 @@ Feature: Set question bank column order and size And "Create a new question" "button" should exist # Really, we are just checking the question bank displayed without errors. + @core_customfield Scenario: Deleting a custom field which a user had removed from his preferences Given the following "custom field categories" exist: | name | component | area | itemid | @@ -156,7 +157,7 @@ Feature: Set question bank column order and size # Delete a question custom field. And I log in as "admin" And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration - And I click on "Delete" "link" in the "Field 1" "table_row" + And I press "Delete custom field: Field 1" And I click on "Yes" "button" in the "Confirm" "dialogue" And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1" And I apply question bank filter "Category" with value "Question category 1"