Commit cca5bbda authored by Dan Davison's avatar Dan Davison

Merge branch 'dj-add-qa-selector-cop' into 'master'

Add selector usage cop for QA and non-QA tests [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!64151
parents b50589a3 1046a3ae
......@@ -701,3 +701,11 @@ RSpec/TopLevelDescribePath:
Exclude:
- 'spec/fixtures/**/*.rb'
- 'ee/spec/fixtures/**/*.rb'
QA/SelectorUsage:
Enabled: true
Include:
- 'spec/**/*.rb'
- 'ee/spec/**/*.rb'
Exclude:
- 'spec/rubocop/**/*_spec.rb'
......@@ -190,7 +190,7 @@ RSpec.describe 'Admin::AuditLogs', :js do
click_link 'Impersonate'
visit(new_project_path)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
fill_in(:project_name, with: 'Gotham City')
......
......@@ -31,7 +31,7 @@ RSpec.describe 'Delete Epic', :js do
end
it 'deletes the issue and redirect to epic list' do
find('.qa-delete-button').click
find('.qa-delete-button').click # rubocop:disable QA/SelectorUsage
wait_for_requests
find('.js-modal-action-primary').click
......
......@@ -75,13 +75,13 @@ RSpec.describe 'Groups > Billing > Seat Usage', :js do
end
it 'has disabled the remove button' do
within '[data-qa-selector="remove_billable_member_modal"]' do
within '[data-qa-selector="remove_billable_member_modal"]' do # rubocop:disable QA/SelectorUsage
expect(page).to have_button('Remove user', disabled: true)
end
end
it 'enables the remove button when user enters valid username' do
within '[data-qa-selector="remove_billable_member_modal"]' do
within '[data-qa-selector="remove_billable_member_modal"]' do # rubocop:disable QA/SelectorUsage
find('input').fill_in(with: maintainer.username)
find('input').send_keys(:tab)
......@@ -90,7 +90,7 @@ RSpec.describe 'Groups > Billing > Seat Usage', :js do
end
it 'does not enable button when user enters invalid username' do
within '[data-qa-selector="remove_billable_member_modal"]' do
within '[data-qa-selector="remove_billable_member_modal"]' do # rubocop:disable QA/SelectorUsage
find('input').fill_in(with: 'invalid username')
find('input').send_keys(:tab)
......@@ -112,7 +112,7 @@ RSpec.describe 'Groups > Billing > Seat Usage', :js do
end
it 'shows a flash message' do
within '[data-qa-selector="remove_billable_member_modal"]' do
within '[data-qa-selector="remove_billable_member_modal"]' do # rubocop:disable QA/SelectorUsage
find('input').fill_in(with: maintainer.username)
find('input').send_keys(:tab)
......@@ -138,7 +138,7 @@ RSpec.describe 'Groups > Billing > Seat Usage', :js do
click_button('Remove member')
within '[data-qa-selector="remove_member_modal_content"]' do
within '[data-qa-selector="remove_member_modal_content"]' do # rubocop:disable QA/SelectorUsage
click_button('Remove member')
end
......
......@@ -70,7 +70,7 @@ RSpec.describe 'Group navbar' do
it 'redirects to value stream when Analytics item is clicked' do
page.within('.sidebar-top-level-items') do
find('[data-qa-selector=analytics_anchor]').click
find('[data-qa-selector=analytics_anchor]').click # rubocop:disable QA/SelectorUsage
end
wait_for_requests
......
......@@ -43,7 +43,7 @@ RSpec.describe 'Project' do
new_path = 'example-custom-project-template'
new_name = 'Example Custom Project Template'
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
find('.project-template .custom-instance-project-templates-tab').click
find("label[for='#{projects.first.name}']").click
......@@ -68,7 +68,7 @@ RSpec.describe 'Project' do
new_path = 'example-custom-project-template'
new_name = 'Example Custom Project Template'
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
find('.project-template .custom-instance-project-templates-tab').click
find("label[for='#{projects.first.name}']").click
......@@ -90,7 +90,7 @@ RSpec.describe 'Project' do
new_path = 'example-custom-project-template'
new_name = 'Example Custom Project Template'
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
find('.project-template .custom-instance-project-templates-tab').click
find("label[for='#{projects.first.name}']").click
......@@ -111,7 +111,7 @@ RSpec.describe 'Project' do
it 'has a working pagination', :js do
last_project = "label[for='#{projects.last.name}']"
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
find('.project-template .custom-instance-project-templates-tab').click
expect(page).to have_css('.custom-project-templates .gl-pagination')
......
......@@ -69,7 +69,7 @@ RSpec.describe 'Project mirror', :js do
import_state.update!(next_execution_timestamp: timestamp - 1.minute)
end
let(:disabled_updating_button) { '[data-qa-selector="updating_button"].disabled' }
let(:disabled_updating_button) { '[data-qa-selector="updating_button"].disabled' } # rubocop:disable QA/SelectorUsage
it 'disables Update now button' do
travel_to(timestamp) do
......@@ -81,7 +81,7 @@ RSpec.describe 'Project mirror', :js do
end
context 'when the project is archived' do
let(:disabled_update_now_button) { '[data-qa-selector="update_now_button"].disabled' }
let(:disabled_update_now_button) { '[data-qa-selector="update_now_button"].disabled' } # rubocop:disable QA/SelectorUsage
before do
project.update!(archived: true)
......
......@@ -17,7 +17,7 @@ RSpec.describe 'New project', :js do
it 'shows mirror repository checkbox enabled', :js do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
first('.js-import-git-toggle-button').click
expect(page).to have_unchecked_field('Mirror repository', disabled: false)
......@@ -31,7 +31,7 @@ RSpec.describe 'New project', :js do
it 'does not show mirror repository option' do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
first('.js-import-git-toggle-button').click
expect(page).not_to have_content('Mirror repository')
......@@ -60,16 +60,16 @@ RSpec.describe 'New project', :js do
it 'shows CI/CD tab and pane' do
visit new_project_path
expect(page).to have_css('[data-qa-panel-name="cicd_for_external_repo"]')
expect(page).to have_css('[data-qa-panel-name="cicd_for_external_repo"]') # rubocop:disable QA/SelectorUsage
find('[data-qa-panel-name="cicd_for_external_repo"]').click
find('[data-qa-panel-name="cicd_for_external_repo"]').click # rubocop:disable QA/SelectorUsage
expect(page).to have_css('#ci-cd-project-pane')
end
it '"Import project" tab creates projects with features enabled' do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
page.within '#import-project-pane' do
first('.js-import-git-toggle-button').click
......@@ -89,7 +89,7 @@ RSpec.describe 'New project', :js do
it 'creates CI/CD project from repo URL', :sidekiq_might_not_need_inline do
visit new_project_path
find('[data-qa-panel-name="cicd_for_external_repo"]').click
find('[data-qa-panel-name="cicd_for_external_repo"]').click # rubocop:disable QA/SelectorUsage
page.within '#ci-cd-project-pane' do
find('.js-import-git-toggle-button').click
......@@ -109,7 +109,7 @@ RSpec.describe 'New project', :js do
it 'creates CI/CD project from GitHub' do
visit new_project_path
find('[data-qa-panel-name="cicd_for_external_repo"]').click
find('[data-qa-panel-name="cicd_for_external_repo"]').click # rubocop:disable QA/SelectorUsage
page.within '#ci-cd-project-pane' do
find('.js-import-github').click
......@@ -146,7 +146,7 @@ RSpec.describe 'New project', :js do
it 'stays on GitHub import page after access token failure' do
visit new_project_path
find('[data-qa-panel-name="cicd_for_external_repo"]').click
find('[data-qa-panel-name="cicd_for_external_repo"]').click # rubocop:disable QA/SelectorUsage
page.within '#ci-cd-project-pane' do
find('.js-import-github').click
......@@ -170,7 +170,7 @@ RSpec.describe 'New project', :js do
it 'does not show CI/CD only tab' do
visit new_project_path
expect(page).not_to have_css('[data-qa-panel-name="cicd_for_external_repo"]')
expect(page).not_to have_css('[data-qa-panel-name="cicd_for_external_repo"]') # rubocop:disable QA/SelectorUsage
end
end
end
......@@ -458,7 +458,7 @@ RSpec.describe 'New project', :js do
def visit_create_from_built_in_templates_tab
visit new_project_path
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
end
end
end
......@@ -19,7 +19,7 @@ RSpec.describe 'Project', :js do
it "defaults to correct namespace" do
visit new_project_path
find('[data-qa-selector="create_from_template_link"]').click
find('[data-qa-selector="create_from_template_link"]').click # rubocop:disable QA/SelectorUsage
find('.custom-group-project-templates-tab').click
find("label[for=#{template.name}]").click
......@@ -28,7 +28,7 @@ RSpec.describe 'Project', :js do
it "uses supplied namespace" do
visit new_project_path(namespace_id: other_subgroup.id)
find('[data-qa-selector="create_from_template_link"]').click
find('[data-qa-selector="create_from_template_link"]').click # rubocop:disable QA/SelectorUsage
find('.custom-group-project-templates-tab').click
find("label[for=#{template.name}]").click
......
......@@ -98,7 +98,7 @@ RSpec.describe 'Protected Branches', :js do
it 'displays toggle off' do
visit project_settings_repository_path(project)
page.within '.qa-protected-branches-list' do
page.within '.qa-protected-branches-list' do # rubocop:disable QA/SelectorUsage
expect(page).not_to have_css('.js-code-owner-toggle.is-checked')
end
end
......
......@@ -179,9 +179,9 @@ RSpec.shared_examples "protected branches > access control > EE" do
it 'unprotect/delete can be performed by a maintainer' do
visit project_protected_branches_path(project)
expect(page).to have_selector('.qa-protected-branch')
expect(page).to have_selector('.qa-protected-branch') # rubocop:disable QA/SelectorUsage
accept_alert { click_on 'Unprotect' }
expect(page).not_to have_selector('.qa-protected-branch')
expect(page).not_to have_selector('.qa-protected-branch') # rubocop:disable QA/SelectorUsage
end
context 'with unprotect access levels' do
......
......@@ -9,8 +9,8 @@ RSpec.describe 'groups/settings/_transfer.html.haml' do
it 'enables the Select parent group dropdown and does not show an alert for a group' do
render 'groups/settings/transfer', group: group
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"]'
expect(rendered).not_to have_selector '[data-qa-selector="select_group_dropdown"][disabled]'
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"]' # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_selector '[data-qa-selector="select_group_dropdown"][disabled]' # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_selector '[data-testid="group-to-transfer-has-linked-subscription-alert"]'
end
......@@ -19,7 +19,7 @@ RSpec.describe 'groups/settings/_transfer.html.haml' do
render 'groups/settings/transfer', group: group
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"][disabled]'
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"][disabled]' # rubocop:disable QA/SelectorUsage
expect(rendered).to have_selector '[data-testid="group-to-transfer-has-linked-subscription-alert"]'
end
......@@ -29,8 +29,8 @@ RSpec.describe 'groups/settings/_transfer.html.haml' do
render 'groups/settings/transfer', group: subgroup
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"]'
expect(rendered).not_to have_selector '[data-qa-selector="select_group_dropdown"][disabled]'
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"]' # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_selector '[data-qa-selector="select_group_dropdown"][disabled]' # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_selector '[data-testid="group-to-transfer-has-linked-subscription-alert"]'
end
end
......
# frozen_string_literal: true
require_relative '../../qa_helpers'
require_relative '../../code_reuse_helpers'
module RuboCop
module Cop
module QA
# This cop checks for the usage of data-qa-selectors or .qa-* classes in non-QA files
#
# @example
# # bad
# find('[data-qa-selector="the_selector"]')
# find('.qa-selector')
#
# # good
# find('[data-testid="the_selector"]')
# find('#selector')
class SelectorUsage < RuboCop::Cop::Cop
include QAHelpers
include CodeReuseHelpers
SELECTORS = /\.qa-\w+|data-qa-\w+/.freeze
MESSAGE = %(Do not use `%s` as this is reserved for the end-to-end specs. Use a different selector or a data-testid instead.)
def on_str(node)
return if in_qa_file?(node)
return unless in_spec?(node)
add_offense(node, message: MESSAGE % node.value) if SELECTORS =~ node.value
rescue StandardError
# catch all errors and ignore them.
# without this catch-all rescue, rubocop will fail
# because of non-UTF-8 characters in some Strings
end
end
end
end
end
......@@ -90,7 +90,7 @@ RSpec.describe 'Admin Appearance' do
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
expect_custom_new_project_appearance(appearance)
end
......
......@@ -256,7 +256,7 @@ RSpec.describe 'Admin Groups' do
visit group_group_members_path(group)
page.within '[data-qa-selector="members_list"]' do
page.within '[data-qa-selector="members_list"]' do # rubocop:disable QA/SelectorUsage
expect(page).to have_content(current_user.name)
expect(page).to have_content('Developer')
end
......@@ -265,7 +265,7 @@ RSpec.describe 'Admin Groups' do
visit group_group_members_path(group)
page.within '[data-qa-selector="members_list"]' do
page.within '[data-qa-selector="members_list"]' do # rubocop:disable QA/SelectorUsage
expect(page).not_to have_content(current_user.name)
expect(page).not_to have_content('Developer')
end
......
......@@ -184,7 +184,7 @@ RSpec.describe 'Admin::Users::User' do
it 'logs in as the user when impersonate is clicked' do
subject
find('[data-qa-selector="user_menu"]').click
find('[data-qa-selector="user_menu"]').click # rubocop:disable QA/SelectorUsage
expect(page.find(:css, '[data-testid="user-profile-link"]')['data-user']).to eql(another_user.username)
end
......@@ -220,7 +220,7 @@ RSpec.describe 'Admin::Users::User' do
it 'logs out of impersonated user back to original user' do
subject
find('[data-qa-selector="user_menu"]').click
find('[data-qa-selector="user_menu"]').click # rubocop:disable QA/SelectorUsage
expect(page.find(:css, '[data-testid="user-profile-link"]')['data-user']).to eq(current_user.username)
end
......
......@@ -33,7 +33,7 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j
context 'resolving the thread' do
before do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
it 'hides the link for creating a new issue' do
......
......@@ -35,7 +35,7 @@ RSpec.describe 'Resolve an open thread in a merge request by creating an issue',
context 'resolving the thread' do
before do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
it 'hides the link for creating a new issue' do
......
......@@ -408,7 +408,7 @@ RSpec.describe 'Issue Sidebar' do
context 'sidebar', :js do
it 'finds issue copy forwarding email' do
expect(find('[data-qa-selector="copy-forward-email"]').text).to eq "Issue email: #{issue.creatable_note_email_address(user)}"
expect(find('[data-qa-selector="copy-forward-email"]').text).to eq "Issue email: #{issue.creatable_note_email_address(user)}" # rubocop:disable QA/SelectorUsage
end
end
......@@ -444,7 +444,7 @@ RSpec.describe 'Issue Sidebar' do
end
it 'does not find issue email' do
expect(page).not_to have_selector('[data-qa-selector="copy-forward-email"]')
expect(page).not_to have_selector('[data-qa-selector="copy-forward-email"]') # rubocop:disable QA/SelectorUsage
end
end
end
......
......@@ -182,7 +182,7 @@ RSpec.describe "User creates issue" do
end
it 'does not hide the milestone select' do
expect(page).to have_selector('.qa-issuable-milestone-dropdown')
expect(page).to have_selector('.qa-issuable-milestone-dropdown') # rubocop:disable QA/SelectorUsage
end
end
......@@ -202,11 +202,11 @@ RSpec.describe "User creates issue" do
end
it 'shows the milestone select' do
expect(page).to have_selector('.qa-issuable-milestone-dropdown')
expect(page).to have_selector('.qa-issuable-milestone-dropdown') # rubocop:disable QA/SelectorUsage
end
it 'hides the weight input' do
expect(page).not_to have_selector('.qa-issuable-weight-input')
expect(page).not_to have_selector('.qa-issuable-weight-input') # rubocop:disable QA/SelectorUsage
end
it 'shows the incident help text' do
......
......@@ -63,7 +63,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to mark thread as resolved' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
expect(page).to have_selector('.discussion-body', visible: false)
......@@ -80,7 +80,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to unresolve thread' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
click_button 'Unresolve thread'
end
......@@ -92,7 +92,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
describe 'resolved thread' do
before do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
visit_merge_request
......@@ -193,7 +193,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to resolve from reply form without a comment' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
page.within '.line-resolve-all-container' do
......@@ -230,7 +230,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'hides jump to next button when all resolved' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
expect(page).to have_selector('.discussion-next-btn', visible: false)
......@@ -326,7 +326,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to mark all threads as resolved' do
page.all('.discussion-reply-holder', count: 2).each do |reply_holder|
page.within reply_holder do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
end
......@@ -338,7 +338,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to quickly scroll to next unresolved thread' do
page.within('.discussion-reply-holder', match: :first) do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
page.within '.line-resolve-all-container' do
......@@ -410,7 +410,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to mark thread as resolved' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
end
page.within '.diff-content .note' do
......@@ -425,7 +425,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to unresolve thread' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
click_button 'Unresolve thread'
end
......@@ -453,7 +453,7 @@ RSpec.describe 'Merge request > User resolves diff notes and threads', :js do
it 'allows user to comment & unresolve thread' do
page.within '.diff-content' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
find_field('Reply…').click
......
......@@ -21,7 +21,7 @@ RSpec.describe 'Project variables', :js do
click_button('Add variable')
page.within('#add-ci-variable') do
find('[data-qa-selector="ci_variable_key_field"] input').set('akey')
find('[data-qa-selector="ci_variable_key_field"] input').set('akey') # rubocop:disable QA/SelectorUsage
find('#ci-variable-value').set('akey_value')
find('[data-testid="environment-scope"]').click
find('[data-testid="ci-environment-search"]').set('review/*')
......
......@@ -137,7 +137,7 @@ RSpec.describe 'File blob', :js do
context 'when ref switch' do
def switch_ref_to(ref_name)
first('.qa-branches-select').click
first('.qa-branches-select').click # rubocop:disable QA/SelectorUsage
page.within '.project-refs-form' do
click_link ref_name
......
......@@ -30,9 +30,9 @@ RSpec.describe 'Environment > Metrics' do
click_link 'Monitoring'
expect(page).to have_current_path(project_metrics_dashboard_path(project, environment: environment.id))
expect(page).to have_css('[data-qa-selector="environments_dropdown"]')
expect(page).to have_css('[data-qa-selector="environments_dropdown"]') # rubocop:disable QA/SelectorUsage
within('[data-qa-selector="environments_dropdown"]') do
within('[data-qa-selector="environments_dropdown"]') do # rubocop:disable QA/SelectorUsage
# Click on the dropdown
click_on(environment.name)
......@@ -58,7 +58,7 @@ RSpec.describe 'Environment > Metrics' do
it 'shows metrics', :js do
click_link 'Monitoring'
expect(page).to have_css('[data-qa-selector="prometheus_graphs"]')
expect(page).to have_css('[data-qa-selector="prometheus_graphs"]') # rubocop:disable QA/SelectorUsage
end
it_behaves_like 'has environment selector'
......
......@@ -455,10 +455,10 @@ RSpec.describe 'Environments page', :js do
expect(page).to have_content 'review-1'
expect(page).to have_content 'review-2'
within('.ci-table') do
within('[data-qa-selector="environment_item"]', text: 'review-1') do
within('[data-qa-selector="environment_item"]', text: 'review-1') do # rubocop:disable QA/SelectorUsage
expect(find('.js-auto-stop').text).not_to be_empty
end
within('[data-qa-selector="environment_item"]', text: 'review-2') do
within('[data-qa-selector="environment_item"]', text: 'review-2') do # rubocop:disable QA/SelectorUsage
expect(find('.js-auto-stop').text).not_to be_empty
end
end
......
......@@ -50,7 +50,7 @@ RSpec.describe 'Environment > Pod Logs', :js, :kubeclient do
wait_for_requests
page.within('.qa-pods-dropdown') do
page.within('.qa-pods-dropdown') do # rubocop:disable QA/SelectorUsage
find(".dropdown-toggle:not([disabled])").click
dropdown_items = find(".dropdown-menu").all(".dropdown-item:not([disabled])")
......
......@@ -91,7 +91,7 @@ RSpec.describe 'User sees feature flag list', :js do
it 'shows the empty page' do
expect(page).to have_text 'Get started with feature flags'
expect(page).to have_selector('.btn-confirm', text: 'New feature flag')
expect(page).to have_selector('[data-qa-selector="configure_feature_flags_button"]', text: 'Configure')
expect(page).to have_selector('[data-qa-selector="configure_feature_flags_button"]', text: 'Configure') # rubocop:disable QA/SelectorUsage
end
end
end
......@@ -18,7 +18,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
expect(current_path).to eq("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE")
expect(page).to have_selector('.qa-file-templates-bar')
expect(page).to have_selector('.qa-file-templates-bar') # rubocop:disable QA/SelectorUsage
select_template('MIT License')
......
......@@ -181,8 +181,8 @@ RSpec.describe 'Project fork' do
it 'allows user to fork only to the group on fork page', :js do
visit new_project_fork_path(project)
to_personal_namespace = find('[data-qa-selector=fork_namespace_button].disabled')
to_group = find(".fork-groups button[data-qa-name=#{group.name}]")
to_personal_namespace = find('[data-qa-selector=fork_namespace_button].disabled') # rubocop:disable QA/SelectorUsage
to_group = find(".fork-groups button[data-qa-name=#{group.name}]") # rubocop:disable QA/SelectorUsage
expect(to_personal_namespace).not_to be_nil
expect(to_group).not_to be_disabled
......
......@@ -62,6 +62,6 @@ RSpec.describe 'Import/Export - project import integration test', :js do
end
def click_import_project
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
end
end
......@@ -13,7 +13,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
using RSpec::Parameterized::TableSyntax
where(:invite_members_group_modal_enabled, :expected_invite_group_selector) do
true | 'button[data-qa-selector="invite_a_group_button"]'
true | 'button[data-qa-selector="invite_a_group_button"]' # rubocop:disable QA/SelectorUsage
false | '#invite-group-tab'
end
......@@ -43,7 +43,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
end
describe 'Share with group lock' do
let(:invite_group_selector) { 'button[data-qa-selector="invite_a_group_button"]' }
let(:invite_group_selector) { 'button[data-qa-selector="invite_a_group_button"]' } # rubocop:disable QA/SelectorUsage
shared_examples 'the project can be shared with groups' do
it 'the "Invite a group" button exists' do
......
......@@ -19,7 +19,7 @@ RSpec.describe 'New project', :js do
)
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
expect(page).to have_content 'Other visibility settings have been disabled by the administrator.'
end
......@@ -30,7 +30,7 @@ RSpec.describe 'New project', :js do
)
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
expect(page).to have_content 'Visibility settings have been disabled by the administrator.'
end
......@@ -45,14 +45,14 @@ RSpec.describe 'New project', :js do
it 'shows "New project" page', :js do
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
expect(page).to have_content('Project name')
expect(page).to have_content('Project URL')
expect(page).to have_content('Project slug')
click_link('New project')
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
expect(page).to have_link('GitHub')
expect(page).to have_link('Bitbucket')
......@@ -65,7 +65,7 @@ RSpec.describe 'New project', :js do
before do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
end
it 'has Manifest file' do
......@@ -79,7 +79,7 @@ RSpec.describe 'New project', :js do
stub_application_setting(default_project_visibility: level)
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
page.within('#blank-project-pane') do
expect(find_field("project_visibility_level_#{level}")).to be_checked
end
......@@ -87,7 +87,7 @@ RSpec.describe 'New project', :js do
it "saves visibility level #{level} on validation error" do
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
choose(key)
click_button('Create project')
......@@ -107,7 +107,7 @@ RSpec.describe 'New project', :js do
context 'when admin mode is enabled', :enable_admin_mode do
it 'has private selected' do
visit new_project_path(namespace_id: group.id)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
page.within('#blank-project-pane') do
expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
......@@ -134,7 +134,7 @@ RSpec.describe 'New project', :js do
context 'when admin mode is enabled', :enable_admin_mode do
it 'has private selected' do
visit new_project_path(namespace_id: group.id, project: { visibility_level: Gitlab::VisibilityLevel::PRIVATE })
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
page.within('#blank-project-pane') do
expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
......@@ -155,7 +155,7 @@ RSpec.describe 'New project', :js do
context 'Readme selector' do
it 'shows the initialize with Readme checkbox on "Blank project" tab' do
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
expect(page).to have_css('input#project_initialize_with_readme')
expect(page).to have_content('Initialize repository with a README')
......@@ -163,7 +163,7 @@ RSpec.describe 'New project', :js do
it 'does not show the initialize with Readme checkbox on "Create from template" tab' do
visit new_project_path
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
first('.choose-template').click
page.within '.project-fields-form' do
......@@ -174,7 +174,7 @@ RSpec.describe 'New project', :js do
it 'does not show the initialize with Readme checkbox on "Import project" tab' do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
first('.js-import-git-toggle-button').click
page.within '#import-project-pane' do
......@@ -188,7 +188,7 @@ RSpec.describe 'New project', :js do
context 'with user namespace' do
before do
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
end
it 'selects the user namespace' do
......@@ -204,7 +204,7 @@ RSpec.describe 'New project', :js do
before do
group.add_owner(user)
visit new_project_path(namespace_id: group.id)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
end
it 'selects the group namespace' do
......@@ -221,7 +221,7 @@ RSpec.describe 'New project', :js do
before do
group.add_maintainer(user)
visit new_project_path(namespace_id: subgroup.id)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
end
it 'selects the group namespace' do
......@@ -241,7 +241,7 @@ RSpec.describe 'New project', :js do
internal_group.add_owner(user)
private_group.add_owner(user)
visit new_project_path(namespace_id: public_group.id)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
end
it 'enables the correct visibility options' do
......@@ -271,7 +271,7 @@ RSpec.describe 'New project', :js do
context 'Import project options', :js do
before do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
end
context 'from git repository url, "Repo by URL"' do
......@@ -343,7 +343,7 @@ RSpec.describe 'New project', :js do
before do
group.add_developer(user)
visit new_project_path(namespace_id: group.id)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
end
it 'selects the group namespace' do
......
......@@ -39,7 +39,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js do
# The dropdown above the tree
page.within('.repo-breadcrumb') do
find('.qa-add-to-tree').click
find('.qa-add-to-tree').click # rubocop:disable QA/SelectorUsage
aggregate_failures 'dropdown links above the repo tree' do
expect(page).to have_link('New file')
......@@ -71,7 +71,7 @@ RSpec.describe 'Projects > Show > Collaboration links', :js do
find_new_menu_toggle.click
end
expect(page).not_to have_selector('.qa-add-to-tree')
expect(page).not_to have_selector('.qa-add-to-tree') # rubocop:disable QA/SelectorUsage
expect(page).not_to have_link('Web IDE')
end
......
......@@ -49,8 +49,8 @@ RSpec.describe 'Multi-file editor new directory', :js do
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
# taller (as it is by default with chrome headless) then the button will not exist.
if page.has_css?('.qa-begin-commit-button')
find('.qa-begin-commit-button').click
if page.has_css?('.qa-begin-commit-button') # rubocop:disable QA/SelectorUsage
find('.qa-begin-commit-button').click # rubocop:disable QA/SelectorUsage
end
fill_in('commit-message', with: 'commit message ide')
......
......@@ -39,8 +39,8 @@ RSpec.describe 'Multi-file editor new file', :js do
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
# taller (as it is by default with chrome headless) then the button will not exist.
if page.has_css?('.qa-begin-commit-button')
find('.qa-begin-commit-button').click
if page.has_css?('.qa-begin-commit-button') # rubocop:disable QA/SelectorUsage
find('.qa-begin-commit-button').click # rubocop:disable QA/SelectorUsage
end
fill_in('commit-message', with: 'commit message ide')
......
......@@ -26,7 +26,7 @@ RSpec.describe 'Projects tree', :js do
expect(page).to have_selector('.tree-item')
expect(page).to have_content('add tests for .gitattributes custom highlighting')
expect(page).not_to have_selector('.flash-alert')
expect(page).not_to have_selector('[data-qa-selector="label-lfs"]', text: 'LFS')
expect(page).not_to have_selector('[data-qa-selector="label-lfs"]', text: 'LFS') # rubocop:disable QA/SelectorUsage
end
it 'renders tree table for a subtree without errors' do
......@@ -35,7 +35,7 @@ RSpec.describe 'Projects tree', :js do
expect(page).to have_selector('.tree-item')
expect(page).to have_content('add spaces in whitespace file')
expect(page).not_to have_selector('[data-qa-selector="label-lfs"]', text: 'LFS')
expect(page).not_to have_selector('[data-qa-selector="label-lfs"]', text: 'LFS') # rubocop:disable QA/SelectorUsage
expect(page).not_to have_selector('.flash-alert')
end
......@@ -112,7 +112,7 @@ RSpec.describe 'Projects tree', :js do
it 'renders LFS badge on blob item' do
visit project_tree_path(project, File.join('master', 'files/lfs'))
expect(page).to have_selector('[data-qa-selector="label-lfs"]', text: 'LFS')
expect(page).to have_selector('[data-qa-selector="label-lfs"]', text: 'LFS') # rubocop:disable QA/SelectorUsage
end
end
......
......@@ -13,7 +13,7 @@ RSpec.describe 'User creates a project', :js do
it 'creates a new project' do
visit(new_project_path)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
fill_in(:project_name, with: 'Empty')
expect(page).to have_checked_field 'Initialize repository with a README'
......@@ -43,7 +43,7 @@ RSpec.describe 'User creates a project', :js do
it 'creates a new project' do
visit(new_project_path)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
fill_in :project_name, with: 'A Subgroup Project'
fill_in :project_path, with: 'a-subgroup-project'
......@@ -72,7 +72,7 @@ RSpec.describe 'User creates a project', :js do
it 'creates a new project' do
visit(new_project_path)
find('[data-qa-panel-name="blank_project"]').click
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
fill_in :project_name, with: 'a-new-project'
fill_in :project_path, with: 'a-new-project'
......
......@@ -16,7 +16,7 @@ RSpec.describe 'Project' do
shared_examples 'creates from template' do |template, sub_template_tab = nil|
it "is created from template", :js do
find('[data-qa-panel-name="create_from_template"]').click
find('[data-qa-panel-name="create_from_template"]').click # rubocop:disable QA/SelectorUsage
find(".project-template #{sub_template_tab}").click if sub_template_tab
find("label[for=#{template.name}]").click
fill_in("project_name", with: template.name)
......@@ -290,7 +290,7 @@ RSpec.describe 'Project' do
it 'has working links to submodules' do
click_link('645f6c4c')
expect(page).to have_selector('.qa-branches-select', text: '645f6c4c82fd3f5e06f67134450a570b795e55a6')
expect(page).to have_selector('.qa-branches-select', text: '645f6c4c82fd3f5e06f67134450a570b795e55a6') # rubocop:disable QA/SelectorUsage
end
context 'for signed commit on default branch', :js do
......
# frozen_string_literal: true
require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/qa/selector_usage'
RSpec.describe RuboCop::Cop::QA::SelectorUsage do
subject(:cop) { described_class.new }
shared_examples 'non-qa file usage' do
it 'reports an offense' do
expect_offense(<<-RUBY)
find('#{selector}').click
#{'^' * (selector.size + 2)} Do not use `#{selector}` as this is reserved for the end-to-end specs. Use a different selector or a data-testid instead.
RUBY
end
end
context 'in a QA file' do
before do
allow(cop).to receive(:in_qa_file?).and_return(true)
end
it 'has no error' do
expect_no_offenses(<<-RUBY)
has_element?('[data-qa-selector="my_selector"]')
RUBY
end
end
context 'outside of QA' do
before do
allow(cop).to receive(:in_qa_file?).and_return(false)
allow(cop).to receive(:in_spec?).and_return(true)
end
context 'data-qa-selector' do
let(:selector) { '[data-qa-selector="my_selector"]' }
it_behaves_like 'non-qa file usage'
end
context 'qa class' do
let(:selector) { '.qa-selector' }
it_behaves_like 'non-qa file usage'
end
end
end
......@@ -308,7 +308,7 @@ RSpec.shared_examples 'thread comments for issue, epic and merge request' do |re
let(:reply_id) { find("#{comments_selector} .note:last-of-type", match: :first)['data-note-id'] }
it 'can be replied to after resolving' do
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
wait_for_requests
refresh
......@@ -320,7 +320,7 @@ RSpec.shared_examples 'thread comments for issue, epic and merge request' do |re
it 'shows resolved thread when toggled' do
submit_reply('a')
find('button[data-qa-selector="resolve_discussion_button"]').click
find('button[data-qa-selector="resolve_discussion_button"]').click # rubocop:disable QA/SelectorUsage
wait_for_requests
expect(page).to have_selector(".note-row-#{note_id}", visible: true)
......
......@@ -14,7 +14,7 @@ RSpec.shared_examples 'packages list' do |check_project_name: false|
end
def package_table_row(index)
page.all("#{packages_table_selector} > [data-qa-selector=\"package_row\"]")[index].text
page.all("#{packages_table_selector} > [data-qa-selector=\"package_row\"]")[index].text # rubocop:disable QA/SelectorUsage
end
end
......@@ -92,7 +92,7 @@ RSpec.shared_examples 'shared package sorting' do
end
def packages_table_selector
'[data-qa-selector="packages-table"]'
'[data-qa-selector="packages-table"]' # rubocop:disable QA/SelectorUsage
end
def click_sort_option(option, ascending)
......
......@@ -23,7 +23,7 @@ RSpec.shared_examples 'Deploy keys with protected branches' do
find(".js-allowed-to-push").click
wait_for_requests
within('.qa-allowed-to-push-dropdown') do
within('.qa-allowed-to-push-dropdown') do # rubocop:disable QA/SelectorUsage
dropdown_headers = page.all('.dropdown-header').map(&:text)
expect(dropdown_headers).to contain_exactly(*all_dropdown_sections)
......@@ -38,7 +38,7 @@ RSpec.shared_examples 'Deploy keys with protected branches' do
find(".js-allowed-to-merge").click
wait_for_requests
within('.qa-allowed-to-merge-dropdown') do
within('.qa-allowed-to-merge-dropdown') do # rubocop:disable QA/SelectorUsage
dropdown_headers = page.all('.dropdown-header').map(&:text)
expect(dropdown_headers).to contain_exactly(*dropdown_sections_minus_deploy_keys)
......@@ -68,7 +68,7 @@ RSpec.shared_examples 'Deploy keys with protected branches' do
find(".js-allowed-to-push").click
wait_for_requests
within('.qa-allowed-to-push-dropdown') do
within('.qa-allowed-to-push-dropdown') do # rubocop:disable QA/SelectorUsage
dropdown_headers = page.all('.dropdown-header').map(&:text)
expect(dropdown_headers).to contain_exactly(*dropdown_sections_minus_deploy_keys)
......
......@@ -9,7 +9,7 @@ end
RSpec.shared_examples "it has an RSS button with current_user's feed token" do
it "shows the RSS button with current_user's feed token" do
expect(page)
.to have_css("a:has(.qa-rss-icon)[href*='feed_token=#{user.feed_token}']")
.to have_css("a:has(.qa-rss-icon)[href*='feed_token=#{user.feed_token}']") # rubocop:disable QA/SelectorUsage
end
end
......@@ -22,6 +22,6 @@ end
RSpec.shared_examples "it has an RSS button without a feed token" do
it "shows the RSS button without a feed token" do
expect(page)
.to have_css("a:has(.qa-rss-icon):not([href*='feed_token'])")
.to have_css("a:has(.qa-rss-icon):not([href*='feed_token'])") # rubocop:disable QA/SelectorUsage
end
end
......@@ -91,7 +91,7 @@ RSpec.shared_examples 'variable list' do
end
page.within('#add-ci-variable') do
find('[data-qa-selector="ci_variable_key_field"] input').set('new_key')
find('[data-qa-selector="ci_variable_key_field"] input').set('new_key') # rubocop:disable QA/SelectorUsage
click_button('Update variable')
end
......@@ -173,7 +173,7 @@ RSpec.shared_examples 'variable list' do
click_button('Add variable')
page.within('#add-ci-variable') do
find('[data-qa-selector="ci_variable_key_field"] input').set('empty_mask_key')
find('[data-qa-selector="ci_variable_key_field"] input').set('empty_mask_key') # rubocop:disable QA/SelectorUsage
find('[data-testid="ci-variable-protected-checkbox"]').click
find('[data-testid="ci-variable-masked-checkbox"]').click
......@@ -286,8 +286,8 @@ RSpec.shared_examples 'variable list' do
wait_for_requests
page.within('#add-ci-variable') do
find('[data-qa-selector="ci_variable_key_field"] input').set(key)
find('[data-qa-selector="ci_variable_value_field"]').set(value) if value.present?
find('[data-qa-selector="ci_variable_key_field"] input').set(key) # rubocop:disable QA/SelectorUsage
find('[data-qa-selector="ci_variable_value_field"]').set(value) if value.present? # rubocop:disable QA/SelectorUsage
find('[data-testid="ci-variable-protected-checkbox"]').click if protected
find('[data-testid="ci-variable-masked-checkbox"]').click if masked
......
# frozen_string_literal: true
RSpec.shared_examples 'User views AsciiDoc page with includes' do
let_it_be(:wiki_content_selector) { '[data-qa-selector=wiki_page_content]' }
let_it_be(:wiki_content_selector) { '[data-qa-selector=wiki_page_content]' } # rubocop:disable QA/SelectorUsage
let!(:included_wiki_page) { create_wiki_page('included_page', content: 'Content from the included page')}
let!(:wiki_page) { create_wiki_page('home', content: "Content from the main page.\ninclude::included_page.asciidoc[]") }
......
......@@ -19,9 +19,9 @@ RSpec.describe 'admin/sessions/new.html.haml' do
it 'shows enter password form' do
render
expect(rendered).to have_selector('[data-qa-selector="sign_in_tab"]')
expect(rendered).to have_selector('[data-qa-selector="sign_in_tab"]') # rubocop:disable QA/SelectorUsage
expect(rendered).to have_css('#login-pane.active')
expect(rendered).to have_selector('[data-qa-selector="password_field"]')
expect(rendered).to have_selector('[data-qa-selector="password_field"]') # rubocop:disable QA/SelectorUsage
end
it 'warns authentication not possible if password not set' do
......@@ -60,7 +60,7 @@ RSpec.describe 'admin/sessions/new.html.haml' do
it 'is shown when enabled' do
render
expect(rendered).to have_selector('[data-qa-selector="ldap_tab"]')
expect(rendered).to have_selector('[data-qa-selector="ldap_tab"]') # rubocop:disable QA/SelectorUsage
expect(rendered).to have_css('.login-box#ldapmain')
expect(rendered).to have_field('LDAP Username')
expect(rendered).not_to have_content('No authentication methods configured')
......@@ -71,7 +71,7 @@ RSpec.describe 'admin/sessions/new.html.haml' do
render
expect(rendered).not_to have_selector('[data-qa-selector="ldap_tab"]')
expect(rendered).not_to have_selector('[data-qa-selector="ldap_tab"]') # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_field('LDAP Username')
expect(rendered).to have_content('No authentication methods configured')
end
......
......@@ -48,7 +48,7 @@ RSpec.describe 'devise/sessions/new' do
render
expect(rendered).to have_selector('.new-session-tabs')
expect(rendered).to have_selector('[data-qa-selector="ldap_tab"]')
expect(rendered).to have_selector('[data-qa-selector="ldap_tab"]') # rubocop:disable QA/SelectorUsage
expect(rendered).to have_field('LDAP Username')
end
......@@ -58,7 +58,7 @@ RSpec.describe 'devise/sessions/new' do
render
expect(rendered).to have_content('No authentication methods configured')
expect(rendered).not_to have_selector('[data-qa-selector="ldap_tab"]')
expect(rendered).not_to have_selector('[data-qa-selector="ldap_tab"]') # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_field('LDAP Username')
end
end
......
......@@ -9,8 +9,8 @@ RSpec.describe 'groups/settings/_transfer.html.haml' do
render 'groups/settings/transfer', group: group
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"]'
expect(rendered).not_to have_selector '[data-qa-selector="select_group_dropdown"][disabled]'
expect(rendered).to have_selector '[data-qa-selector="select_group_dropdown"]' # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_selector '[data-qa-selector="select_group_dropdown"][disabled]' # rubocop:disable QA/SelectorUsage
expect(rendered).not_to have_selector '[data-testid="group-to-transfer-has-linked-subscription-alert"]'
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