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