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 {
<form>
<div class="gl-display-flex">
<gl-toggle
data-qa-selector="allow_duplicates_checkbox"
data-qa-selector="allow_duplicates_toggle"
:value="mavenDuplicatesAllowed"
@change="update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)"
/>
<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">
<template #bold="{ content }">
<strong>{{ content }}</strong>
......
......@@ -12,18 +12,28 @@ module QA
end
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
def set_allow_duplicates_disabled
expand_content :package_registry_settings_content do
uncheck_element :allow_duplicates_checkbox
click_element(:allow_duplicates_toggle) if duplicates_enabled?
end
end
def has_allow_duplicates_enabled?
expand_content :package_registry_settings_content
!find_element(:allow_duplicates_checkbox).checked?
def set_allow_duplicates_enabled
expand_content :package_registry_settings_content do
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
......
......@@ -223,9 +223,7 @@ module QA
project.group.visit!
Page::Group::Menu.perform(&:go_to_package_settings)
Page::Group::Settings::PackageRegistries.perform do |settings|
expect(settings).to have_allow_duplicates_enabled
end
Page::Group::Settings::PackageRegistries.perform(&:set_allow_duplicates_enabled)
end
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