Commit be7b38c4 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'qa-update-checkbox-e2e-functionality' into 'master'

Update checkbox e2e functionality

See merge request gitlab-org/gitlab!55907
parents 6a03e7cd 1b4048ab
...@@ -265,7 +265,6 @@ export default { ...@@ -265,7 +265,6 @@ export default {
<gl-form-checkbox <gl-form-checkbox
ref="masked-ci-variable" ref="masked-ci-variable"
v-model="masked" v-model="masked"
data-qa-selector="ci_variable_masked_checkbox"
data-testid="ci-variable-masked-checkbox" data-testid="ci-variable-masked-checkbox"
> >
{{ __('Mask variable') }} {{ __('Mask variable') }}
......
...@@ -41,7 +41,6 @@ export default { ...@@ -41,7 +41,6 @@ export default {
:disabled="shouldDisableNewMrOption" :disabled="shouldDisableNewMrOption"
:checked="shouldCreateMR" :checked="shouldCreateMR"
type="checkbox" type="checkbox"
data-qa-selector="start_new_mr_checkbox"
@change="toggleShouldCreateMR" @change="toggleShouldCreateMR"
/> />
<span class="gl-ml-3 ide-option-label"> <span class="gl-ml-3 ide-option-label">
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
%fieldset %fieldset
.form-group .form-group
.form-check .form-check
= f.check_box :performance_bar_enabled, class: 'form-check-input' = f.check_box :performance_bar_enabled, class: 'form-check-input', data: { qa_selector: 'enable_performance_bar_checkbox'}
= f.label :performance_bar_enabled, class: 'form-check-label qa-enable-performance-bar-checkbox' do = f.label :performance_bar_enabled, class: 'form-check-label' do
Enable access to the Performance Bar Enable access to the Performance Bar
.form-group .form-group
= f.label :performance_bar_allowed_group_path, 'Allowed group', class: 'label-bold' = f.label :performance_bar_allowed_group_path, 'Allowed group', class: 'label-bold'
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
%div{ :class => "col-sm-12" } %div{ :class => "col-sm-12" }
.form-check .form-check
- experiment(:new_project_readme, actor: current_user) do |e| - experiment(:new_project_readme, actor: current_user) do |e|
= check_box_tag 'project[initialize_with_readme]', '1', e.run, class: 'form-check-input qa-initialize-with-readme-checkbox', data: { track_label: "#{track_label}", track_event: "activate_form_input", track_property: "init_with_readme", track_value: "" } = check_box_tag 'project[initialize_with_readme]', '1', e.run, class: 'form-check-input', data: { qa_selector: "initialize_with_readme_checkbox", track_label: "#{track_label}", track_event: "activate_form_input", track_property: "init_with_readme", track_value: "" }
= label_tag 'project[initialize_with_readme]', class: 'form-check-label' do = label_tag 'project[initialize_with_readme]', class: 'form-check-label' do
.option-title .option-title
%strong= s_('ProjectsNew|Initialize repository with a README') %strong= s_('ProjectsNew|Initialize repository with a README')
......
...@@ -15,11 +15,11 @@ module QA ...@@ -15,11 +15,11 @@ module QA
end end
def check_indexing def check_indexing
check_element :indexing_checkbox check_element(:indexing_checkbox)
end end
def check_search def check_search
check_element :search_checkbox check_element(:search_checkbox)
end end
def enter_link(link) def enter_link(link)
......
...@@ -17,6 +17,7 @@ module QA ...@@ -17,6 +17,7 @@ module QA
end end
def enable_confidential_epic def enable_confidential_epic
# TODO: Fix this workaround for checkbox hidden by label
find_element(:confidential_epic_checkbox, visible: false).click find_element(:confidential_epic_checkbox, visible: false).click
end end
......
...@@ -59,9 +59,9 @@ module QA ...@@ -59,9 +59,9 @@ module QA
within_element(:custom_project_template_select) do within_element(:custom_project_template_select) do
clear_current_selection_if_present clear_current_selection_if_present
end end
click_element :custom_project_template_select click_element(:custom_project_template_select)
search_and_select(path) search_and_select(path)
click_element :save_changes_button click_element(:save_changes_button)
end end
def set_ip_address_restriction(ip_address) def set_ip_address_restriction(ip_address)
...@@ -77,31 +77,31 @@ module QA ...@@ -77,31 +77,31 @@ module QA
ip_restriction_field_input = find_element(:ip_restriction_field).find('input[type="text"]') ip_restriction_field_input = find_element(:ip_restriction_field).find('input[type="text"]')
ip_restriction_field_input.set ip_address ip_restriction_field_input.set ip_address
ip_restriction_field_input.send_keys(:enter) ip_restriction_field_input.send_keys(:enter)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_membership_lock_enabled def set_membership_lock_enabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
check_element :membership_lock_checkbox check_element(:membership_lock_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_membership_lock_disabled def set_membership_lock_disabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
uncheck_element :membership_lock_checkbox uncheck_element(:membership_lock_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_prevent_forking_outside_group_enabled def set_prevent_forking_outside_group_enabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
check_element :prevent_forking_outside_group_checkbox check_element(:prevent_forking_outside_group_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_prevent_forking_outside_group_disabled def set_prevent_forking_outside_group_disabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
uncheck_element :prevent_forking_outside_group_checkbox uncheck_element(:prevent_forking_outside_group_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_repository_size_limit(limit) def set_repository_size_limit(limit)
...@@ -122,9 +122,9 @@ module QA ...@@ -122,9 +122,9 @@ module QA
within_element(:file_template_repository_dropdown) do within_element(:file_template_repository_dropdown) do
clear_current_selection_if_present clear_current_selection_if_present
end end
click_element :file_template_repository_dropdown click_element(:file_template_repository_dropdown)
search_and_select(path) search_and_select(path)
click_element :save_changes_button click_element(:save_changes_button)
end end
end end
end end
......
...@@ -29,11 +29,11 @@ module QA ...@@ -29,11 +29,11 @@ module QA
end end
def click_pipelines_for_merged_results_checkbox def click_pipelines_for_merged_results_checkbox
check_element :merged_results_pipeline_checkbox check_element(:merged_results_pipeline_checkbox)
end end
def click_merge_trains_checkbox def click_merge_trains_checkbox
check_element :merge_trains_checkbox check_element(:merge_trains_checkbox)
end end
def enable_merge_train def enable_merge_train
......
...@@ -28,23 +28,23 @@ module QA ...@@ -28,23 +28,23 @@ module QA
end end
def check_reject_unsigned_commits def check_reject_unsigned_commits
check_element :reject_unsigned_commits_checkbox check_element(:reject_unsigned_commits_checkbox)
end end
def check_committer_restriction def check_committer_restriction
check_element :committer_restriction_checkbox check_element(:committer_restriction_checkbox)
end end
def check_deny_delete_tag def check_deny_delete_tag
check_element :deny_delete_tag_checkbox check_element(:deny_delete_tag_checkbox)
end end
def check_restrict_author def check_restrict_author
check_element :restrict_author_checkbox check_element(:restrict_author_checkbox)
end end
def check_prevent_secrets def check_prevent_secrets
check_element :prevent_secrets_checkbox check_element(:prevent_secrets_checkbox)
end end
def fill_commit_message_rule(message) def fill_commit_message_rule(message)
......
...@@ -14,9 +14,9 @@ module QA ...@@ -14,9 +14,9 @@ module QA
end end
def enable_throttles def enable_throttles
check_element :throttle_unauthenticated_checkbox check_element(:throttle_unauthenticated_checkbox)
check_element :throttle_authenticated_api_checkbox check_element(:throttle_authenticated_api_checkbox)
check_element :throttle_authenticated_web_checkbox check_element(:throttle_authenticated_web_checkbox)
end end
def save_settings def save_settings
......
...@@ -19,7 +19,7 @@ module QA ...@@ -19,7 +19,7 @@ module QA
private private
def check_allow_requests_to_local_network_from_services_checkbox def check_allow_requests_to_local_network_from_services_checkbox
check_element :allow_requests_from_services_checkbox check_element(:allow_requests_from_services_checkbox)
end end
def click_save_changes_button def click_save_changes_button
......
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
end end
def enable_performance_bar def enable_performance_bar
click_element :enable_performance_bar_checkbox check_element(:enable_performance_bar_checkbox)
Capybara.current_session.driver.browser.manage.add_cookie(name: 'perf_bar_enabled', value: 'true') Capybara.current_session.driver.browser.manage.add_cookie(name: 'perf_bar_enabled', value: 'true')
end end
......
...@@ -13,13 +13,13 @@ module QA ...@@ -13,13 +13,13 @@ module QA
end end
def require_admin_approval_after_user_signup def require_admin_approval_after_user_signup
check_element :require_admin_approval_after_user_signup_checkbox check_element(:require_admin_approval_after_user_signup_checkbox)
click_element :save_changes_button click_element(:save_changes_button)
end end
def disable_signups def disable_signups
uncheck_element :signup_enabled_checkbox uncheck_element(:signup_enabled_checkbox)
click_element :save_changes_button click_element(:save_changes_button)
end end
end end
end end
......
...@@ -133,9 +133,15 @@ module QA ...@@ -133,9 +133,15 @@ module QA
end end
def check_element(name) def check_element(name)
if find_element(name, visible: false).checked?
QA::Runtime::Logger.debug("#{name} is already checked")
return
end
retry_until(sleep_interval: 1) do retry_until(sleep_interval: 1) do
find_element(name).set(true) find_element(name, visible: false).click
checked = find_element(name).checked? checked = find_element(name, visible: false).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")
...@@ -144,10 +150,19 @@ module QA ...@@ -144,10 +150,19 @@ module QA
end end
def uncheck_element(name) def uncheck_element(name)
unless find_element(name, visible: false).checked?
QA::Runtime::Logger.debug("#{name} is already unchecked")
return
end
retry_until(sleep_interval: 1) do retry_until(sleep_interval: 1) do
find_element(name).set(false) find_element(name, visible: false).click
unchecked = !find_element(name, visible: false).checked?
QA::Runtime::Logger.debug(unchecked ? "#{name} was unchecked" : "#{name} was not unchecked")
!find_element(name).checked? unchecked
end end
end end
......
...@@ -54,57 +54,57 @@ module QA ...@@ -54,57 +54,57 @@ module QA
end end
def set_lfs_enabled def set_lfs_enabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
check_element :lfs_checkbox check_element(:lfs_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_lfs_disabled def set_lfs_disabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
uncheck_element :lfs_checkbox uncheck_element(:lfs_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_request_access_enabled def set_request_access_enabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
check_element :request_access_checkbox check_element(:request_access_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_request_access_disabled def set_request_access_disabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
uncheck_element :request_access_checkbox uncheck_element(:request_access_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_require_2fa_enabled def set_require_2fa_enabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
check_element :require_2fa_checkbox check_element(:require_2fa_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_require_2fa_disabled def set_require_2fa_disabled
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
uncheck_element :require_2fa_checkbox uncheck_element(:require_2fa_checkbox)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def set_project_creation_level(value) def set_project_creation_level(value)
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
select_element(:project_creation_level_dropdown, value) select_element(:project_creation_level_dropdown, value)
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
def toggle_request_access def toggle_request_access
expand_content :permission_lfs_2fa_content expand_content(:permission_lfs_2fa_content)
if find_element(:request_access_checkbox).checked? if find_element(:request_access_checkbox).checked?
uncheck_element :request_access_checkbox uncheck_element(:request_access_checkbox)
else else
check_element :request_access_checkbox check_element(:request_access_checkbox)
end end
click_element :save_permissions_changes_button click_element(:save_permissions_changes_button)
end end
end end
end end
......
...@@ -228,6 +228,7 @@ module QA ...@@ -228,6 +228,7 @@ module QA
!find_element(:squash_checkbox).disabled? !find_element(:squash_checkbox).disabled?
end end
# TODO: Fix workaround for data-qa-selector failure
click_element(:squash_checkbox) click_element(:squash_checkbox)
end end
......
...@@ -68,7 +68,7 @@ module QA ...@@ -68,7 +68,7 @@ module QA
end end
def enable_initialize_with_readme def enable_initialize_with_readme
check_element :initialize_with_readme_checkbox check_element(:initialize_with_readme_checkbox)
end end
end end
end end
......
...@@ -36,7 +36,7 @@ module QA ...@@ -36,7 +36,7 @@ module QA
end end
def uncheck_rbac! def uncheck_rbac!
uncheck_element :rbac_checkbox uncheck_element(:rbac_checkbox)
end end
end end
end end
......
...@@ -11,8 +11,8 @@ module QA ...@@ -11,8 +11,8 @@ module QA
end end
def enable_autodevops def enable_autodevops
check_element :enable_autodevops_checkbox check_element(:enable_autodevops_checkbox)
click_element :save_changes_button click_element(:save_changes_button)
end end
end end
end end
......
...@@ -10,7 +10,6 @@ module QA ...@@ -10,7 +10,6 @@ module QA
view 'app/assets/javascripts/ci_variable_list/components/ci_variable_modal.vue' do view 'app/assets/javascripts/ci_variable_list/components/ci_variable_modal.vue' do
element :ci_variable_key_field element :ci_variable_key_field
element :ci_variable_value_field element :ci_variable_value_field
element :ci_variable_masked_checkbox
element :ci_variable_save_button element :ci_variable_save_button
element :ci_variable_delete_button element :ci_variable_delete_button
end end
......
...@@ -13,7 +13,7 @@ module QA ...@@ -13,7 +13,7 @@ module QA
end end
def enable_issues_for_incidents def enable_issues_for_incidents
check_element :create_issue_checkbox check_element(:create_issue_checkbox)
end end
def select_issue_template(template) def select_issue_template(template)
......
...@@ -29,7 +29,7 @@ module QA ...@@ -29,7 +29,7 @@ module QA
end end
def enable_merge_if_all_disscussions_are_resolved def enable_merge_if_all_disscussions_are_resolved
click_element :allow_merge_if_all_discussions_are_resolved_checkbox check_element(:allow_merge_if_all_discussions_are_resolved_checkbox)
click_save_changes click_save_changes
end end
end end
......
...@@ -44,10 +44,6 @@ module QA ...@@ -44,10 +44,6 @@ module QA
element :commit_button element :commit_button
end end
view 'app/assets/javascripts/ide/components/commit_sidebar/new_merge_request_option.vue' do
element :start_new_mr_checkbox
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
......
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