From 641d75bde6694cccc80884b6a40ac6e47fa2e2f9 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 23 Apr 2017 18:13:02 +0200 Subject: [PATCH] MDL-58681 behat: Split checkbox and advcheckbox tests MDL-58267 converted "Display description on course page" to advcheckbox (see 7f53e8aa22d555ba5f94530b7fc04a4e95f35c98). Advanced checkboxes cannot be tested without real browser because Goutte does not support the hidden+checkbox duality (MDL-55386). So this patch does: - Convert the NON-JS checks to use the "Force format" field (normal checkbox). - Move the "Display description on course page" (adv. checkbox) to the JS scenario. - Complete the 2 groups of checks above so the two ways to tick and untick are covered: - I set the field "xxxx" to "yyyy" - I set the following fields to these values: - Complete the 2 groups of checks above so the two ways to verify the values are covered: - the field "xxxx" [matches|does not match] value "yyyy" - the following fields [match|do not match] these values: That's all! The scenario is a bit spaghetti but it's way off the scope of the issue to fix that. --- .../tests/behat/get_and_set_fields.feature | 94 +++++++++++++++---- 1 file changed, 77 insertions(+), 17 deletions(-) diff --git a/admin/tool/behat/tests/behat/get_and_set_fields.feature b/admin/tool/behat/tests/behat/get_and_set_fields.feature index 151a59deb43..62a6fe84c94 100644 --- a/admin/tool/behat/tests/behat/get_and_set_fields.feature +++ b/admin/tool/behat/tests/behat/get_and_set_fields.feature @@ -58,30 +58,51 @@ Feature: Verify that all form fields values can be get and set # Select (multi-select) - Checking "I set the field". And I navigate to "Edit settings" in current page administration And I expand all fieldsets - # Checkbox - Checking "I set the field". - And I set the field "Display description on course page" to "1" - # Checkbox - Checking "I set the following fields to these values:". + # Checkbox - Checking "I set the field" and "The field matches value" ticked. + And I set the field "Force format" to "1" + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And I expand all fieldsets + And the field "Force format" matches value "1" + And the field "Force format" does not match value "" + # Checkbox - Checking "I set the field" and "The field matches value" unticked. + And I set the field "Force format" to "" + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And I expand all fieldsets + And the field "Force format" matches value "" + And the field "Force format" does not match value "1" + # Checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" ticked. And I set the following fields to these values: | Force format | 1 | - # Checkbox - Checking "the field matches value" and "the field does not match value". - And the field "Display description on course page" matches value "1" - And the field "Display description on course page" does not match value "" And I press "Save and return to course" And I should see "Test this one" And I follow "Test this one" And I navigate to "Edit settings" in current page administration - # Checkbox - Checking "the field matches value" and "the following fields match these values". + And I expand all fieldsets And the following fields match these values: - | Display description on course page | 1 | - | Default format | HTML | - | Wiki name | Test this one | - And the field "Force format" matches value "1" + | Force format | 1 | + And the following fields do not match these values: + | Force format | | + # Checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" unticked. + And I set the following fields to these values: + | Force format | | + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And I expand all fieldsets + And the following fields match these values: + | Force format | | + And the following fields do not match these values: + | Force format | 1 | # Select (simple) - Checking "I set the following fields to these values:". And I set the following fields to these values: | Default format | NWiki | - | Display description on course page | | - # Checkbox - Checking "I set the field" to uncheck. - And I set the field "Force format" to "" # Select (simple) - Checking "I set the field". And I set the field "Group mode" to "Separate groups" And I press "Save and display" @@ -89,13 +110,10 @@ Feature: Verify that all form fields values can be get and set And the following fields match these values: | Default format | NWiki | | Group mode | Separate groups | - | Display description on course page | | - | Force format | | # All fields - Checking "the following fields do not match these values". And the following fields do not match these values: | Wiki name | Test this one baby | | Default format | HTML | - | Force format | 1 | And I press "Cancel" And I am on "Course 1" course homepage # Radio - Checking "I set the field" and "the field matches value". @@ -154,3 +172,45 @@ Feature: Verify that all form fields values can be get and set And the "available[day]" "field" should be enabled And the field "deadline[enabled]" matches value "1" And I press "Cancel" + # Advanced checkbox requires real browser to allow uncheck to work. MDL-58681. MDL-55386. + # Advanced checkbox - Checking "I set the field" and "The field matches value" ticked. + And I am on "Course 1" course homepage + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And I set the field "Display description on course page" to "1" + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And the field "Display description on course page" matches value "1" + And the field "Display description on course page" does not match value "" + # Advanced checkbox - Checking "I set the field" and "The field matches value" unticked. + And I set the field "Display description on course page" to "" + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And the field "Display description on course page" matches value "" + And the field "Display description on course page" does not match value "1" + # Advanced checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" ticked. + And I set the following fields to these values: + | Display description on course page | 1 | + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And the following fields match these values: + | Display description on course page | 1 | + And the following fields do not match these values: + | Display description on course page | | + # Advanced checkbox - Checking "I set the following fields to these values:" and "The following fields match these values" unticked. + And I set the following fields to these values: + | Display description on course page | | + And I press "Save and return to course" + And I should see "Test this one" + And I follow "Test this one" + And I navigate to "Edit settings" in current page administration + And the following fields match these values: + | Display description on course page | | + And the following fields do not match these values: + | Display description on course page | 1 | -- 2.43.0