Commit ad1d8356 authored by Dan Davison's avatar Dan Davison

Merge branch 'qa-update-e2e-radio-buttons' into 'master'

Update e2e radio buttons

See merge request gitlab-org/gitlab!58897
parents 0fff6307 c3166eb6
...@@ -76,8 +76,9 @@ export default { ...@@ -76,8 +76,9 @@ export default {
:value="$options.commitToCurrentBranch" :value="$options.commitToCurrentBranch"
:disabled="!canPushToBranch" :disabled="!canPushToBranch"
:title="$options.currentBranchPermissionsTooltip" :title="$options.currentBranchPermissionsTooltip"
data-qa-selector="commit_to_current_branch_radio_container"
> >
<span class="ide-option-label" data-qa-selector="commit_to_current_branch_radio"> <span class="ide-option-label">
<gl-sprintf :message="s__('IDE|Commit to %{branchName} branch')"> <gl-sprintf :message="s__('IDE|Commit to %{branchName} branch')">
<template #branchName> <template #branchName>
<strong class="monospace">{{ currentBranchText }}</strong> <strong class="monospace">{{ currentBranchText }}</strong>
......
...@@ -64,6 +64,7 @@ export default { ...@@ -64,6 +64,7 @@ export default {
:disabled="disabled" :disabled="disabled"
type="radio" type="radio"
name="commit-action" name="commit-action"
data-qa-selector="commit_type_radio"
@change="updateCommitAction($event.target.value)" @change="updateCommitAction($event.target.value)"
/> />
<span class="gl-ml-3"> <span class="gl-ml-3">
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
= s_('ProjectSettings|When there is a merge conflict, the user is given the option to rebase.') = s_('ProjectSettings|When there is a merge conflict, the user is given the option to rebase.')
.form-check.mb-2 .form-check.mb-2
= form.radio_button :merge_method, :ff, class: "js-merge-method-radio form-check-input", data: { qa_selector: 'merge_ff_radio_button' } = form.radio_button :merge_method, :ff, class: "js-merge-method-radio form-check-input", data: { qa_selector: 'merge_ff_radio' }
= label_tag :project_merge_method_ff, class: 'form-check-label' do = label_tag :project_merge_method_ff, class: 'form-check-label' do
= s_('ProjectSettings|Fast-forward merge') = s_('ProjectSettings|Fast-forward merge')
.text-secondary .text-secondary
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.form-group.group-name-holder.col-sm-12 .form-group.group-name-holder.col-sm-12
= f.label :name, class: 'label-bold' do = f.label :name, class: 'label-bold' do
= _("Group name") = _("Group name")
= f.text_field :name, placeholder: _('My Awesome Group'), class: 'js-autofill-group-name form-control input-lg', = f.text_field :name, placeholder: _('My Awesome Group'), class: 'js-autofill-group-name form-control input-lg', data: { qa_selector: 'group_name_field' },
required: true, required: true,
title: _('Please fill in a descriptive name for your group.'), title: _('Please fill in a descriptive name for your group.'),
autofocus: true autofocus: true
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- if parent - if parent
%strong= parent.full_path + '/' %strong= parent.full_path + '/'
= f.hidden_field :parent_id = f.hidden_field :parent_id
= f.text_field :path, placeholder: _('my-awesome-group'), class: 'form-control js-validate-group-path js-autofill-group-path', = f.text_field :path, placeholder: _('my-awesome-group'), class: 'form-control js-validate-group-path js-autofill-group-path', data: { qa_selector: 'group_path_field' },
autofocus: local_assigns[:autofocus] || false, required: true, autofocus: local_assigns[:autofocus] || false, required: true,
pattern: Gitlab::PathRegex::NAMESPACE_FORMAT_REGEX_JS, pattern: Gitlab::PathRegex::NAMESPACE_FORMAT_REGEX_JS,
title: _('Please choose a group URL with no special characters.'), title: _('Please choose a group URL with no special characters.'),
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
- scopes.each do |scope| - scopes.each do |scope|
%fieldset.form-group.form-check %fieldset.form-group.form-check
= check_box_tag "#{prefix}[scopes][]", scope, token.scopes.include?(scope), id: "#{prefix}_scopes_#{scope}", class: "form-check-input qa-#{scope}-radio" = check_box_tag "#{prefix}[scopes][]", scope, token.scopes.include?(scope), id: "#{prefix}_scopes_#{scope}", class: "form-check-input", data: { qa_selector: "#{scope}_checkbox" }
= label_tag "#{prefix}_scopes_#{scope}", scope, class: 'label-bold form-check-label' = label_tag "#{prefix}_scopes_#{scope}", scope, class: 'label-bold form-check-label'
.text-secondary= t scope, scope: scope_description(prefix) .text-secondary= t scope, scope: scope_description(prefix)
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
= f.label :cn, "Sync method" = f.label :cn, "Sync method"
.col-sm-10 .col-sm-10
.form-check .form-check
= radio_button_tag :sync_method, :group, true, class: 'form-check-input' = radio_button_tag :sync_method, :group, true, class: 'form-check-input', data: { qa_selector: 'ldap_sync_group_radio' }
= label_tag :sync_method_group, class: 'form-check-label' do = label_tag :sync_method_group, class: 'form-check-label' do
LDAP Group cn LDAP Group cn
.form-check .form-check
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
.col-sm-2.col-form-label .col-sm-2.col-form-label
= f.label :filter, "LDAP User filter" = f.label :filter, "LDAP User filter"
.col-sm-10 .col-sm-10
= f.text_field :filter, placeholder: 'Ex. (&(objectCategory=person)(objectClass=developer))', class: 'form-control xxlarge input-mn-300 qa-ldap-user-filter-text-field' = f.text_field :filter, placeholder: 'Ex. (&(objectCategory=person)(objectClass=developer))', class: 'form-control xxlarge input-mn-300', data: { qa_selector: 'ldap_user_filter_field' }
.form-text.text-muted .form-text.text-muted
- ldap_link = link_to 'LDAP Search Filter Syntax', 'https://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx' - ldap_link = link_to 'LDAP Search Filter Syntax', 'https://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx'
This query must use valid #{ldap_link}. Synchronize #{group.name}'s members with this LDAP user filter. This query must use valid #{ldap_link}. Synchronize #{group.name}'s members with this LDAP user filter.
......
...@@ -505,6 +505,7 @@ module QA ...@@ -505,6 +505,7 @@ module QA
autoload :WikiPageForm, 'qa/page/component/wiki_page_form' autoload :WikiPageForm, 'qa/page/component/wiki_page_form'
autoload :AccessTokens, 'qa/page/component/access_tokens' autoload :AccessTokens, 'qa/page/component/access_tokens'
autoload :CommitModal, 'qa/page/component/commit_modal' autoload :CommitModal, 'qa/page/component/commit_modal'
autoload :VisibilitySetting, 'qa/page/component/visibility_setting'
module Issuable module Issuable
autoload :Common, 'qa/page/component/issuable/common' autoload :Common, 'qa/page/component/issuable/common'
......
...@@ -9,26 +9,27 @@ module QA ...@@ -9,26 +9,27 @@ module QA
include QA::Page::Component::Select2 include QA::Page::Component::Select2
view 'ee/app/views/ldap_group_links/_form.html.haml' do view 'ee/app/views/ldap_group_links/_form.html.haml' do
element :ldap_group_cn_select
element :add_sync_button element :add_sync_button
element :ldap_user_filter_text_field element :ldap_group_cn_select
element :ldap_sync_group_radio
element :ldap_user_filter_field
end end
def set_sync_method(method) def set_ldap_group_sync_method
choose method choose_element(:ldap_sync_group_radio)
end end
def set_group_cn(group_cn) def set_group_cn(group_cn)
click_element :ldap_group_cn_select click_element(:ldap_group_cn_select)
search_and_select(group_cn) search_and_select(group_cn)
end end
def set_user_filter(user_filter) def set_user_filter(user_filter)
fill_element :ldap_user_filter_text_field, user_filter fill_element(:ldap_user_filter_field, user_filter)
end end
def click_add_sync_button def click_add_sync_button
click_element :add_sync_button click_element(:add_sync_button)
end end
end end
end end
......
...@@ -13,6 +13,10 @@ module QA ...@@ -13,6 +13,10 @@ module QA
element :submit_button element :submit_button
end end
view 'ee/app/assets/javascripts/security_configuration/sast/components/analyzer_configuration.vue' do
element :entity_checkbox, "`${entity.name}_checkbox`" # rubocop:disable QA/ElementWithPattern
end
def click_expand_button def click_expand_button
expand_content(:analyzer_settings_content) expand_content(:analyzer_settings_content)
end end
...@@ -30,9 +34,7 @@ module QA ...@@ -30,9 +34,7 @@ module QA
end end
def unselect_dynamic_checkbox(checkbox_name) def unselect_dynamic_checkbox(checkbox_name)
# Workaround until https://gitlab.com/gitlab-org/gitlab/-/issues/323297 is resolved uncheck_element("#{checkbox_name}_checkbox", true)
# uncheck_element("#{checkbox_name}_checkbox")
page.driver.browser.action.move_to(find_element("#{checkbox_name}_checkbox", visible: false).native).click.perform
end end
def has_sast_status?(status_text) def has_sast_status?(status_text)
......
...@@ -132,16 +132,16 @@ module QA ...@@ -132,16 +132,16 @@ module QA
all(element_selector_css(name), **kwargs) all(element_selector_css(name), **kwargs)
end end
def check_element(name, click_by_js = false) def check_element(name, click_by_js = false, visibility = false)
if find_element(name, visible: false).checked? if find_element(name, visible: visibility).checked?
QA::Runtime::Logger.debug("#{name} is already checked") QA::Runtime::Logger.debug("#{name} is already checked")
return return
end end
retry_until(sleep_interval: 1) do retry_until(sleep_interval: 1) do
click_checkbox_or_radio(name, click_by_js) click_checkbox_or_radio(name, click_by_js, visibility)
checked = find_element(name, visible: false).checked? checked = find_element(name, visible: visibility).checked?
QA::Runtime::Logger.debug(checked ? "#{name} was checked" : "#{name} was not checked") QA::Runtime::Logger.debug(checked ? "#{name} was checked" : "#{name} was not checked")
...@@ -149,16 +149,16 @@ module QA ...@@ -149,16 +149,16 @@ module QA
end end
end end
def uncheck_element(name, click_by_js = false) def uncheck_element(name, click_by_js = false, visibility = false)
unless find_element(name, visible: false).checked? unless find_element(name, visible: visibility).checked?
QA::Runtime::Logger.debug("#{name} is already unchecked") QA::Runtime::Logger.debug("#{name} is already unchecked")
return return
end end
retry_until(sleep_interval: 1) do retry_until(sleep_interval: 1) do
click_checkbox_or_radio(name, click_by_js) click_checkbox_or_radio(name, click_by_js, visibility)
unchecked = !find_element(name, visible: false).checked? unchecked = !find_element(name, visible: visibility).checked?
QA::Runtime::Logger.debug(unchecked ? "#{name} was unchecked" : "#{name} was not unchecked") QA::Runtime::Logger.debug(unchecked ? "#{name} was unchecked" : "#{name} was not unchecked")
...@@ -167,21 +167,22 @@ module QA ...@@ -167,21 +167,22 @@ module QA
end end
# Method for selecting radios # Method for selecting radios
def choose_element(name, click_by_js = false) def choose_element(name, click_by_js = false, visibility = false)
if find_element(name, visible: false).checked? if find_element(name, visible: visibility).checked?
QA::Runtime::Logger.debug("#{name} is already selected") QA::Runtime::Logger.debug("#{name} is already selected")
return return
end end
retry_until(sleep_interval: 1) do retry_until(sleep_interval: 1) do
click_checkbox_or_radio(name, click_by_js) click_checkbox_or_radio(name, click_by_js, visibility)
selected = find_element(name, visible: false).checked? selected = find_element(name, visible: visibility).checked?
QA::Runtime::Logger.debug(selected ? "#{name} was selected" : "#{name} was not selected") QA::Runtime::Logger.debug(selected ? "#{name} was selected" : "#{name} was not selected")
selected selected
end end
wait_for_requests
end end
# Use this to simulate moving the pointer to an element's coordinate # Use this to simulate moving the pointer to an element's coordinate
...@@ -424,8 +425,8 @@ module QA ...@@ -424,8 +425,8 @@ module QA
private private
def click_checkbox_or_radio(name, click_by_js) def click_checkbox_or_radio(name, click_by_js, visibility)
box = find_element(name, visible: false) box = find_element(name, visible: visibility)
# Some checkboxes and radio buttons are hidden by their labels and cannot be clicked directly # Some checkboxes and radio buttons are hidden by their labels and cannot be clicked directly
click_by_js ? page.execute_script("arguments[0].click();", box) : box.click click_by_js ? page.execute_script("arguments[0].click();", box) : box.click
end end
......
...@@ -19,7 +19,7 @@ module QA ...@@ -19,7 +19,7 @@ module QA
end end
base.view 'app/views/shared/tokens/_scopes_form.html.haml' do base.view 'app/views/shared/tokens/_scopes_form.html.haml' do
element :api_radio, 'qa-#{scope}-radio' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck element :api_checkbox, '#{scope}_checkbox' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
end end
base.view 'app/views/shared/access_tokens/_created_container.html.haml' do base.view 'app/views/shared/access_tokens/_created_container.html.haml' do
...@@ -36,7 +36,7 @@ module QA ...@@ -36,7 +36,7 @@ module QA
end end
def check_api def check_api
check_element(:api_radio) check_element(:api_checkbox)
end end
def click_create_token_button def click_create_token_button
......
# frozen_string_literal: true
module QA
module Page
module Component
module VisibilitySetting
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/views/shared/_visibility_radios.html.haml' do
element :visibility_radio, 'qa_selector: "#{visibility_level_label(level).downcase}_radio"' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
end
end
def set_visibility(visibility)
choose_element("#{visibility.downcase}_radio", false, true)
end
end
end
end
end
...@@ -4,23 +4,20 @@ module QA ...@@ -4,23 +4,20 @@ module QA
module Page module Page
module Group module Group
class New < Page::Base class New < Page::Base
include Page::Component::VisibilitySetting
view 'app/views/shared/_group_form.html.haml' do view 'app/views/shared/_group_form.html.haml' do
element :group_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern element :group_path_field
element :group_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern element :group_name_field
end end
view 'app/views/groups/_new_group_fields.html.haml' do view 'app/views/groups/_new_group_fields.html.haml' do
element :create_group_button, "submit _('Create group')" # rubocop:disable QA/ElementWithPattern element :create_group_button, "submit _('Create group')" # rubocop:disable QA/ElementWithPattern
element :visibility_radios, 'visibility_level:' # rubocop:disable QA/ElementWithPattern
end end
def set_path(path) def set_path(path)
fill_in 'group_path', with: path fill_element(:group_path_field, path)
fill_in 'group_name', with: path fill_element(:group_name_field, path)
end
def set_visibility(visibility)
choose visibility
end end
def create def create
......
...@@ -6,6 +6,7 @@ module QA ...@@ -6,6 +6,7 @@ module QA
module Settings module Settings
class General < QA::Page::Base class General < QA::Page::Base
include ::QA::Page::Settings::Common include ::QA::Page::Settings::Common
include Page::Component::VisibilitySetting
view 'app/views/groups/edit.html.haml' do view 'app/views/groups/edit.html.haml' do
element :permission_lfs_2fa_content element :permission_lfs_2fa_content
...@@ -21,10 +22,6 @@ module QA ...@@ -21,10 +22,6 @@ module QA
element :save_name_visibility_settings_button element :save_name_visibility_settings_button
end end
view 'app/views/shared/_visibility_radios.html.haml' do
element :internal_radio, 'qa_selector: "#{visibility_level_label(level).downcase}_radio"' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
end
view 'app/views/groups/settings/_lfs.html.haml' do view 'app/views/groups/settings/_lfs.html.haml' do
element :lfs_checkbox element :lfs_checkbox
end end
...@@ -56,10 +53,6 @@ module QA ...@@ -56,10 +53,6 @@ module QA
find_element(:group_name_field).set name find_element(:group_name_field).set name
end end
def set_group_visibility(visibility)
find_element("#{visibility.downcase}_radio").click
end
def click_save_name_visibility_settings_button def click_save_name_visibility_settings_button
click_element(:save_name_visibility_settings_button) click_element(:save_name_visibility_settings_button)
end end
......
...@@ -4,8 +4,9 @@ module QA ...@@ -4,8 +4,9 @@ module QA
module Page module Page
module Project module Project
class New < Page::Base class New < Page::Base
include Page::Component::Select2
include Page::Component::Project::Templates include Page::Component::Project::Templates
include Page::Component::Select2
include Page::Component::VisibilitySetting
view 'app/views/projects/new.html.haml' do view 'app/views/projects/new.html.haml' do
element :project_create_from_template_tab element :project_create_from_template_tab
...@@ -59,10 +60,6 @@ module QA ...@@ -59,10 +60,6 @@ module QA
click_element(:project_create_from_template_tab) click_element(:project_create_from_template_tab)
end end
def set_visibility(visibility)
choose visibility.capitalize
end
def click_github_link def click_github_link
click_link 'GitHub' click_link 'GitHub'
end end
......
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
end end
view 'app/views/projects/_merge_request_merge_method_settings.html.haml' do view 'app/views/projects/_merge_request_merge_method_settings.html.haml' do
element :merge_ff_radio_button element :merge_ff_radio
end end
view 'app/views/projects/_merge_request_merge_checks_settings.html.haml' do view 'app/views/projects/_merge_request_merge_checks_settings.html.haml' do
...@@ -24,7 +24,7 @@ module QA ...@@ -24,7 +24,7 @@ module QA
end end
def enable_ff_only def enable_ff_only
click_element(:merge_ff_radio_button) choose_element(:merge_ff_radio)
click_save_changes click_save_changes
end end
......
...@@ -36,7 +36,7 @@ module QA ...@@ -36,7 +36,7 @@ module QA
end end
view 'app/assets/javascripts/ide/components/commit_sidebar/actions.vue' do view 'app/assets/javascripts/ide/components/commit_sidebar/actions.vue' do
element :commit_to_current_branch_radio element :commit_to_current_branch_radio_container
end end
view 'app/assets/javascripts/ide/components/commit_sidebar/form.vue' do view 'app/assets/javascripts/ide/components/commit_sidebar/form.vue' do
...@@ -44,6 +44,10 @@ module QA ...@@ -44,6 +44,10 @@ module QA
element :commit_button element :commit_button
end end
view 'app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue' do
element :commit_type_radio
end
view 'app/assets/javascripts/ide/components/repo_editor.vue' do view 'app/assets/javascripts/ide/components/repo_editor.vue' do
element :editor_container element :editor_container
end end
...@@ -216,7 +220,9 @@ module QA ...@@ -216,7 +220,9 @@ module QA
# animation is still in process even when the buttons have the # animation is still in process even when the buttons have the
# expected visibility. # expected visibility.
commit_success = retry_until(sleep_interval: 5) do commit_success = retry_until(sleep_interval: 5) do
click_element(:commit_to_current_branch_radio) if has_element?(:commit_to_current_branch_radio) within_element(:commit_to_current_branch_radio_container) do
choose_element(:commit_type_radio)
end
click_element(:commit_button) if has_element?(:commit_button) click_element(:commit_button) if has_element?(:commit_button)
# If this is the first commit, the commit SHA only appears after reloading # If this is the first commit, the commit SHA only appears after reloading
......
...@@ -89,7 +89,7 @@ module QA ...@@ -89,7 +89,7 @@ module QA
Page::Group::Menu.perform(&:go_to_ldap_sync_settings) Page::Group::Menu.perform(&:go_to_ldap_sync_settings)
EE::Page::Group::Settings::LDAPSync.perform do |settings| EE::Page::Group::Settings::LDAPSync.perform do |settings|
settings.set_sync_method('LDAP Group cn') settings.set_ldap_group_sync_method
settings.set_group_cn('Engineering') settings.set_group_cn('Engineering')
settings.click_add_sync_button settings.click_add_sync_button
end end
......
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