From 4aecf7fa37f3942be2e7dd002f220be204024588 Mon Sep 17 00:00:00 2001 From: Laurent David Date: Tue, 30 Dec 2025 09:26:33 +0100 Subject: [PATCH] MDL-87304 mod_data: Use saveandview instead of "Save" * As we switched "Save and add another " and "Save", Behat will click on the first "SaveXXXX" button, and go to edit page again for a new entry. Where we were expecting to be back to the view page. --- .../imagegallery/tests/behat/imagegallery_preset.feature | 2 +- .../preset/journal/tests/behat/journal_preset.feature | 2 +- .../preset/proposals/tests/behat/proposals_preset.feature | 2 +- .../preset/resources/tests/behat/resources_preset.feature | 2 +- public/mod/data/tests/behat/required_entries.feature | 8 ++++---- public/mod/data/tests/behat/view_entries.feature | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature b/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature index 471d7013f10..b245e60dc6d 100644 --- a/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature +++ b/public/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature @@ -87,7 +87,7 @@ Feature: Users can use the Image gallery preset When I press "Add entry" And I set the field "title" to "New image" And I set the field "description" to "This is the description for the new image." - And I press "Save" + And I press "saveandview" Then I should see "New image" And I should see "This is the description for the new image." diff --git a/public/mod/data/preset/journal/tests/behat/journal_preset.feature b/public/mod/data/preset/journal/tests/behat/journal_preset.feature index 3013aebac77..33c163e9686 100644 --- a/public/mod/data/preset/journal/tests/behat/journal_preset.feature +++ b/public/mod/data/preset/journal/tests/behat/journal_preset.feature @@ -73,7 +73,7 @@ Feature: Users can use the Journal preset When I press "Add entry" And I set the field "Title" to "This is the title" And I set the field "Content" to "This is the content for the new entry." - And I press "Save" + And I press "saveandview" Then I should see "This is the title" And I should see "This is the content for the new entry." diff --git a/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature b/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature index ca6de0b16f7..a6f5e33cc2e 100644 --- a/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature +++ b/public/mod/data/preset/proposals/tests/behat/proposals_preset.feature @@ -89,7 +89,7 @@ Feature: Users can use the Proposals preset And I set the field "Summary" to "This is the summary for the new entry." And I set the field "Content" to "This is the content for the new entry." And I set the field "Status" to "Approved" - And I press "Save" + And I press "saveandview" Then I should see "This is the title" And I should see "Approved" And I should see "This is the summary for the new entry." diff --git a/public/mod/data/preset/resources/tests/behat/resources_preset.feature b/public/mod/data/preset/resources/tests/behat/resources_preset.feature index 5aed5cb8bb5..a4fc4389d55 100644 --- a/public/mod/data/preset/resources/tests/behat/resources_preset.feature +++ b/public/mod/data/preset/resources/tests/behat/resources_preset.feature @@ -94,7 +94,7 @@ Feature: Users can use the Resources preset And I set the field "Description" to "This is description." And I set the field "Web link" to "https://thisisthelink.cat" And I set the field "Type" to "Type2" - And I press "Save" + And I press "saveandview" Then I should see "This is the title" And I should see "This is the author" And I should see "https://thisisthelink.cat" diff --git a/public/mod/data/tests/behat/required_entries.feature b/public/mod/data/tests/behat/required_entries.feature index 058fbce4490..a9cdb22f6fc 100644 --- a/public/mod/data/tests/behat/required_entries.feature +++ b/public/mod/data/tests/behat/required_entries.feature @@ -90,7 +90,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required URL | http://example.com/ | | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | - When I press "Save" + When I press "saveandview" And I select "List view" from the "jump" singleselect Then I should not see "No entries in database" And I should see "New entry text" @@ -110,7 +110,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required URL | http://example.com/ | | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | - When I press "Save" + When I press "saveandview" Then the following fields match these values: | Base Text input | | | Latitude | 0 | @@ -142,7 +142,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | | Latitude | 20 | - When I press "Save" + When I press "saveandview" Then I should see "Both latitude and longitude are required." Scenario: A student filling in number and text fields with zero will not see an error. @@ -163,7 +163,7 @@ Feature: Users can be required to specify certain fields when adding entries to | Required URL | http://example.com/ | | Required Multimenu | 1 | | Required Two-Option Multimenu | 1 | - When I press "Save" + When I press "saveandview" And I select "List view" from the "jump" singleselect Then I should not see "No entries in database" And I should see "Some input to allow us to submit the otherwise empty form" diff --git a/public/mod/data/tests/behat/view_entries.feature b/public/mod/data/tests/behat/view_entries.feature index b16bf7c272e..e4ccae27922 100644 --- a/public/mod/data/tests/behat/view_entries.feature +++ b/public/mod/data/tests/behat/view_entries.feature @@ -87,7 +87,7 @@ Feature: Users can view and search database entries | Test field name | Student original entry tagged | | Test field 2 name | Student original entry tagged 2 | And I set the field with xpath "//div[@class='datatagcontrol']//input[@type='text']" to "Tag1" - And I press "Save" + And I press "saveandview" And I should see "Student original entry" And I should see "Tag1" in the "div.tag_list" "css_element" And I open the action menu in "#defaulttemplate-single" "css_element"