diff options
Diffstat (limited to 'spec/features/projects')
29 files changed, 529 insertions, 62 deletions
diff --git a/spec/features/projects/badges/list_spec.rb b/spec/features/projects/badges/list_spec.rb index e6bd4b22b0a..c9e4aabe72a 100644 --- a/spec/features/projects/badges/list_spec.rb +++ b/spec/features/projects/badges/list_spec.rb @@ -43,13 +43,46 @@ RSpec.describe 'list of badges', feature_category: :continuous_integration do it 'user changes current ref of build status badge', :js do page.within('.pipeline-status') do - first('.js-project-refs-dropdown').click + find('.ref-selector').click + wait_for_requests - page.within '.project-refs-form' do - click_link 'improve/awesome' + page.within('.ref-selector') do + fill_in 'Search by Git revision', with: 'improve/awesome' + wait_for_requests + find('li', text: 'improve/awesome', match: :prefer_exact).click end expect(page).to have_content 'badges/improve/awesome/pipeline.svg' end end + + it 'user changes current ref of coverage status badge', :js do + page.within('.coverage-report') do + find('.ref-selector').click + wait_for_requests + + page.within('.ref-selector') do + fill_in 'Search by Git revision', with: 'improve/awesome' + wait_for_requests + find('li', text: 'improve/awesome', match: :prefer_exact).click + end + + expect(page).to have_content 'badges/improve/awesome/coverage.svg' + end + end + + it 'user changes current ref of latest release status badge', :js do + page.within('.Latest-Release') do + find('.ref-selector').click + wait_for_requests + + page.within('.ref-selector') do + fill_in 'Search by Git revision', with: 'improve/awesome' + wait_for_requests + find('li', text: 'improve/awesome', match: :prefer_exact).click + end + + expect(page).to have_content '-/badges/release.svg' + end + end end diff --git a/spec/features/projects/blobs/blame_spec.rb b/spec/features/projects/blobs/blame_spec.rb index 27b7c6ef2d5..d3558af81b8 100644 --- a/spec/features/projects/blobs/blame_spec.rb +++ b/spec/features/projects/blobs/blame_spec.rb @@ -38,7 +38,7 @@ RSpec.describe 'File blame', :js, feature_category: :projects do within '[data-testid="blob-content-holder"]' do expect(page).to have_css('.blame-commit') expect(page).not_to have_css('.gl-pagination') - expect(page).not_to have_link _('View entire blame') + expect(page).not_to have_link _('Show full blame') end end @@ -53,7 +53,7 @@ RSpec.describe 'File blame', :js, feature_category: :projects do within '[data-testid="blob-content-holder"]' do expect(page).to have_css('.blame-commit') expect(page).to have_css('.gl-pagination') - expect(page).to have_link _('View entire blame') + expect(page).to have_link _('Show full blame') expect(page).to have_css('#L1') expect(page).not_to have_css('#L3') @@ -85,19 +85,42 @@ RSpec.describe 'File blame', :js, feature_category: :projects do end end - context 'when user clicks on View entire blame button' do + shared_examples 'a full blame page' do + context 'when user clicks on Show full blame button' do + before do + visit_blob_blame(path) + click_link _('Show full blame') + end + + it 'displays the blame page without pagination' do + within '[data-testid="blob-content-holder"]' do + expect(page).to have_css('#L1') + expect(page).to have_css('#L667') + expect(page).not_to have_css('.gl-pagination') + end + end + end + end + + context 'when streaming is disabled' do before do - visit_blob_blame(path) + stub_feature_flags(blame_page_streaming: false) end - it 'displays the blame page without pagination' do - within '[data-testid="blob-content-holder"]' do - click_link _('View entire blame') + it_behaves_like 'a full blame page' + end - expect(page).to have_css('#L1') - expect(page).to have_css('#L3') - expect(page).not_to have_css('.gl-pagination') - end + context 'when streaming is enabled' do + before do + stub_const('Projects::BlameService::STREAMING_PER_PAGE', 50) + end + + it_behaves_like 'a full blame page' + + it 'shows loading text' do + visit_blob_blame(path) + click_link _('Show full blame') + expect(page).to have_text('Loading full blame...') end end @@ -112,7 +135,7 @@ RSpec.describe 'File blame', :js, feature_category: :projects do within '[data-testid="blob-content-holder"]' do expect(page).to have_css('.blame-commit') expect(page).not_to have_css('.gl-pagination') - expect(page).not_to have_link _('View entire blame') + expect(page).not_to have_link _('Show full blame') end end end diff --git a/spec/features/projects/blobs/blob_show_spec.rb b/spec/features/projects/blobs/blob_show_spec.rb index 7faf0e1a6b1..f9e3ff1670c 100644 --- a/spec/features/projects/blobs/blob_show_spec.rb +++ b/spec/features/projects/blobs/blob_show_spec.rb @@ -137,11 +137,13 @@ RSpec.describe 'File blob', :js, feature_category: :projects do context 'when ref switch' do def switch_ref_to(ref_name) - first('[data-testid="branches-select"]').click + find('.ref-selector').click + wait_for_requests - page.within '.project-refs-form' do - click_link ref_name + page.within('.ref-selector') do + fill_in 'Search by Git revision', with: ref_name wait_for_requests + find('li', text: ref_name, match: :prefer_exact).click end end diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index fc7833809b3..e1f1a63565c 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -201,6 +201,12 @@ RSpec.describe 'Branches', feature_category: :projects do end end + describe 'Link to branch rules' do + it 'does not have possibility to navigate to branch rules', :js do + expect(page).not_to have_content(s_("Branches|View branch rules")) + end + end + context 'on project with 0 branch' do let(:project) { create(:project, :public, :empty_repo) } let(:repository) { project.repository } @@ -239,6 +245,17 @@ RSpec.describe 'Branches', feature_category: :projects do expect(page).not_to have_content 'Merge request' end end + + describe 'Navigate to branch rules from branches page' do + it 'shows repository settings page with Branch rules section expanded' do + visit project_branches_path(project) + + view_branch_rules + + expect(page).to have_content( + _('Define rules for who can push, merge, and the required approvals for each branch.')) + end + end end end @@ -353,4 +370,11 @@ RSpec.describe 'Branches', feature_category: :projects do click_button 'Yes, delete branch' end end + + def view_branch_rules + page.within('.nav-controls') do + click_link s_("Branches|View branch rules") + end + wait_for_requests + end end diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index 536152626af..ed03491d69a 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Pipeline Editor', :js, feature_category: :pipeline_authoring do +RSpec.describe 'Pipeline Editor', :js, feature_category: :pipeline_composition do include Spec::Support::Helpers::Features::SourceEditorSpecHelpers let(:project) { create(:project_empty_repo, :public) } diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb index 4fea07b18bc..aa9556761c6 100644 --- a/spec/features/projects/ci/lint_spec.rb +++ b/spec/features/projects/ci/lint_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'CI Lint', :js, feature_category: :pipeline_authoring do +RSpec.describe 'CI Lint', :js, feature_category: :pipeline_composition do include Spec::Support::Helpers::Features::SourceEditorSpecHelpers let_it_be(:project) { create(:project, :repository) } diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb index 93ce851521f..b608fc953f3 100644 --- a/spec/features/projects/commit/cherry_pick_spec.rb +++ b/spec/features/projects/commit/cherry_pick_spec.rb @@ -56,7 +56,7 @@ RSpec.describe 'Cherry-pick Commits', :js, feature_category: :source_code_manage cherry_pick_commit - expect(page).to have_content('Sorry, we cannot cherry-pick this commit automatically.') + expect(page).to have_content('Commit cherry-pick failed:') end end diff --git a/spec/features/projects/commit/user_reverts_commit_spec.rb b/spec/features/projects/commit/user_reverts_commit_spec.rb index 8c7b8e6ba32..4d2abf55675 100644 --- a/spec/features/projects/commit/user_reverts_commit_spec.rb +++ b/spec/features/projects/commit/user_reverts_commit_spec.rb @@ -47,7 +47,7 @@ RSpec.describe 'User reverts a commit', :js, feature_category: :source_code_mana revert_commit - expect(page).to have_content('Sorry, we cannot revert this commit automatically.') + expect(page).to have_content('Commit revert failed:') end end diff --git a/spec/features/projects/integrations/apple_app_store_spec.rb b/spec/features/projects/integrations/apple_app_store_spec.rb new file mode 100644 index 00000000000..b6dc6557e20 --- /dev/null +++ b/spec/features/projects/integrations/apple_app_store_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Upload Dropzone Field', feature_category: :integrations do + include_context 'project integration activation' + + it 'uploads the file data to the correct form fields and updates the messaging correctly', :js, :aggregate_failures do + visit_project_integration('Apple App Store Connect') + + expect(page).to have_content('Drag your Private Key file here or click to upload.') + expect(page).not_to have_content('auth_key.p8') + + find("input[name='service[dropzone_file_name]']", + visible: false).set(Rails.root.join('spec/fixtures/auth_key.p8')) + + expect(find("input[name='service[app_store_private_key]']", + visible: false).value).to eq(File.read(Rails.root.join('spec/fixtures/auth_key.p8'))) + expect(find("input[name='service[app_store_private_key_file_name]']", visible: false).value).to eq('auth_key.p8') + + expect(page).not_to have_content('Drag your Private Key file here or click to upload.') + expect(page).to have_content('auth_key.p8') + end +end diff --git a/spec/features/projects/integrations/google_play_spec.rb b/spec/features/projects/integrations/google_play_spec.rb new file mode 100644 index 00000000000..5db4bc8809f --- /dev/null +++ b/spec/features/projects/integrations/google_play_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Upload Dropzone Field', feature_category: :integrations do + include_context 'project integration activation' + + it 'uploads the file data to the correct form fields and updates the messaging correctly', :js, :aggregate_failures do + visit_project_integration('Google Play') + + expect(page).to have_content('Drag your key file here or click to upload.') + expect(page).not_to have_content('service_account.json') + + find("input[name='service[dropzone_file_name]']", + visible: false).set(Rails.root.join('spec/fixtures/service_account.json')) + + expect(find("input[name='service[service_account_key]']", + visible: false).value).to eq(File.read(Rails.root.join('spec/fixtures/service_account.json'))) + expect(find("input[name='service[service_account_key_file_name]']", + visible: false).value).to eq('service_account.json') + + expect(page).not_to have_content('Drag your key file here or click to upload.') + expect(page).to have_content('service_account.json') + end +end diff --git a/spec/features/projects/integrations/user_activates_mattermost_slash_command_spec.rb b/spec/features/projects/integrations/user_activates_mattermost_slash_command_spec.rb index 16c7a3ff226..07cb138c414 100644 --- a/spec/features/projects/integrations/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/projects/integrations/user_activates_mattermost_slash_command_spec.rb @@ -145,7 +145,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js, feature_category: :integ it 'shows a token placeholder' do token_placeholder = find_field('service_token')['placeholder'] - expect(token_placeholder).to eq('XXxxXXxxXXxxXXxxXXxxXXxx') + expect(token_placeholder).to eq('') end end end diff --git a/spec/features/projects/integrations/user_activates_slack_notifications_spec.rb b/spec/features/projects/integrations/user_activates_slack_notifications_spec.rb index ec00dcaf046..01c202baf70 100644 --- a/spec/features/projects/integrations/user_activates_slack_notifications_spec.rb +++ b/spec/features/projects/integrations/user_activates_slack_notifications_spec.rb @@ -7,7 +7,6 @@ RSpec.describe 'User activates Slack notifications', :js, feature_category: :int context 'when integration is not configured yet' do before do - stub_feature_flags(integration_slack_app_notifications: false) visit_project_integration('Slack notifications') end diff --git a/spec/features/projects/integrations/user_activates_slack_slash_command_spec.rb b/spec/features/projects/integrations/user_activates_slack_slash_command_spec.rb index 0f6d721565e..38491501c65 100644 --- a/spec/features/projects/integrations/user_activates_slack_slash_command_spec.rb +++ b/spec/features/projects/integrations/user_activates_slack_slash_command_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Slack slash commands', :js, feature_category: :integrations do it 'shows a token placeholder' do token_placeholder = find_field('Token')['placeholder'] - expect(token_placeholder).to eq('XXxxXXxxXXxxXXxxXXxxXXxx') + expect(token_placeholder).to eq('') end it 'shows a help message' do diff --git a/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb index a9e0fce1a1c..e4394010e8c 100644 --- a/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb +++ b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'User triggers manual job with variables', :js, feature_category: find("[data-testid='ci-variable-value']").set('key_value') end - find("[data-testid='trigger-manual-job-btn']").click + find("[data-testid='run-manual-job-btn']").click wait_for_requests diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 67389fdda8a..07b8f8339eb 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -1065,16 +1065,19 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state, feature_category: :proj end context "Build from other project" do + let(:other_job_download_path) { download_project_job_artifacts_path(project, job2) } + before do create(:ci_job_artifact, :archive, file: artifacts_file, job: job2) end - it do - requests = inspect_requests do - visit download_project_job_artifacts_path(project, job2) - end + it 'receive 404 from download request', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/391632' do + requests = inspect_requests { visit other_job_download_path } + + request = requests.find { |request| request.url == other_job_download_path } - expect(requests.first.status_code).to eq(404) + expect(request).to be_present + expect(request.status_code).to eq(404) end end end diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index 6df1e974f42..78fad9b0b55 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -148,7 +148,7 @@ RSpec.describe 'Projects > Members > Sorting', :js, feature_category: :subgroups def expect_sort_by(text, sort_direction) within('[data-testid="members-sort-dropdown"]') do - expect(page).to have_css('button[aria-haspopup="true"]', text: text) + expect(page).to have_css('button[aria-haspopup="menu"]', text: text) expect(page).to have_button("Sorting Direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}") end end diff --git a/spec/features/projects/navbar_spec.rb b/spec/features/projects/navbar_spec.rb index 6090d132e3a..03ad5f9a292 100644 --- a/spec/features/projects/navbar_spec.rb +++ b/spec/features/projects/navbar_spec.rb @@ -22,6 +22,7 @@ RSpec.describe 'Project navbar', :with_license, feature_category: :projects do insert_package_nav(_('Deployments')) insert_infrastructure_registry_nav insert_infrastructure_google_cloud_nav + insert_infrastructure_aws_nav end it_behaves_like 'verified navigation bar' do diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index c6a6ee68185..439ae4275ae 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -578,4 +578,53 @@ RSpec.describe 'New project', :js, feature_category: :projects do it_behaves_like 'has instructions to enable OAuth' end end + + describe 'sidebar' do + let_it_be(:user) { create(:user) } + let_it_be(:parent_group) { create(:group) } + + before do + parent_group.add_owner(user) + sign_in(user) + end + + context 'in the current navigation' do + before do + user.update!(use_new_navigation: false) + end + + context 'for a new top-level project' do + it_behaves_like 'a dashboard page with sidebar', :new_project_path, :projects + end + + context 'for a new group project' do + it 'shows the group sidebar of the parent group' do + visit new_project_path(namespace_id: parent_group.id) + expect(page).to have_selector(".nav-sidebar[aria-label=\"Group navigation\"] .context-header[title=\"#{parent_group.name}\"]") + end + end + end + + context 'in the new navigation' do + before do + parent_group.add_owner(user) + user.update!(use_new_navigation: true) + sign_in(user) + end + + context 'for a new top-level project' do + it 'shows the "Your work" navigation' do + visit new_project_path + expect(page).to have_selector(".super-sidebar .context-switcher-toggle", text: "Your work") + end + end + + context 'for a new group project' do + it 'shows the group sidebar of the parent group' do + visit new_project_path(namespace_id: parent_group.id) + expect(page).to have_selector(".super-sidebar .context-switcher-toggle", text: parent_group.name) + end + end + end + end end diff --git a/spec/features/projects/pages/user_edits_lets_encrypt_settings_spec.rb b/spec/features/projects/pages/user_edits_lets_encrypt_settings_spec.rb index a7da59200e9..16e64ade665 100644 --- a/spec/features/projects/pages/user_edits_lets_encrypt_settings_spec.rb +++ b/spec/features/projects/pages/user_edits_lets_encrypt_settings_spec.rb @@ -48,13 +48,13 @@ RSpec.describe "Pages with Let's Encrypt", :https_pages_enabled, feature_categor expect(domain.auto_ssl_enabled).to eq false expect(find("#pages_domain_auto_ssl_enabled", visible: false).value).to eq 'false' - expect(page).to have_selector '.card-header', text: 'Certificate' + expect(page).to have_selector '.gl-card-header', text: 'Certificate' expect(page).to have_text domain.subject find('.js-auto-ssl-toggle-container .js-project-feature-toggle button').click expect(find("#pages_domain_auto_ssl_enabled", visible: false).value).to eq 'true' - expect(page).not_to have_selector '.card-header', text: 'Certificate' + expect(page).not_to have_selector '.gl-card-header', text: 'Certificate' expect(page).not_to have_text domain.subject click_on 'Save Changes' @@ -108,7 +108,7 @@ RSpec.describe "Pages with Let's Encrypt", :https_pages_enabled, feature_categor it 'user do not see private key' do visit project_pages_domain_path(project, domain) - expect(page).not_to have_selector '.card-header', text: 'Certificate' + expect(page).not_to have_selector '.gl-card-header', text: 'Certificate' expect(page).not_to have_text domain.subject end end @@ -131,16 +131,16 @@ RSpec.describe "Pages with Let's Encrypt", :https_pages_enabled, feature_categor it 'user sees certificate subject' do visit project_pages_domain_path(project, domain) - expect(page).to have_selector '.card-header', text: 'Certificate' + expect(page).to have_selector '.gl-card-header', text: 'Certificate' expect(page).to have_text domain.subject end it 'user can delete the certificate', :js do visit project_pages_domain_path(project, domain) - expect(page).to have_selector '.card-header', text: 'Certificate' + expect(page).to have_selector '.gl-card-header', text: 'Certificate' expect(page).to have_text domain.subject - within('.card') { click_on 'Remove' } + within('.gl-card') { click_on 'Remove' } accept_gl_confirm(button_text: 'Remove certificate') expect(page).to have_field 'Certificate (PEM)', with: '' expect(page).to have_field 'Key (PEM)', with: '' diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index 3ede76d3360..acb2af07e50 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -193,7 +193,7 @@ RSpec.describe 'Pipeline Schedules', :js, feature_category: :projects do save_pipeline_schedule end - it 'user sees the new variable in edit window' do + it 'user sees the new variable in edit window', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/397040' do find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click page.within('.ci-variable-list') do expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-key").value).to eq('AAA') diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 343c7f53022..098d1201939 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -113,6 +113,50 @@ RSpec.describe 'Pipeline', :js, feature_category: :projects do end end + describe 'pipeline stats text' do + let(:finished_pipeline) do + create(:ci_pipeline, :success, project: project, + ref: 'master', sha: project.commit.id, user: user) + end + + before do + finished_pipeline.update!(started_at: "2023-01-01 01:01:05", created_at: "2023-01-01 01:01:01", + finished_at: "2023-01-01 01:01:10", duration: 9) + end + + context 'pipeline has finished' do + it 'shows pipeline stats with flag on' do + visit project_pipeline_path(project, finished_pipeline) + + within '.pipeline-info' do + expect(page).to have_content("in #{finished_pipeline.duration} seconds") + expect(page).to have_content("and was queued for #{finished_pipeline.queued_duration} seconds") + end + end + + it 'shows pipeline stats with flag off' do + stub_feature_flags(refactor_ci_minutes_consumption: false) + + visit project_pipeline_path(project, finished_pipeline) + + within '.pipeline-info' do + expect(page).to have_content("in #{finished_pipeline.duration} seconds " \ + "and was queued for #{finished_pipeline.queued_duration} seconds") + end + end + end + + context 'pipeline has not finished' do + it 'does not show pipeline stats' do + visit_pipeline + + within '.pipeline-info' do + expect(page).not_to have_selector('[data-testid="pipeline-stats-text"]') + end + 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 diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index b5f640f1cca..c46605fa9a8 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -278,6 +278,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do end before do + stub_feature_flags(lazy_load_pipeline_dropdown_actions: false) visit_project_pipelines end @@ -312,6 +313,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do end before do + stub_feature_flags(lazy_load_pipeline_dropdown_actions: false) visit_project_pipelines end @@ -695,7 +697,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects 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') @@ -721,7 +723,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects 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 diff --git a/spec/features/projects/settings/access_tokens_spec.rb b/spec/features/projects/settings/access_tokens_spec.rb index 12e14f5193f..a38c10c6bab 100644 --- a/spec/features/projects/settings/access_tokens_spec.rb +++ b/spec/features/projects/settings/access_tokens_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Project > Settings > Access Tokens', :js, feature_category: :credential_management do +RSpec.describe 'Project > Settings > Access Tokens', :js, feature_category: :user_management do include Spec::Support::Helpers::ModalHelpers let_it_be(:user) { create(:user) } diff --git a/spec/features/projects/settings/monitor_settings_spec.rb b/spec/features/projects/settings/monitor_settings_spec.rb index 4b553b57331..900f18bf49e 100644 --- a/spec/features/projects/settings/monitor_settings_spec.rb +++ b/spec/features/projects/settings/monitor_settings_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Projects > Settings > For a forked project', :js, feature_category: :projects do + include ListboxHelpers + let_it_be(:project) { create(:project, :repository, create_templates: :issue) } let(:user) { project.first_owner } @@ -47,7 +49,7 @@ RSpec.describe 'Projects > Settings > For a forked project', :js, feature_catego check(create_issue) uncheck(send_email) click_on('No template selected') - click_on('bug') + select_listbox_item('bug') save_form click_settings_tab diff --git a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb index d4c1fe4d43e..57aa3a56c6d 100644 --- a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb +++ b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb @@ -38,6 +38,15 @@ feature_category: :projects do expect(section).to have_text 'Clean up image tags' end + it 'passes axe automated accessibility testing' do + subject + + wait_for_requests + + expect(page).to be_axe_clean.within('[data-testid="container-expiration-policy-project-settings"]') + .skipping :'link-in-text-block' + end + it 'saves cleanup policy submit the form' do subject diff --git a/spec/features/projects/settings/registry_settings_spec.rb b/spec/features/projects/settings/registry_settings_spec.rb index 072b5f7f3b0..628fa23afdc 100644 --- a/spec/features/projects/settings/registry_settings_spec.rb +++ b/spec/features/projects/settings/registry_settings_spec.rb @@ -21,6 +21,15 @@ feature_category: :projects do end context 'as owner', :js do + it 'passes axe automated accessibility testing' do + subject + + wait_for_requests + + expect(page).to be_axe_clean.within('[data-testid="packages-and-registries-project-settings"]') + .skipping :'link-in-text-block' + end + it 'shows active tab on sidebar' do subject diff --git a/spec/features/projects/user_changes_project_visibility_spec.rb b/spec/features/projects/user_changes_project_visibility_spec.rb index 5daa5b98b6e..64af25aea28 100644 --- a/spec/features/projects/user_changes_project_visibility_spec.rb +++ b/spec/features/projects/user_changes_project_visibility_spec.rb @@ -91,23 +91,4 @@ RSpec.describe 'User changes public project visibility', :js, feature_category: it_behaves_like 'does not require confirmation' end - - context 'with unlink_fork_network_upon_visibility_decrease = false' do - let(:project) { create(:project, :empty_repo, :public) } - - before do - stub_feature_flags(unlink_fork_network_upon_visibility_decrease: false) - - fork_project(project, project.first_owner) - - 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' - end end diff --git a/spec/features/projects/work_items/work_item_children_spec.rb b/spec/features/projects/work_items/work_item_children_spec.rb new file mode 100644 index 00000000000..43a6b2771f6 --- /dev/null +++ b/spec/features/projects/work_items/work_item_children_spec.rb @@ -0,0 +1,179 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Work item children', :js, feature_category: :team_planning do + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, :public, namespace: group) } + let_it_be(:user) { create(:user) } + let_it_be(:issue) { create(:issue, project: project) } + + context 'for signed in user' do + before do + project.add_developer(user) + + sign_in(user) + + stub_feature_flags(work_items: true) + + visit project_issue_path(project, issue) + + wait_for_requests + end + + it 'are not displayed when issue does not have work item children', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + expect(find('[data-testid="links-empty"]')).to have_content(_('No tasks are currently assigned.')) + expect(page).not_to have_selector('[data-testid="add-links-form"]') + expect(page).not_to have_selector('[data-testid="links-child"]') + end + end + + it 'toggles widget body', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + expect(page).to have_selector('[data-testid="widget-body"]') + + click_button 'Collapse' + + expect(page).not_to have_selector('[data-testid="widget-body"]') + + click_button 'Expand' + + expect(page).to have_selector('[data-testid="widget-body"]') + end + end + + it 'toggles form', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + expect(page).not_to have_selector('[data-testid="add-links-form"]') + + click_button 'Add' + click_button 'New task' + + expect(page).to have_selector('[data-testid="add-links-form"]') + + click_button 'Cancel' + + expect(page).not_to have_selector('[data-testid="add-links-form"]') + end + end + + it 'adds a new child task', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + click_button 'Add' + click_button 'New task' + + expect(page).to have_button('Create task', disabled: true) + fill_in 'Add a title', with: 'Task 1' + + expect(page).to have_button('Create task', disabled: false) + + click_button 'Create task' + + wait_for_all_requests + + expect(find('[data-testid="links-child"]')).to have_content('Task 1') + end + end + + it 'removes a child task and undoing', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + click_button 'Add' + click_button 'New task' + fill_in 'Add a title', with: 'Task 1' + click_button 'Create task' + wait_for_all_requests + + expect(find('[data-testid="links-child"]')).to have_content('Task 1') + expect(find('[data-testid="children-count"]')).to have_content('1') + + find('[data-testid="links-menu"]').click + click_button 'Remove' + + wait_for_all_requests + + expect(page).not_to have_content('Task 1') + expect(find('[data-testid="children-count"]')).to have_content('0') + end + + page.within('.gl-toast') do + expect(find('.toast-body')).to have_content(_('Child removed')) + find('.b-toaster a', text: 'Undo').click + end + + wait_for_all_requests + + page.within('[data-testid="work-item-links"]') do + expect(find('[data-testid="links-child"]')).to have_content('Task 1') + expect(find('[data-testid="children-count"]')).to have_content('1') + end + end + + context 'with existing task' do + let_it_be(:task) { create(:work_item, :task, project: project) } + + it 'adds an existing child task', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + click_button 'Add' + click_button 'Existing task' + + expect(page).to have_button('Add task', disabled: true) + find('[data-testid="work-item-token-select-input"]').set(task.title) + wait_for_all_requests + click_button task.title + + expect(page).to have_button('Add task', disabled: false) + + click_button 'Add task' + + wait_for_all_requests + + expect(find('[data-testid="links-child"]')).to have_content(task.title) + end + end + end + + context 'in work item metadata' do + let_it_be(:label) { create(:label, title: 'Label 1', project: project) } + let_it_be(:milestone) { create(:milestone, project: project, title: 'v1') } + let_it_be(:task) do + create( + :work_item, + :task, + project: project, + labels: [label], + assignees: [user], + milestone: milestone + ) + end + + before do + visit project_issue_path(project, issue) + + wait_for_requests + end + + it 'displays labels, milestone and assignee for work item children', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + click_button 'Add' + click_button 'Existing task' + + find('[data-testid="work-item-token-select-input"]').set(task.title) + wait_for_all_requests + click_button task.title + + click_button 'Add task' + + wait_for_all_requests + end + + page.within('[data-testid="links-child"]') do + expect(page).to have_content(task.title) + expect(page).to have_content(label.title) + expect(page).to have_link(user.name) + expect(page).to have_content(milestone.title) + end + end + end + end +end diff --git a/spec/features/projects/work_items/work_item_spec.rb b/spec/features/projects/work_items/work_item_spec.rb new file mode 100644 index 00000000000..d0d458350b5 --- /dev/null +++ b/spec/features/projects/work_items/work_item_spec.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Work item', :js, feature_category: :team_planning do + let_it_be(:project) { create(:project, :public) } + let_it_be(:user) { create(:user) } + let_it_be(:work_item) { create(:work_item, project: project) } + let_it_be(:milestone) { create(:milestone, project: project) } + let_it_be(:milestones) { create_list(:milestone, 25, project: project) } + + context 'for signed in user' do + before do + project.add_developer(user) + + sign_in(user) + end + + context 'with internal id' do + before do + visit project_work_items_path(project, work_items_path: work_item.iid, iid_path: true) + end + + it_behaves_like 'work items title' + it_behaves_like 'work items status' + it_behaves_like 'work items assignees' + it_behaves_like 'work items labels' + it_behaves_like 'work items comments' + it_behaves_like 'work items description' + it_behaves_like 'work items milestone' + end + + context 'with global id' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + visit project_work_items_path(project, work_items_path: work_item.id) + end + + it_behaves_like 'work items status' + it_behaves_like 'work items assignees' + it_behaves_like 'work items labels' + it_behaves_like 'work items comments' + it_behaves_like 'work items description' + end + end + + context 'for signed in owner' do + before do + project.add_owner(user) + + sign_in(user) + + visit project_work_items_path(project, work_items_path: work_item.id) + end + + it_behaves_like 'work items invite members' + end +end |