Commit 1b217d87 authored by Coung Ngo's avatar Coung Ngo Committed by Ezekiel Kigbo

Improve feature tests

Fix some instances of rubocop:disable QA/SelectorUsage
parent a0d10fed
......@@ -14,7 +14,7 @@
%li= s_("GroupSettings|If the parent group's visibility is lower than the group current visibility, visibility levels for subgroups and projects will be changed to match the new parent group's visibility.")
- if group.paid?
.gl-alert.gl-alert-info.gl-mb-5{ data: { testid: 'group-to-transfer-has-linked-subscription-alert' } }
.gl-alert.gl-alert-info.gl-mb-5
= sprite_icon('information-o', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
.gl-alert-body
= html_escape(_("This group can't be transfered because it is linked to a subscription. To transfer this group, %{linkStart}link the subscription%{linkEnd} with a different group.")) % { linkStart: "<a href=\"#{help_page_path('subscriptions/index', anchor: 'change-the-linked-namespace')}\">".html_safe, linkEnd: '</a>'.html_safe }
......
......@@ -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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
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 # rubocop:disable QA/SelectorUsage
click_button 'Delete epic'
wait_for_requests
find('.js-modal-action-primary').click
......
......@@ -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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
find('.project-template .custom-instance-project-templates-tab').click
expect(page).to have_css('.custom-project-templates .gl-pagination')
......
......@@ -18,7 +18,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 # rubocop:disable QA/SelectorUsage
click_link 'Import project'
first('.js-import-git-toggle-button').click
expect(page).to have_unchecked_field('Mirror repository', disabled: false)
......@@ -32,7 +32,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 # rubocop:disable QA/SelectorUsage
click_link 'Import project'
first('.js-import-git-toggle-button').click
expect(page).not_to have_content('Mirror repository')
......@@ -61,9 +61,9 @@ 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"]') # rubocop:disable QA/SelectorUsage
expect(page).to have_link 'Run CI/CD for external repository'
find('[data-qa-panel-name="cicd_for_external_repo"]').click # rubocop:disable QA/SelectorUsage
click_link 'Run CI/CD for external repository'
expect(page).to have_css('#ci-cd-project-pane')
end
......@@ -72,7 +72,7 @@ RSpec.describe 'New project', :js do
stub_request(:get, "http://foo.git/info/refs?service=git-upload-pack").to_return(status: 200, body: "001e# servdice=git-upload-pack")
visit new_project_path
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
click_link 'Import project'
page.within '#import-project-pane' do
first('.js-import-git-toggle-button').click
......@@ -95,7 +95,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 # rubocop:disable QA/SelectorUsage
click_link 'Run CI/CD for external repository'
page.within '#ci-cd-project-pane' do
find('.js-import-git-toggle-button').click
......@@ -115,7 +115,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 # rubocop:disable QA/SelectorUsage
click_link 'Run CI/CD for external repository'
page.within '#ci-cd-project-pane' do
find('.js-import-github').click
......@@ -152,7 +152,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 # rubocop:disable QA/SelectorUsage
click_link 'Run CI/CD for external repository'
page.within '#ci-cd-project-pane' do
find('.js-import-github').click
......@@ -176,7 +176,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"]') # rubocop:disable QA/SelectorUsage
expect(page).not_to have_text 'Run CI/CD for external repository'
end
end
end
......@@ -464,7 +464,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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
find('.custom-group-project-templates-tab').click
find("label[for=#{template.name}]").click
......
......@@ -9,9 +9,9 @@ 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"]' # 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"]'
expect(rendered).to have_button 'Select parent group'
expect(rendered).not_to have_button 'Select parent group', disabled: true
expect(rendered).not_to have_text "This group can't be transfered because it is linked to a subscription."
end
it 'disables the Select parent group dropdown and shows an alert for a group with a paid gitlab.com plan', :saas do
......@@ -19,8 +19,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"][disabled]' # rubocop:disable QA/SelectorUsage
expect(rendered).to have_selector '[data-testid="group-to-transfer-has-linked-subscription-alert"]'
expect(rendered).to have_button 'Select parent group', disabled: true
expect(rendered).to have_text "This group can't be transfered because it is linked to a subscription."
end
it 'enables the Select parent group dropdown and does not show an alert for a subgroup', :saas do
......@@ -29,9 +29,9 @@ 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"]' # 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"]'
expect(rendered).to have_button 'Select parent group'
expect(rendered).not_to have_button 'Select parent group', disabled: true
expect(rendered).not_to have_text "This group can't be transfered because it is linked to a subscription."
end
end
end
......@@ -94,7 +94,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
expect_custom_new_project_appearance(appearance)
end
......
......@@ -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') # rubocop:disable QA/SelectorUsage
fill_in 'Key', with: 'akey'
find('#ci-variable-value').set('akey_value')
find('[data-testid="environment-scope"]').click
find('[data-testid="ci-environment-search"]').set('review/*')
......
......@@ -31,7 +31,7 @@ RSpec.describe 'Import/Export - project import integration test', :js do
it 'user imports an exported project successfully', :sidekiq_might_not_need_inline do
visit new_project_path
click_import_project
click_link 'Import project'
click_link 'GitLab export'
fill_in :name, with: 'Test Project Name', visible: true
......@@ -50,7 +50,7 @@ RSpec.describe 'Import/Export - project import integration test', :js do
visit new_project_path
click_import_project
click_link 'Import project'
click_link 'GitLab export'
fill_in :name, with: project.name, visible: true
attach_file('file', file)
......@@ -61,8 +61,4 @@ RSpec.describe 'Import/Export - project import integration test', :js do
end
end
end
def click_import_project
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
end
end
......@@ -23,7 +23,7 @@ RSpec.describe 'New project', :js do
)
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
expect(page).to have_content 'Other visibility settings have been disabled by the administrator.'
end
......@@ -34,7 +34,7 @@ RSpec.describe 'New project', :js do
)
visit new_project_path
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
expect(page).to have_content 'Visibility settings have been disabled by the administrator.'
end
......@@ -49,14 +49,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
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 # rubocop:disable QA/SelectorUsage
click_link 'Import project'
expect(page).to have_link('GitHub')
expect(page).to have_link('Bitbucket')
......@@ -69,7 +69,7 @@ RSpec.describe 'New project', :js do
before do
visit new_project_path
find('[data-qa-panel-name="import_project"]').click # rubocop:disable QA/SelectorUsage
click_link 'Import project'
end
it 'has Manifest file' do
......@@ -83,7 +83,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
page.within('#blank-project-pane') do
expect(find_field("project_visibility_level_#{level}")).to be_checked
end
......@@ -91,7 +91,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
choose(key)
click_button('Create project')
......@@ -111,7 +111,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
page.within('#blank-project-pane') do
expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
......@@ -138,7 +138,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
page.within('#blank-project-pane') do
expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
......@@ -159,7 +159,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
expect(page).to have_css('input#project_initialize_with_readme')
expect(page).to have_content('Initialize repository with a README')
......@@ -167,7 +167,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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
first('.choose-template').click
page.within '.project-fields-form' do
......@@ -178,7 +178,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 # rubocop:disable QA/SelectorUsage
click_link 'Import project'
first('.js-import-git-toggle-button').click
page.within '#import-project-pane' do
......@@ -192,7 +192,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
end
it 'selects the user namespace' do
......@@ -208,7 +208,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
end
it 'selects the group namespace' do
......@@ -225,7 +225,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
end
it 'selects the group namespace' do
......@@ -245,7 +245,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
end
it 'enables the correct visibility options' do
......@@ -275,7 +275,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 # rubocop:disable QA/SelectorUsage
click_link 'Import project'
end
context 'from git repository url, "Repo by URL"' do
......@@ -351,7 +351,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
end
it 'selects the group namespace' do
......
......@@ -14,7 +14,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
fill_in(:project_name, with: 'Empty')
expect(page).to have_checked_field 'Initialize repository with a README'
......@@ -38,7 +38,7 @@ RSpec.describe 'User creates a project', :js do
visit(new_project_path)
find('[data-qa-panel-name="blank_project"]').click # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
fill_in(:project_name, with: 'With initial commits')
expect(page).to have_checked_field 'Initialize repository with a README'
......@@ -67,7 +67,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
fill_in :project_name, with: 'A Subgroup Project'
fill_in :project_path, with: 'a-subgroup-project'
......@@ -96,7 +96,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 # rubocop:disable QA/SelectorUsage
click_link 'Create blank project'
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 # rubocop:disable QA/SelectorUsage
click_link 'Create from template'
find(".project-template #{sub_template_tab}").click if sub_template_tab
find("label[for=#{template.name}]").click
fill_in("project_name", with: template.name)
......
......@@ -9,9 +9,9 @@ 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"]' # 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"]'
expect(rendered).to have_button 'Select parent group'
expect(rendered).not_to have_button 'Select parent group', disabled: true
expect(rendered).not_to have_text "This group can't be transfered because it is linked to a subscription."
end
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