Commit f12ca9e5 authored by Sofia Vistas's avatar Sofia Vistas

Fix allow settings for maven duplicates

Prior to this change, there was an incorrect
usage of the checkbox and this caused the
test to be unable to check/uncheck properly

This change uses a button instead and the
button label to validate state. using check?
revealed a problem since it asserts for is-checked
attribute on the element being checked
parent 5492f611
...@@ -79,12 +79,12 @@ export default { ...@@ -79,12 +79,12 @@ export default {
<form> <form>
<div class="gl-display-flex"> <div class="gl-display-flex">
<gl-toggle <gl-toggle
data-qa-selector="allow_duplicates_checkbox" data-qa-selector="allow_duplicates_toggle"
:value="mavenDuplicatesAllowed" :value="mavenDuplicatesAllowed"
@change="update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)" @change="update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)"
/> />
<div class="gl-ml-5"> <div class="gl-ml-5">
<div data-testid="toggle-label"> <div data-testid="toggle-label" data-qa-selector="allow_duplicates_label">
<gl-sprintf :message="enabledButtonLabel"> <gl-sprintf :message="enabledButtonLabel">
<template #bold="{ content }"> <template #bold="{ content }">
<strong>{{ content }}</strong> <strong>{{ content }}</strong>
......
...@@ -12,18 +12,28 @@ module QA ...@@ -12,18 +12,28 @@ module QA
end end
view 'app/assets/javascripts/packages_and_registries/settings/group/components/maven_settings.vue' do view 'app/assets/javascripts/packages_and_registries/settings/group/components/maven_settings.vue' do
element :allow_duplicates_checkbox element :allow_duplicates_toggle
element :allow_duplicates_label
end end
def set_allow_duplicates_disabled def set_allow_duplicates_disabled
expand_content :package_registry_settings_content do expand_content :package_registry_settings_content do
uncheck_element :allow_duplicates_checkbox click_element(:allow_duplicates_toggle) if duplicates_enabled?
end end
end end
def has_allow_duplicates_enabled? def set_allow_duplicates_enabled
expand_content :package_registry_settings_content expand_content :package_registry_settings_content do
!find_element(:allow_duplicates_checkbox).checked? click_element(:allow_duplicates_toggle) if duplicates_disabled?
end
end
def duplicates_enabled?
has_element?(:allow_duplicates_label, text: 'Allow duplicates')
end
def duplicates_disabled?
has_element?(:allow_duplicates_label, text: 'Do not allow duplicates')
end end
end end
end end
......
...@@ -223,9 +223,7 @@ module QA ...@@ -223,9 +223,7 @@ module QA
project.group.visit! project.group.visit!
Page::Group::Menu.perform(&:go_to_package_settings) Page::Group::Menu.perform(&:go_to_package_settings)
Page::Group::Settings::PackageRegistries.perform do |settings| Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_enabled)
expect(settings).to have_allow_duplicates_enabled
end
end end
it 'allows users to publish duplicate Maven packages at the group level', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1722' do it 'allows users to publish duplicate Maven packages at the group level', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1722' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment