diff options
Diffstat (limited to 'spec/features/projects')
31 files changed, 338 insertions, 244 deletions
diff --git a/spec/features/projects/branches/user_views_branches_spec.rb b/spec/features/projects/branches/user_views_branches_spec.rb index b6b6dcb5cf1..3f0614532f1 100644 --- a/spec/features/projects/branches/user_views_branches_spec.rb +++ b/spec/features/projects/branches/user_views_branches_spec.rb @@ -21,7 +21,7 @@ RSpec.describe "User views branches", :js do it "shows branches" do expect(page).to have_content("Branches").and have_content("master") - expect(page.all(".graph-side")).to all( have_content(/\d+/) ) + expect(page.all(".graph-side")).to all(have_content(/\d+/)) end it "displays a disabled button with a tooltip for the default branch that cannot be deleted", :js do diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 361a07ebd0b..ecf6349e431 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -7,7 +7,20 @@ RSpec.describe 'Branches' do let_it_be(:project) { create(:project, :public, :repository) } let(:repository) { project.repository } - context 'logged in as developer' do + context 'when logged in as reporter' do + before do + sign_in(user) + project.add_reporter(user) + end + + it 'does not show delete button' do + visit project_branches_path(project) + + expect(page).not_to have_css '.js-delete-branch-button' + end + end + + context 'when logged in as developer' do before do sign_in(user) project.add_developer(user) @@ -21,11 +34,15 @@ RSpec.describe 'Branches' do before do # Add 4 stale branches (1..4).reverse_each do |i| - travel_to((threshold + i.hours).ago) { create_file(message: "a commit in stale-#{i}", branch_name: "stale-#{i}") } + travel_to((threshold + i.hours).ago) do + create_file(message: "a commit in stale-#{i}", branch_name: "stale-#{i}") + end end # Add 6 active branches (1..6).each do |i| - travel_to((threshold - i.hours).ago) { create_file(message: "a commit in active-#{i}", branch_name: "active-#{i}") } + travel_to((threshold - i.hours).ago) do + create_file(message: "a commit in active-#{i}", branch_name: "active-#{i}") + end end end @@ -38,7 +55,10 @@ RSpec.describe 'Branches' do expect(page).to have_button('Copy branch name') - expect(page).to have_link('Show more active branches', href: project_branches_filtered_path(project, state: 'active')) + expect(page).to have_link( + 'Show more active branches', + href: project_branches_filtered_path(project, state: 'active') + ) expect(page).not_to have_content('Show more stale branches') end end @@ -75,13 +95,15 @@ RSpec.describe 'Branches' do it 'shows only default_per_page active branches sorted by last updated' do visit project_branches_filtered_path(project, state: 'active') - expect(page).to have_content(sorted_branches(repository, count: Kaminari.config.default_per_page, sort_by: :updated_desc, state: 'active')) + expect(page).to have_content(sorted_branches(repository, count: Kaminari.config.default_per_page, + sort_by: :updated_desc, state: 'active')) end it 'shows only default_per_page branches sorted by last updated on All branches' do visit project_branches_filtered_path(project, state: 'all') - expect(page).to have_content(sorted_branches(repository, count: Kaminari.config.default_per_page, sort_by: :updated_desc)) + expect(page).to have_content(sorted_branches(repository, count: Kaminari.config.default_per_page, + sort_by: :updated_desc)) end end end @@ -141,7 +163,7 @@ RSpec.describe 'Branches' do it 'avoids a N+1 query in branches index' do control_count = ActiveRecord::QueryRecorder.new { visit project_branches_path(project) }.count - %w(one two three four five).each { |ref| repository.add_branch(user, ref, 'master') } + %w[one two three four five].each { |ref| repository.add_branch(user, ref, 'master') } expect { visit project_branches_filtered_path(project, state: 'all') }.not_to exceed_query_limit(control_count) end @@ -193,7 +215,7 @@ RSpec.describe 'Branches' do end end - context 'logged in as maintainer' do + context 'when logged in as maintainer' do before do sign_in(user) project.add_maintainer(user) @@ -220,7 +242,7 @@ RSpec.describe 'Branches' do end end - context 'logged out' do + context 'when logged out' do before do visit project_branches_path(project) end @@ -314,7 +336,7 @@ RSpec.describe 'Branches' do Regexp.new(sorted_branches.join('.*')) end - def create_file(message: 'message', branch_name:) + def create_file(branch_name:, message: 'message') repository.create_file(user, generate(:branch), 'content', message: message, branch_name: branch_name) end diff --git a/spec/features/projects/container_registry_spec.rb b/spec/features/projects/container_registry_spec.rb index 54685441300..e99af734c43 100644 --- a/spec/features/projects/container_registry_spec.rb +++ b/spec/features/projects/container_registry_spec.rb @@ -56,10 +56,11 @@ RSpec.describe 'Container Registry', :js do expect(page).to have_content 'my/image' end - it 'user removes entire container repository', :sidekiq_might_not_need_inline do + it 'user removes entire container repository' do visit_container_registry - expect_any_instance_of(ContainerRepository).to receive(:delete_tags!).and_return(true) + expect_any_instance_of(ContainerRepository).to receive(:delete_scheduled!).and_call_original + expect(DeleteContainerRepositoryWorker).not_to receive(:perform_async) find('[title="Remove repository"]').click expect(find('.modal .modal-title')).to have_content _('Remove repository') diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index dc6e496d081..706c880d097 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Environment' do - let(:project) { create(:project, :repository) } + let_it_be(:project) { create(:project, :repository) } let(:user) { create(:user) } let(:role) { :developer } @@ -17,7 +17,7 @@ RSpec.describe 'Environment' do end describe 'environment details page' do - let!(:environment) { create(:environment, project: project) } + let_it_be(:environment) { create(:environment, project: project) } let!(:permissions) {} let!(:deployment) {} let!(:action) {} @@ -160,10 +160,20 @@ RSpec.describe 'Environment' do end context 'with related deployable present' do - let(:pipeline) { create(:ci_pipeline, project: project) } - let(:build) { create(:ci_build, pipeline: pipeline, environment: environment.name) } + let_it_be(:previous_pipeline) { create(:ci_pipeline, project: project) } - let(:deployment) do + let_it_be(:previous_build) do + create(:ci_build, :success, pipeline: previous_pipeline, environment: environment.name) + end + + let_it_be(:previous_deployment) do + create(:deployment, :success, environment: environment, deployable: previous_build) + end + + let_it_be(:pipeline) { create(:ci_pipeline, project: project) } + let_it_be(:build) { create(:ci_build, pipeline: pipeline, environment: environment.name) } + + let_it_be(:deployment) do create(:deployment, :success, environment: environment, deployable: build) end @@ -171,12 +181,10 @@ RSpec.describe 'Environment' do visit_environment(environment) end - it 'does show build name' do - expect(page).to have_link("#{build.name} (##{build.id})") - end - - it 'shows the re-deploy button' do + it 'shows deployment information and buttons', :js do expect(page).to have_button('Re-deploy to environment') + expect(page).to have_button('Rollback environment') + expect(page).to have_link("#{build.name} (##{build.id})") end context 'with manual action' do diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 9ec41cd8f8d..b445b0da901 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -336,6 +336,11 @@ RSpec.describe 'Environments page', :js do accept_gl_confirm do find(action_link_selector).click end + + # Wait for UI to transition to ensure we an GraphQL request has been made + within(actions_button_selector) { find('.gl-spinner') } + within(actions_button_selector) { find('[data-testid="play-icon"]') } + wait_for_requests end diff --git a/spec/features/projects/fork_spec.rb b/spec/features/projects/fork_spec.rb index 24943e7dd0f..9ceadb63178 100644 --- a/spec/features/projects/fork_spec.rb +++ b/spec/features/projects/fork_spec.rb @@ -134,7 +134,7 @@ RSpec.describe 'Project fork' do context 'fork form', :js do let(:group) { create(:group) } let(:group2) { create(:group) } - let(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user } + let(:user) { create(:group_member, :maintainer, user: create(:user), group: group).user } def submit_form(group_obj = group) find('[data-testid="select_namespace_dropdown"]').click @@ -180,7 +180,7 @@ RSpec.describe 'Project fork' do context 'with cache_home_panel feature flag' do before do - create(:group_member, :maintainer, user: user, group: group2 ) + create(:group_member, :maintainer, user: user, group: group2) end context 'when caching is enabled' do diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index c7fbaa85483..6f015f9cd22 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -3,8 +3,6 @@ require 'spec_helper' RSpec.describe 'Import/Export - project import integration test', :js do - include GitHelpers - let(:user) { create(:user) } let(:file) { File.join(Rails.root, 'spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') } let(:export_path) { "#{Dir.tmpdir}/import_file_spec" } diff --git a/spec/features/projects/integrations/user_activates_issue_tracker_spec.rb b/spec/features/projects/integrations/user_activates_issue_tracker_spec.rb index e7d4ed58549..d2c48cb2af0 100644 --- a/spec/features/projects/integrations/user_activates_issue_tracker_spec.rb +++ b/spec/features/projects/integrations/user_activates_issue_tracker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'User activates issue tracker', :js do +RSpec.describe 'User activates issue tracker', :js, feature_category: :integrations do include_context 'project integration activation' let(:url) { 'http://tracker.example.com' } diff --git a/spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb b/spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb index b423543dc33..3d40bae8544 100644 --- a/spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb +++ b/spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb @@ -41,7 +41,7 @@ RSpec.describe 'viewing an issue with cross project references' do let(:issue) do create(:issue, project: project, - description: description_referencing_other_issue ) + description: description_referencing_other_issue) end let(:confidential_issue) do @@ -102,8 +102,8 @@ RSpec.describe 'viewing an issue with cross project references' do it 'shows only the link to the cross project references' do visit project_issue_path(project, issue) - expect(page).to have_link("#{other_issue.to_reference(project)}") - expect(page).to have_link("#{other_merge_request.to_reference(project)}") + expect(page).to have_link(other_issue.to_reference(project).to_s) + expect(page).to have_link(other_merge_request.to_reference(project).to_s) expect(page).not_to have_content("#{other_issue.to_reference(project)} (#{other_issue.state})") expect(page).not_to have_xpath("//a[@title='#{other_issue.title}']") expect(page).not_to have_content("#{other_merge_request.to_reference(project)} (#{other_merge_request.state})") @@ -113,7 +113,7 @@ RSpec.describe 'viewing an issue with cross project references' do it 'does not link a cross project confidential issue if the user does not have access' do visit project_issue_path(project, issue) - expect(page).not_to have_link("#{other_confidential_issue.to_reference(project)}") + expect(page).not_to have_link(other_confidential_issue.to_reference(project).to_s) expect(page).not_to have_xpath("//a[@title='#{other_confidential_issue.title}']") end @@ -122,7 +122,7 @@ RSpec.describe 'viewing an issue with cross project references' do visit project_issue_path(project, issue) - expect(page).to have_link("#{other_confidential_issue.to_reference(project)}") + expect(page).to have_link(other_confidential_issue.to_reference(project).to_s) expect(page).not_to have_xpath("//a[@title='#{other_confidential_issue.title}']") end diff --git a/spec/features/projects/jobs/permissions_spec.rb b/spec/features/projects/jobs/permissions_spec.rb index b6019944071..740d009d6b8 100644 --- a/spec/features/projects/jobs/permissions_spec.rb +++ b/spec/features/projects/jobs/permissions_spec.rb @@ -211,4 +211,48 @@ RSpec.describe 'Project Jobs Permissions' do end end end + + context 'with CI_DEBUG_SERVICES' do + let_it_be(:ci_instance_variable) { create(:ci_instance_variable, key: 'CI_DEBUG_SERVICES') } + + describe 'trace endpoint and raw page' do + let_it_be(:job) { create(:ci_build, :running, :coverage, :trace_artifact, pipeline: pipeline) } + + where(:public_builds, :user_project_role, :ci_debug_services, :expected_status_code, :expected_msg) do + true | 'developer' | true | 200 | nil + true | 'guest' | true | 403 | 'You must have developer or higher permissions' + true | nil | true | 404 | 'Page Not Found Make sure the address is correct' + true | 'developer' | false | 200 | nil + true | 'guest' | false | 200 | nil + true | nil | false | 404 | 'Page Not Found Make sure the address is correct' + false | 'developer' | true | 200 | nil + false | 'guest' | true | 403 | 'You must have developer or higher permissions' + false | nil | true | 404 | 'Page Not Found Make sure the address is correct' + false | 'developer' | false | 200 | nil + false | 'guest' | false | 403 | 'The current user is not authorized to access the job log' + false | nil | false | 404 | 'Page Not Found Make sure the address is correct' + end + + with_them do + before do + ci_instance_variable.update!(value: ci_debug_services) + project.update!(public_builds: public_builds) + user_project_role && project.add_role(user, user_project_role) + end + + it 'renders trace to authorized users' do + visit trace_project_job_path(project, job) + + expect(status_code).to eq(expected_status_code) + end + + it 'renders raw trace to authorized users' do + visit raw_project_job_path(project, job) + + expect(status_code).to eq(expected_status_code) + expect(page).to have_content(expected_msg) + end + end + end + end end diff --git a/spec/features/projects/jobs/user_browses_jobs_spec.rb b/spec/features/projects/jobs/user_browses_jobs_spec.rb index 995f4a1e3d2..cb3c1594868 100644 --- a/spec/features/projects/jobs/user_browses_jobs_spec.rb +++ b/spec/features/projects/jobs/user_browses_jobs_spec.rb @@ -203,15 +203,15 @@ RSpec.describe 'User browses jobs' do end it 'contains a link to the job sha' do - expect(page.find('[data-testid="job-sha"]')).to have_content "#{job.sha[0..7]}" + expect(page.find('[data-testid="job-sha"]')).to have_content job.sha[0..7].to_s end it 'contains a link to the job id' do - expect(page.find('[data-testid="job-id-link"]')).to have_content "#{job.id}" + expect(page.find('[data-testid="job-id-link"]')).to have_content job.id.to_s end it 'contains a link to the job ref' do - expect(page.find('[data-testid="job-ref"]')).to have_content "#{job.ref}" + expect(page.find('[data-testid="job-ref"]')).to have_content job.ref.to_s end end end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 84c75752bc1..96a8168e708 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -463,7 +463,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do context 'when variables are stored in trigger_request' do before do - trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' } ) + trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' }) visit project_job_path(project, job) end @@ -508,7 +508,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do context 'when variables are stored in trigger_request' do before do - trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' } ) + trigger_request.update_attribute(:variables, { 'TRIGGER_KEY_1' => 'TRIGGER_VALUE_1' }) visit project_job_path(project, job) end diff --git a/spec/features/projects/members/manage_members_spec.rb b/spec/features/projects/members/manage_members_spec.rb index 56eb02607a5..1f317c55256 100644 --- a/spec/features/projects/members/manage_members_spec.rb +++ b/spec/features/projects/members/manage_members_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Projects > Members > Manage members', :js do +RSpec.describe 'Projects > Members > Manage members', :js, product_group: :onboarding do include Spec::Support::Helpers::Features::MembersHelpers include Spec::Support::Helpers::Features::InviteMembersModalHelper include Spec::Support::Helpers::ModalHelpers diff --git a/spec/features/projects/network_graph_spec.rb b/spec/features/projects/network_graph_spec.rb index 1ee0ea51e53..97b743b4d73 100644 --- a/spec/features/projects/network_graph_spec.rb +++ b/spec/features/projects/network_graph_spec.rb @@ -13,98 +13,110 @@ RSpec.describe 'Project Network Graph', :js do allow(Network::Graph).to receive(:max_count).and_return(10) end - context 'when branch is master' do - def switch_ref_to(ref_name) - first('.js-project-refs-dropdown').click - - page.within '.project-refs-form' do - click_link ref_name + shared_examples 'network graph' do + context 'when branch is master' do + def switch_ref_to(ref_name) + first('.js-project-refs-dropdown').click + + page.within '.project-refs-form' do + click_link ref_name + end end - end - def click_show_only_selected_branch_checkbox - find('#filter_ref').click - end + def click_show_only_selected_branch_checkbox + find('#filter_ref').click + end - before do - visit project_network_path(project, 'master') - end + before do + visit project_network_path(project, 'master') + end - it 'renders project network' do - expect(page).to have_selector ".network-graph" - expect(page).to have_selector '.dropdown-menu-toggle', text: "master" - page.within '.network-graph' do - expect(page).to have_content 'master' + it 'renders project network' do + expect(page).to have_selector ".network-graph" + expect(page).to have_selector '.dropdown-menu-toggle', text: "master" + page.within '.network-graph' do + expect(page).to have_content 'master' + end end - end - it 'switches ref to branch' do - switch_ref_to('feature') + it 'switches ref to branch' do + switch_ref_to('feature') - expect(page).to have_selector '.dropdown-menu-toggle', text: 'feature' - page.within '.network-graph' do - expect(page).to have_content 'feature' + expect(page).to have_selector '.dropdown-menu-toggle', text: 'feature' + page.within '.network-graph' do + expect(page).to have_content 'feature' + end end - end - it 'switches ref to tag' do - switch_ref_to('v1.0.0') + it 'switches ref to tag' do + switch_ref_to('v1.0.0') - expect(page).to have_selector '.dropdown-menu-toggle', text: 'v1.0.0' - page.within '.network-graph' do - expect(page).to have_content 'v1.0.0' + expect(page).to have_selector '.dropdown-menu-toggle', text: 'v1.0.0' + page.within '.network-graph' do + expect(page).to have_content 'v1.0.0' + end end - end - it 'renders by commit sha of "v1.0.0"' do - page.within ".network-form" do - fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' - find('button').click + it 'renders by commit sha of "v1.0.0"' do + page.within ".network-form" do + fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' + find('button').click + end + + expect(page).to have_selector ".network-graph" + expect(page).to have_selector '.dropdown-menu-toggle', text: "master" + page.within '.network-graph' do + expect(page).to have_content 'v1.0.0' + end end - expect(page).to have_selector ".network-graph" - expect(page).to have_selector '.dropdown-menu-toggle', text: "master" - page.within '.network-graph' do - expect(page).to have_content 'v1.0.0' - end - end + it 'filters select tag' do + switch_ref_to('v1.0.0') - it 'filters select tag' do - switch_ref_to('v1.0.0') + expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false + page.within '.network-graph' do + expect(page).to have_content 'Change some files' + end - expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false - page.within '.network-graph' do - expect(page).to have_content 'Change some files' - end + click_show_only_selected_branch_checkbox - click_show_only_selected_branch_checkbox + page.within '.network-graph' do + expect(page).not_to have_content 'Change some files' + end - page.within '.network-graph' do - expect(page).not_to have_content 'Change some files' + click_show_only_selected_branch_checkbox + + page.within '.network-graph' do + expect(page).to have_content 'Change some files' + end end - click_show_only_selected_branch_checkbox + it 'renders error message when sha commit not exists' do + page.within ".network-form" do + fill_in 'extended_sha1', with: ';' + find('button').click + end - page.within '.network-graph' do - expect(page).to have_content 'Change some files' + expect(page).to have_selector '[data-testid="alert-danger"]', text: "Git revision ';' does not exist." end end - it 'renders error message when sha commit not exists' do - page.within ".network-form" do - fill_in 'extended_sha1', with: ';' - find('button').click - end + it 'renders project network with test branch' do + visit project_network_path(project, "'test'") - expect(page).to have_selector '[data-testid="alert-danger"]', text: "Git revision ';' does not exist." + page.within '.network-graph' do + expect(page).to have_content "'test'" + end end end - it 'renders project network with test branch' do - visit project_network_path(project, "'test'") + it_behaves_like 'network graph' - page.within '.network-graph' do - expect(page).to have_content "'test'" + context 'when disable_network_graph_notes_count is disabled' do + before do + stub_feature_flags(disable_network_graph_notes_count: false) end + + it_behaves_like 'network graph' end end diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index 4ed0a11da38..e569fef76f8 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -6,7 +6,7 @@ RSpec.describe 'Pipeline Schedules', :js do include Spec::Support::Helpers::ModalHelpers let!(:project) { create(:project, :repository) } - let!(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) } + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project) } let!(:pipeline) { create(:ci_pipeline, pipeline_schedule: pipeline_schedule) } let(:scope) { nil } let!(:user) { create(:user) } @@ -45,7 +45,7 @@ RSpec.describe 'Pipeline Schedules', :js do description = find_field('schedule_description').value expect(description).to eq('pipeline schedule') expect(page).to have_button('master') - expect(page).to have_button('UTC') + expect(page).to have_button('Select timezone') end it 'edits the scheduled pipeline' do @@ -164,7 +164,7 @@ RSpec.describe 'Pipeline Schedules', :js do it 'sets defaults for timezone and target branch' do expect(page).to have_button('master') - expect(page).to have_button('UTC') + expect(page).to have_button('Select timezone') end it 'creates a new scheduled pipeline' do @@ -314,8 +314,8 @@ RSpec.describe 'Pipeline Schedules', :js do end def select_timezone - find('.js-timezone-dropdown').click - click_link 'American Samoa' + find('[data-testid="schedule-timezone"] .dropdown-toggle').click + find("button", text: "Arizona").click end def select_target_branch diff --git a/spec/features/projects/pipelines/legacy_pipeline_spec.rb b/spec/features/projects/pipelines/legacy_pipeline_spec.rb index d93c951791d..c4fc194f0cd 100644 --- a/spec/features/projects/pipelines/legacy_pipeline_spec.rb +++ b/spec/features/projects/pipelines/legacy_pipeline_spec.rb @@ -726,12 +726,7 @@ RSpec.describe 'Pipeline', :js do before do schedule.owner.block! - - begin - PipelineScheduleWorker.new.perform - rescue Ci::CreatePipelineService::CreateError - # Do nothing, assert view code after the Pipeline failed to create. - end + PipelineScheduleWorker.new.perform end it 'displays the PipelineSchedule in an inactive state' do diff --git a/spec/features/projects/pipelines/legacy_pipelines_spec.rb b/spec/features/projects/pipelines/legacy_pipelines_spec.rb index 2e0ea695ab3..9d3ac71a875 100644 --- a/spec/features/projects/pipelines/legacy_pipelines_spec.rb +++ b/spec/features/projects/pipelines/legacy_pipelines_spec.rb @@ -316,7 +316,6 @@ RSpec.describe 'Pipelines', :js do end before do - stub_feature_flags(bootstrap_confirmation_modals: false) visit_project_pipelines end diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 0b43e13996f..2d729af513a 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -64,7 +64,9 @@ RSpec.describe 'Pipeline', :js do let_it_be(:group) { create(:group) } let_it_be(:project, reload: true) { create(:project, :repository, group: group) } - let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) } + let(:pipeline) do + create(:ci_pipeline, name: 'Build pipeline', project: project, ref: 'master', sha: project.commit.id, user: user) + end subject(:visit_pipeline) { visit project_pipeline_path(project, pipeline) } @@ -96,6 +98,45 @@ RSpec.describe 'Pipeline', :js do end end + context 'with pipeline_name feature flag enabled' do + before do + stub_feature_flags(pipeline_name: true) + end + + it 'displays pipeline name instead of commit title' do + visit_pipeline + + within 'h3' do + expect(page).to have_content(pipeline.name) + end + + within '.well-segment[data-testid="commit-row"]' do + expect(page).to have_content(project.commit.title) + expect(page).to have_content(project.commit.short_id) + end + end + end + + context 'with pipeline_name feature flag disabled' do + before do + stub_feature_flags(pipeline_name: false) + end + + it 'displays commit title' do + visit_pipeline + + within 'h3' do + expect(page).not_to have_content(pipeline.name) + expect(page).to have_content(project.commit.title) + end + + within '.well-segment[data-testid="commit-row"]' do + expect(page).not_to have_content(project.commit.title) + expect(page).to have_content(project.commit.short_id) + end + end + end + describe 'related merge requests' do context 'when there are no related merge requests' do it 'shows a "no related merge requests" message' do @@ -363,7 +404,7 @@ RSpec.describe 'Pipeline', :js do project: downstream_project, ref: 'master', sha: downstream_project.commit.id, - child_of: pipeline ) + child_of: pipeline) end let!(:build) { create(:ci_build, status, pipeline: downstream_pipeline, user: user) } @@ -851,12 +892,7 @@ RSpec.describe 'Pipeline', :js do before do schedule.owner.block! - - begin - PipelineScheduleWorker.new.perform - rescue Ci::CreatePipelineService::CreateError - # Do nothing, assert view code after the Pipeline failed to create. - end + PipelineScheduleWorker.new.perform end it 'displays the PipelineSchedule in an inactive state' do diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index eabbcd5e38e..b7b715cb6db 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -680,7 +680,7 @@ RSpec.describe 'Pipelines', :js do end context 'when variables are specified' do - it 'creates a new pipeline with variables', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/375552' do + it 'creates a new pipeline with variables' do page.within(find("[data-testid='ci-variable-row']")) do find("[data-testid='pipeline-form-ci-variable-key']").set('key_name') find("[data-testid='pipeline-form-ci-variable-value']").set('value') @@ -708,7 +708,7 @@ RSpec.describe 'Pipelines', :js do it { expect(page).to have_content('Missing CI config file') } - it 'creates a pipeline after first request failed and a valid gitlab-ci.yml file is available when trying again', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/375552' do + it 'creates a pipeline after first request failed and a valid gitlab-ci.yml file is available when trying again' do stub_ci_pipeline_to_return_yaml_file expect do @@ -722,6 +722,7 @@ RSpec.describe 'Pipelines', :js do # Run Pipeline form with REST endpoints # TODO: Clean up tests when run_pipeline_graphql is enabled + # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/372310 context 'with feature flag disabled' do before do stub_feature_flags(run_pipeline_graphql: false) diff --git a/spec/features/projects/product_analytics/events_spec.rb b/spec/features/projects/product_analytics/events_spec.rb deleted file mode 100644 index 05d12e12acb..00000000000 --- a/spec/features/projects/product_analytics/events_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Product Analytics > Events' do - let_it_be(:project) { create(:project_empty_repo) } - let_it_be(:user) { create(:user) } - - let(:event) { create(:product_analytics_event, project: project) } - - before do - project.add_maintainer(user) - sign_in(user) - end - - it 'shows no events message' do - visit(project_product_analytics_path(project)) - - expect(page).to have_content('There are currently no events') - end - - it 'shows events' do - event - - visit(project_product_analytics_path(project)) - - expect(page).to have_content('dvce_created_tstamp') - expect(page).to have_content(event.event_id) - end -end diff --git a/spec/features/projects/product_analytics/graphs_spec.rb b/spec/features/projects/product_analytics/graphs_spec.rb deleted file mode 100644 index e2293893589..00000000000 --- a/spec/features/projects/product_analytics/graphs_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Product Analytics > Graphs' do - let_it_be(:project) { create(:project) } - let_it_be(:user) { create(:user) } - - before do - project.add_maintainer(user) - sign_in(user) - end - - it 'shows graphs', :js do - create(:product_analytics_event, project: project) - - visit(graphs_project_product_analytics_path(project)) - - expect(page).to have_content('Showing graphs based on events') - expect(page).to have_content('platform') - expect(page).to have_content('os_timezone') - expect(page).to have_content('br_lang') - expect(page).to have_content('doc_charset') - end -end diff --git a/spec/features/projects/product_analytics/setup_spec.rb b/spec/features/projects/product_analytics/setup_spec.rb deleted file mode 100644 index 45c2b67502c..00000000000 --- a/spec/features/projects/product_analytics/setup_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Product Analytics > Setup' do - let_it_be(:project) { create(:project_empty_repo) } - let_it_be(:user) { create(:user) } - - before do - project.add_maintainer(user) - sign_in(user) - end - - it 'shows the setup instructions' do - visit(setup_project_product_analytics_path(project)) - - expect(page).to have_content('Copy the code below to implement tracking in your application') - end -end diff --git a/spec/features/projects/product_analytics/test_spec.rb b/spec/features/projects/product_analytics/test_spec.rb deleted file mode 100644 index 8984fb409d1..00000000000 --- a/spec/features/projects/product_analytics/test_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Product Analytics > Test' do - let_it_be(:project) { create(:project_empty_repo) } - let_it_be(:user) { create(:user) } - - before do - project.add_maintainer(user) - sign_in(user) - end - - it 'says it sends a payload' do - visit(test_project_product_analytics_path(project)) - - expect(page).to have_content('This page sends a payload.') - end - - it 'shows the last event if there is one' do - event = create(:product_analytics_event, project: project) - - visit(test_project_product_analytics_path(project)) - - expect(page).to have_content(event.event_id) - end -end diff --git a/spec/features/projects/releases/user_views_edit_release_spec.rb b/spec/features/projects/releases/user_views_edit_release_spec.rb index 6551b254643..78b9798941a 100644 --- a/spec/features/projects/releases/user_views_edit_release_spec.rb +++ b/spec/features/projects/releases/user_views_edit_release_spec.rb @@ -6,7 +6,7 @@ RSpec.describe 'User edits Release', :js do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } - let(:release) { create(:release, :with_milestones, milestones_count: 1, project: project, name: 'The first release', tag: "v1.1.0" ) } + let(:release) { create(:release, :with_milestones, milestones_count: 1, project: project, name: 'The first release', tag: "v1.1.0") } let(:release_link) { create(:release_link, release: release) } before do diff --git a/spec/features/projects/releases/user_views_releases_spec.rb b/spec/features/projects/releases/user_views_releases_spec.rb index a7348b62fc0..10418e8072d 100644 --- a/spec/features/projects/releases/user_views_releases_spec.rb +++ b/spec/features/projects/releases/user_views_releases_spec.rb @@ -15,7 +15,7 @@ RSpec.describe 'User views releases', :js do let_it_be(:guest) { create(:user) } let_it_be(:internal_link) { create(:release_link, release: release_v1, name: 'An internal link', url: "#{project.web_url}/-/jobs/1/artifacts/download", filepath: nil) } - let_it_be(:internal_link_with_redirect) { create(:release_link, release: release_v1, name: 'An internal link with a redirect', url: "#{project.web_url}/-/jobs/2/artifacts/download", filepath: '/binaries/linux-amd64' ) } + let_it_be(:internal_link_with_redirect) { create(:release_link, release: release_v1, name: 'An internal link with a redirect', url: "#{project.web_url}/-/jobs/2/artifacts/download", filepath: '/binaries/linux-amd64') } let_it_be(:external_link) { create(:release_link, release: release_v1, name: 'An external link', url: "https://example.com/an/external/link", filepath: nil) } before do diff --git a/spec/features/projects/settings/branch_names_settings_spec.rb b/spec/features/projects/settings/branch_names_settings_spec.rb new file mode 100644 index 00000000000..fdd883bc2b6 --- /dev/null +++ b/spec/features/projects/settings/branch_names_settings_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Project settings > repositories > Branch names', :js do + let_it_be(:project) { create(:project, :public) } + let(:user) { create(:user) } + + before do + project.add_maintainer(user) + + sign_in(user) + end + + context 'when Issues are initially disabled' do + let(:project_feature) { project.project_feature } + + before do + project_feature.update!(issues_access_level: ProjectFeature::DISABLED) + visit project_settings_repository_path(project) + end + + it 'do not render the Branch names settings' do + expect(page).not_to have_content('Branch name template') + end + end + + context 'when Issues are initially enabled' do + before do + visit project_settings_repository_path(project) + end + + it 'shows the Branch names settings' do + expect(page).to have_content('Branch name template') + + value = "feature-%{id}" + + within('section#branch-defaults-settings') do + fill_in 'project[issue_branch_template]', with: value + + click_on('Save changes') + end + + expect(project.reload.issue_branch_template).to eq(value) + expect(page).to have_content('Branch name template') + end + end +end diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index d9bdbf7aa1a..b25ae80b3c3 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -30,7 +30,6 @@ RSpec.describe 'Projects > Settings > Repository settings' do before do stub_container_registry_config(enabled: true) - stub_feature_flags(ajax_new_deploy_token: project) end it_behaves_like 'a deploy token in settings' do diff --git a/spec/features/projects/settings/user_changes_default_branch_spec.rb b/spec/features/projects/settings/user_changes_default_branch_spec.rb index 508bbcc5327..bf064839bd7 100644 --- a/spec/features/projects/settings/user_changes_default_branch_spec.rb +++ b/spec/features/projects/settings/user_changes_default_branch_spec.rb @@ -25,11 +25,11 @@ RSpec.describe 'Projects > Settings > User changes default branch' do fill_in 'Search branch', with: 'fix' click_button 'fix' - page.within '#default-branch-settings' do + page.within '#branch-defaults-settings' do click_button 'Save changes' end - expect(find("#{dropdown_selector} input", visible: false).value).to eq 'fix' + expect(find(dropdown_selector)).to have_text 'fix' end end diff --git a/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb b/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb index eed3494ef5b..47383be1ba1 100644 --- a/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb +++ b/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb @@ -11,7 +11,6 @@ RSpec.describe 'Repository Settings > User sees revoke deploy token modal', :js before do project.add_role(user, role) sign_in(user) - stub_feature_flags(ajax_new_deploy_token: project) visit(project_settings_repository_path(project)) click_button('Revoke') end diff --git a/spec/features/projects/settings/webhooks_settings_spec.rb b/spec/features/projects/settings/webhooks_settings_spec.rb index 25752bcaf45..adbf2f6ee5c 100644 --- a/spec/features/projects/settings/webhooks_settings_spec.rb +++ b/spec/features/projects/settings/webhooks_settings_spec.rb @@ -48,22 +48,47 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do expect(page).to have_content('Releases events') end - it 'create webhook', :js do - visit webhooks_path + context 'when feature flag "enhanced_webhook_support_regex" is disabled' do + before do + stub_feature_flags(enhanced_webhook_support_regex: false) + end - fill_in 'URL', with: url - check 'Tag push events' - fill_in 'hook_push_events_branch_filter', with: 'master' - check 'Enable SSL verification' - check 'Job events' + it 'create webhook', :js do + visit webhooks_path - click_button 'Add webhook' + fill_in 'URL', with: url + check 'Tag push events' + fill_in 'hook_push_events_branch_filter', with: 'master' + check 'Enable SSL verification' + check 'Job events' - expect(page).to have_content(url) - expect(page).to have_content('SSL Verification: enabled') - expect(page).to have_content('Push events') - expect(page).to have_content('Tag push events') - expect(page).to have_content('Job events') + click_button 'Add webhook' + + expect(page).to have_content(url) + expect(page).to have_content('SSL Verification: enabled') + expect(page).to have_content('Tag push events') + expect(page).to have_content('Job events') + expect(page).to have_content('Push events') + end + end + + context 'when feature flag "enhanced_webhook_support_regex" is enabled' do + it 'create webhook', :js do + visit webhooks_path + + fill_in 'URL', with: url + check 'Tag push events' + check 'Enable SSL verification' + check 'Job events' + + click_button 'Add webhook' + + expect(page).to have_content(url) + expect(page).to have_content('SSL Verification: enabled') + expect(page).to have_content('Tag push events') + expect(page).to have_content('Job events') + expect(page).to have_content('Push events') + end end it 'edit existing webhook', :js do diff --git a/spec/features/projects/user_changes_project_visibility_spec.rb b/spec/features/projects/user_changes_project_visibility_spec.rb index d2a7596aec0..df13bb55c6d 100644 --- a/spec/features/projects/user_changes_project_visibility_spec.rb +++ b/spec/features/projects/user_changes_project_visibility_spec.rb @@ -103,6 +103,9 @@ RSpec.describe 'User changes public project visibility', :js do sign_in(project.first_owner) visit edit_project_path(project) + + # https://gitlab.com/gitlab-org/gitlab/-/issues/381259 + allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(110) end it_behaves_like 'does not require confirmation' |