A platform for community discussion. Free, open, simple.
DEV: Avoid a hacky workaround in d-toggle-switch specs (#29376)
Jarek Radosz44d1a818a38b
diff --git a/plugins/automation/spec/system/admin_plugins_list_spec.rb b/plugins/automation/spec/system/admin_plugins_list_spec.rbindex 4fe4f338a49..b84397e965f 100644--- a/plugins/automation/spec/system/admin_plugins_list_spec.rb+++ b/plugins/automation/spec/system/admin_plugins_list_spec.rb@@ -37,7 +37,7 @@ describe "Admin Plugins List", type: :system, js: true dotoggle_switch =PageObjects::Components::DToggleSwitch.new(admin_plugins_list_page.plugin_row_selector("automation") +- " .admin-plugins-list__enabled .d-toggle-switch",+ " .admin-plugins-list__enabled .d-toggle-switch__checkbox",)toggle_switch.toggleexpect(toggle_switch).to be_uncheckeddiff --git a/spec/system/page_objects/components/d_toggle_switch.rb b/spec/system/page_objects/components/d_toggle_switch.rbindex 70997423c19..40667d3ca69 100644--- a/spec/system/page_objects/components/d_toggle_switch.rb+++ b/spec/system/page_objects/components/d_toggle_switch.rb@@ -9,23 +9,22 @@ module PageObjects@context = contextend- def component- find(@context, visible: :all).native+ def label_component+ find(context, visible: :all).ancestor("label.d-toggle-switch__label")enddef toggle- actionbuilder = page.driver.browser.action # workaround zero height button- actionbuilder.click(component).perform+ label_component.clickenddef checked?- find(@context).has_css?(".d-toggle-switch__checkbox[aria-checked=\"true\"]", visible: false)+ label_component.has_css?(".d-toggle-switch__checkbox[aria-checked=\"true\"]", visible: :all)enddef unchecked?- find(@context).has_css?(+ label_component.has_css?(".d-toggle-switch__checkbox[aria-checked=\"false\"]",- visible: false,+ visible: :all,)endend