From 0f84b17ecafb20bdcc0fc1317c383557233b8ae8 Mon Sep 17 00:00:00 2001 From: Neill Magill Date: Wed, 9 Aug 2017 15:15:39 +0100 Subject: [PATCH 1/2] MDL-58435 behat: Behat section editing step should work on section 0 --- course/tests/behat/behat_course.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index 4b20f931a1b..52f4354e367 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -399,7 +399,7 @@ class behat_course extends behat_base { // We need to know the course format as the text strings depends on them. $courseformat = $this->get_course_format(); - if (get_string_manager()->string_exists('editsection', $courseformat)) { + if ($sectionnumber > 0 && get_string_manager()->string_exists('editsection', $courseformat)) { $stredit = get_string('editsection', $courseformat); } else { $stredit = get_string('editsection'); From 156a0a1560ec7d8a734300e07e071a0c4918e924 Mon Sep 17 00:00:00 2001 From: Neill Magill Date: Tue, 15 Aug 2017 09:22:31 +0100 Subject: [PATCH 2/2] MDL-58435 behat: Update existing tests to use section editing steps --- .../tests/behat/edit_delete_sections.feature | 8 +++----- .../tests/behat/edit_delete_sections.feature | 16 +++++----------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/course/format/topics/tests/behat/edit_delete_sections.feature b/course/format/topics/tests/behat/edit_delete_sections.feature index bdb48f3888f..e55b58deff9 100644 --- a/course/format/topics/tests/behat/edit_delete_sections.feature +++ b/course/format/topics/tests/behat/edit_delete_sections.feature @@ -24,20 +24,18 @@ Feature: Sections can be edited and deleted in topics format And I am on "Course 1" course homepage with editing mode on Scenario: View the default name of the general section in topics format - When I click on "Edit section" "link" in the "li#section-0" "css_element" + When I edit the section "0" Then the field "Custom" matches value "0" And the field "New value for Section name" matches value "General" Scenario: Edit the default name of the general section in topics format - When I click on "Edit section" "link" in the "li#section-0" "css_element" - And I set the following fields to these values: + When I edit the section "0" and I fill the form with: | Custom | 1 | | New value for Section name | This is the general section | - And I press "Save changes" Then I should see "This is the general section" in the "li#section-0" "css_element" Scenario: View the default name of the second section in topics format - When I click on "Edit topic" "link" in the "li#section-2" "css_element" + When I edit the section "2" Then the field "Custom" matches value "0" And the field "New value for Section name" matches value "Topic 2" diff --git a/course/format/weeks/tests/behat/edit_delete_sections.feature b/course/format/weeks/tests/behat/edit_delete_sections.feature index 7e1d1758859..a51a803a322 100644 --- a/course/format/weeks/tests/behat/edit_delete_sections.feature +++ b/course/format/weeks/tests/behat/edit_delete_sections.feature @@ -24,37 +24,31 @@ Feature: Sections can be edited and deleted in weeks format And I am on "Course 1" course homepage with editing mode on Scenario: View the default name of the general section in weeks format - When I click on "Edit section" "link" in the "li#section-0" "css_element" + When I edit the section "0" Then the field "Custom" matches value "0" And the field "New value for Section name" matches value "General" Scenario: Edit the default name of the general section in weeks format - When I click on "Edit section" "link" in the "li#section-0" "css_element" - And I set the following fields to these values: + When I edit the section "0" and I fill the form with: | Custom | 1 | | New value for Section name | This is the general section | - And I press "Save changes" Then I should see "This is the general section" in the "li#section-0" "css_element" Scenario: View the default name of the second section in weeks format - When I click on "Edit week" "link" in the "li#section-2" "css_element" + When I edit the section "2" Then the field "Custom" matches value "0" And the field "New value for Section name" matches value "8 May - 14 May" Scenario: Edit section summary in weeks format - When I click on "Edit week" "link" in the "li#section-2" "css_element" - And I set the following fields to these values: + When I edit the section "2" and I fill the form with: | Summary | Welcome to section 2 | - And I press "Save changes" Then I should see "Welcome to section 2" in the "li#section-2" "css_element" Scenario: Edit section default name in weeks format Given I should see "8 May - 14 May" in the "li#section-2" "css_element" - When I click on "Edit week" "link" in the "li#section-2" "css_element" - And I set the following fields to these values: + When I edit the section "2" and I fill the form with: | Custom | 1 | | New value for Section name | This is the second week | - And I press "Save changes" Then I should see "This is the second week" in the "li#section-2" "css_element" And I should not see "8 May - 14 May" in the "li#section-2" "css_element"