From 3c3090b6f96957c374d0be4fa1975d60358a0a8d Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Thu, 14 Apr 2022 11:45:43 +0200 Subject: [PATCH] MDL-74502 behat: when setting a field value it may not be visible for example in case of editor field, the textarea element is hidden by wysiwyg widget but we still need to be able to set it --- .../tests/behat/get_and_set_fields_in_containers.feature | 8 ++++++-- lib/tests/behat/behat_forms.php | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/admin/tool/behat/tests/behat/get_and_set_fields_in_containers.feature b/admin/tool/behat/tests/behat/get_and_set_fields_in_containers.feature index 86d37a1f0ba..cf4d00f15df 100644 --- a/admin/tool/behat/tests/behat/get_and_set_fields_in_containers.feature +++ b/admin/tool/behat/tests/behat/get_and_set_fields_in_containers.feature @@ -7,8 +7,8 @@ Feature: Behat steps for interacting with form work @javascript Scenario: Test fields in containers Given the following "courses" exist: - | fullname | shortname | - | Course 1 | C1 | + | fullname | shortname | summary | summaryformat | + | Course 1 | C1 | Red | 1 | When I log in as "admin" And I am on "Course 1" course homepage # Just get to any form. @@ -17,11 +17,15 @@ Feature: Behat steps for interacting with form work And I set the following fields in the "Appearance" "fieldset" to these values: | Show activity reports | Yes | | Number of announcements | 1 | + And I set the following fields in the "Description" "fieldset" to these values: + | Course summary | Green | Then the field "Show activity reports" in the "Appearance" "fieldset" matches value "Yes" And the field "Show activity reports" in the "Appearance" "fieldset" does not match value "No" And the following fields in the "region-main" "region" match these values: | Course full name | Frog | | Number of announcements | 1 | + | Course summary | Green | And the following fields in the "region-main" "region" do not match these values: | Course full name | Course 1 | | Number of announcements | 5 | + | Course summary | Red | diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 915088d022f..62bae1615ec 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -652,7 +652,6 @@ class behat_forms extends behat_base { * @param string $value */ public function set_field_node_value(NodeElement $fieldnode, string $value): void { - $this->ensure_node_is_visible($fieldnode); $field = behat_field_manager::get_form_field($fieldnode, $this->getSession()); $field->set_value($value); }