diff options
Diffstat (limited to 'spec/features/projects')
36 files changed, 273 insertions, 94 deletions
diff --git a/spec/features/projects/branches/user_deletes_branch_spec.rb b/spec/features/projects/branches/user_deletes_branch_spec.rb index 3b8f49accc5..8fc5c3d2e1b 100644 --- a/spec/features/projects/branches/user_deletes_branch_spec.rb +++ b/spec/features/projects/branches/user_deletes_branch_spec.rb @@ -35,6 +35,7 @@ RSpec.describe "User deletes branch", :js do context 'when the feature flag :delete_branch_confirmation_modals is disabled' do before do + stub_feature_flags(bootstrap_confirmation_modals: false) stub_feature_flags(delete_branch_confirmation_modals: false) end diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 0a79719f14a..2725c6a91be 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -179,6 +179,7 @@ RSpec.describe 'Branches' do context 'when the delete_branch_confirmation_modals feature flag is disabled' do it 'removes branch after confirmation', :js do stub_feature_flags(delete_branch_confirmation_modals: false) + stub_feature_flags(bootstrap_confirmation_modals: false) visit project_branches_filtered_path(project, state: 'all') diff --git a/spec/features/projects/cluster_agents_spec.rb b/spec/features/projects/cluster_agents_spec.rb new file mode 100644 index 00000000000..3ef710169f0 --- /dev/null +++ b/spec/features/projects/cluster_agents_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'ClusterAgents', :js do + let_it_be(:token) { create(:cluster_agent_token, description: 'feature test token')} + + let(:agent) { token.agent } + let(:project) { agent.project } + let(:user) { project.creator } + + before do + gitlab_sign_in(user) + end + + context 'when user does not have any agents and visits the index page' do + let(:empty_project) { create(:project) } + + before do + empty_project.add_maintainer(user) + visit project_clusters_path(empty_project) + end + + it 'displays empty state', :aggregate_failures do + expect(page).to have_content('Install new Agent') + expect(page).to have_selector('.empty-state') + end + end + + context 'when user has an agent' do + context 'when visiting the index page' do + before do + visit project_clusters_path(project) + end + + it 'displays a table with agent', :aggregate_failures do + expect(page).to have_content(agent.name) + expect(page).to have_selector('[data-testid="cluster-agent-list-table"] tbody tr', count: 1) + end + end + + context 'when visiting the show page' do + before do + visit project_cluster_agent_path(project, agent.name) + end + + it 'displays agent and token information', :aggregate_failures do + expect(page).to have_content(agent.name) + expect(page).to have_content(token.description) + end + end + end +end diff --git a/spec/features/projects/clusters/eks_spec.rb b/spec/features/projects/clusters/eks_spec.rb index 9f3f331cfab..09c10c0b3a9 100644 --- a/spec/features/projects/clusters/eks_spec.rb +++ b/spec/features/projects/clusters/eks_spec.rb @@ -19,7 +19,8 @@ RSpec.describe 'AWS EKS Cluster', :js do before do visit project_clusters_path(project) - click_link 'Integrate with a cluster certificate' + click_link 'Certificate based' + click_link 'Connect with a certificate' end context 'when user creates a cluster on AWS EKS' do diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 21e587288f5..e1659cd2fbf 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -33,7 +33,8 @@ RSpec.describe 'Gcp Cluster', :js do before do visit project_clusters_path(project) - click_link 'Integrate with a cluster certificate' + click_link 'Certificate based' + click_link 'Connect with a certificate' click_link 'Create new cluster' click_link 'Google GKE' end @@ -143,8 +144,9 @@ RSpec.describe 'Gcp Cluster', :js do before do visit project_clusters_path(project) - click_link 'Connect cluster with certificate' - click_link 'Connect existing cluster' + click_link 'Certificate based' + click_button(class: 'dropdown-toggle-split') + click_link 'Connect with certificate' end it 'user sees the "Environment scope" field' do @@ -158,11 +160,12 @@ RSpec.describe 'Gcp Cluster', :js do click_button 'Remove integration and resources' fill_in 'confirm_cluster_name_input', with: cluster.name click_button 'Remove integration' + click_link 'Certificate based' end it 'user sees creation form with the successful message' do expect(page).to have_content('Kubernetes cluster integration was successfully removed.') - expect(page).to have_link('Integrate with a cluster certificate') + expect(page).to have_link('Connect with a certificate') end end end @@ -171,6 +174,7 @@ RSpec.describe 'Gcp Cluster', :js do context 'when user has not dismissed GCP signup offer' do before do visit project_clusters_path(project) + click_link 'Certificate based' end it 'user sees offer on cluster index page' do @@ -178,7 +182,7 @@ RSpec.describe 'Gcp Cluster', :js do end it 'user sees offer on cluster create page' do - click_link 'Integrate with a cluster certificate' + click_link 'Connect with a certificate' expect(page).to have_css('.gcp-signup-offer') end @@ -187,6 +191,7 @@ RSpec.describe 'Gcp Cluster', :js do context 'when user has dismissed GCP signup offer' do before do visit project_clusters_path(project) + click_link 'Certificate based' end it 'user does not see offer after dismissing' do @@ -195,19 +200,18 @@ RSpec.describe 'Gcp Cluster', :js do find('.gcp-signup-offer .js-close').click wait_for_requests - click_link 'Integrate with a cluster certificate' + click_link 'Connect with a certificate' expect(page).not_to have_css('.gcp-signup-offer') end end context 'when third party offers are disabled', :clean_gitlab_redis_shared_state do - let(:admin) { create(:admin) } + let(:user) { create(:admin) } before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - sign_in(admin) - gitlab_enable_admin_mode_sign_in(admin) + gitlab_enable_admin_mode_sign_in(user) visit general_admin_application_settings_path end diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb index 5b60edbcf87..d3f709bfb53 100644 --- a/spec/features/projects/clusters/user_spec.rb +++ b/spec/features/projects/clusters/user_spec.rb @@ -25,7 +25,8 @@ RSpec.describe 'User Cluster', :js do before do visit project_clusters_path(project) - click_link 'Integrate with a cluster certificate' + click_link 'Certificate based' + click_link 'Connect with a certificate' click_link 'Connect existing cluster' end @@ -112,11 +113,12 @@ RSpec.describe 'User Cluster', :js do click_button 'Remove integration and resources' fill_in 'confirm_cluster_name_input', with: cluster.name click_button 'Remove integration' + click_link 'Certificate based' end it 'user sees creation form with the successful message' do expect(page).to have_content('Kubernetes cluster integration was successfully removed.') - expect(page).to have_link('Integrate with a cluster certificate') + expect(page).to have_link('Connect with a certificate') end end end diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb index 6b03301aa74..a49fa4c9e31 100644 --- a/spec/features/projects/clusters_spec.rb +++ b/spec/features/projects/clusters_spec.rb @@ -16,10 +16,11 @@ RSpec.describe 'Clusters', :js do context 'when user does not have a cluster and visits cluster index page' do before do visit project_clusters_path(project) + click_link 'Certificate based' end it 'sees empty state' do - expect(page).to have_link('Integrate with a cluster certificate') + expect(page).to have_link('Connect with a certificate') expect(page).to have_selector('.empty-state') end end @@ -33,16 +34,17 @@ RSpec.describe 'Clusters', :js do before do create(:cluster, :provided_by_user, name: 'default-cluster', environment_scope: '*', projects: [project]) visit project_clusters_path(project) + click_link 'Certificate based' + click_button(class: 'dropdown-toggle-split') end it 'user sees an add cluster button' do - expect(page).to have_selector('.js-add-cluster:not(.readonly)') + expect(page).to have_content('Connect with certificate') end context 'when user filled form with environment scope' do before do - click_link 'Connect cluster with certificate' - click_link 'Connect existing cluster' + click_link 'Connect with certificate' fill_in 'cluster_name', with: 'staging-cluster' fill_in 'cluster_environment_scope', with: 'staging/*' click_button 'Add Kubernetes cluster' @@ -70,8 +72,7 @@ RSpec.describe 'Clusters', :js do context 'when user updates duplicated environment scope' do before do - click_link 'Connect cluster with certificate' - click_link 'Connect existing cluster' + click_link 'Connect with certificate' fill_in 'cluster_name', with: 'staging-cluster' fill_in 'cluster_environment_scope', with: '*' fill_in 'cluster_platform_kubernetes_attributes_api_url', with: 'https://0.0.0.0' @@ -108,15 +109,12 @@ RSpec.describe 'Clusters', :js do create(:cluster, :provided_by_gcp, name: 'default-cluster', environment_scope: '*', projects: [project]) visit project_clusters_path(project) - end - - it 'user sees a add cluster button' do - expect(page).to have_selector('.js-add-cluster:not(.readonly)') + click_link 'Certificate based' end context 'when user filled form with environment scope' do before do - click_link 'Connect cluster with certificate' + click_button(class: 'dropdown-toggle-split') click_link 'Create new cluster' click_link 'Google GKE' @@ -161,7 +159,7 @@ RSpec.describe 'Clusters', :js do context 'when user updates duplicated environment scope' do before do - click_link 'Connect cluster with certificate' + click_button(class: 'dropdown-toggle-split') click_link 'Create new cluster' click_link 'Google GKE' @@ -192,6 +190,7 @@ RSpec.describe 'Clusters', :js do before do visit project_clusters_path(project) + click_link 'Certificate based' end it 'user sees a table with one cluster' do @@ -214,7 +213,8 @@ RSpec.describe 'Clusters', :js do before do visit project_clusters_path(project) - click_link 'Integrate with a cluster certificate' + click_link 'Certificate based' + click_link 'Connect with a certificate' click_link 'Create new cluster' end diff --git a/spec/features/projects/commit/comments/user_deletes_comments_spec.rb b/spec/features/projects/commit/comments/user_deletes_comments_spec.rb index 431cbb4ffbb..67d3276fc14 100644 --- a/spec/features/projects/commit/comments/user_deletes_comments_spec.rb +++ b/spec/features/projects/commit/comments/user_deletes_comments_spec.rb @@ -11,6 +11,7 @@ RSpec.describe "User deletes comments on a commit", :js do let(:user) { create(:user) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) project.add_developer(user) diff --git a/spec/features/projects/commit/user_comments_on_commit_spec.rb b/spec/features/projects/commit/user_comments_on_commit_spec.rb index 6997c2d8338..b0be6edb245 100644 --- a/spec/features/projects/commit/user_comments_on_commit_spec.rb +++ b/spec/features/projects/commit/user_comments_on_commit_spec.rb @@ -93,6 +93,8 @@ RSpec.describe "User comments on commit", :js do context "when deleting comment" do before do + stub_feature_flags(bootstrap_confirmation_modals: false) + visit(project_commit_path(project, sample_commit.id)) add_note(comment_text) diff --git a/spec/features/projects/confluence/user_views_confluence_page_spec.rb b/spec/features/projects/confluence/user_views_confluence_page_spec.rb index ece2f82f5c6..49e7839f16c 100644 --- a/spec/features/projects/confluence/user_views_confluence_page_spec.rb +++ b/spec/features/projects/confluence/user_views_confluence_page_spec.rb @@ -16,9 +16,12 @@ RSpec.describe 'User views the Confluence page' do visit project_wikis_confluence_path(project) + expect(page).to have_css('.nav-sidebar li.active', text: 'Confluence', match: :first) + element = page.find('.row.empty-state') expect(element).to have_link('Go to Confluence', href: service.confluence_url) + expect(element).to have_link('Confluence epic', href: 'https://gitlab.com/groups/gitlab-org/-/epics/3629') end it 'does not show the page when the Confluence integration disabled' do diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 5320f68b525..bcbf2f46f79 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -23,10 +23,6 @@ RSpec.describe 'Environment' do let!(:action) { } let!(:cluster) { } - before do - visit_environment(environment) - end - context 'with auto-stop' do let!(:environment) { create(:environment, :will_auto_stop, name: 'staging', project: project) } @@ -52,12 +48,20 @@ RSpec.describe 'Environment' do end context 'without deployments' do + before do + visit_environment(environment) + end + it 'does not show deployments' do expect(page).to have_content('You don\'t have any deployments right now.') end end context 'with deployments' do + before do + visit_environment(environment) + end + context 'when there is no related deployable' do let(:deployment) do create(:deployment, :success, environment: environment, deployable: nil) @@ -108,6 +112,26 @@ RSpec.describe 'Environment' do end end + context 'with many deployments' do + let(:pipeline) { create(:ci_pipeline, project: project) } + let(:build) { create(:ci_build, pipeline: pipeline) } + + let!(:second) { create(:deployment, environment: environment, deployable: build, status: :success, finished_at: Time.current) } + let!(:first) { create(:deployment, environment: environment, deployable: build, status: :running) } + let!(:last) { create(:deployment, environment: environment, deployable: build, status: :success, finished_at: 2.days.ago) } + let!(:third) { create(:deployment, environment: environment, deployable: build, status: :canceled, finished_at: 1.day.ago) } + + before do + visit_environment(environment) + end + + it 'shows all of them in ordered way' do + ids = find_all('[data-testid="deployment-id"]').map { |e| e.text } + expected_ordered_ids = [first, second, third, last].map { |d| "##{d.iid}" } + expect(ids).to eq(expected_ordered_ids) + end + end + context 'with related deployable present' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } @@ -116,6 +140,10 @@ RSpec.describe 'Environment' do create(:deployment, :success, environment: environment, deployable: build) end + before do + visit_environment(environment) + end + it 'does show build name' do expect(page).to have_link("#{build.name} (##{build.id})") end diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 34e2ca7c8a7..3b83c25b629 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -8,6 +8,7 @@ RSpec.describe 'Environments page', :js do let(:role) { :developer } before do + stub_feature_flags(new_environments_table: false) project.add_role(user, role) sign_in(user) end @@ -142,6 +143,8 @@ RSpec.describe 'Environments page', :js do create(:environment, project: project, state: :available) end + stub_feature_flags(bootstrap_confirmation_modals: false) + context 'when there are no deployments' do before do visit_environments(project) diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 00e85a215b8..3afd1937652 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -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 diff --git a/spec/features/projects/infrastructure_registry_spec.rb b/spec/features/projects/infrastructure_registry_spec.rb index ee35e02b5e8..27d0866bc69 100644 --- a/spec/features/projects/infrastructure_registry_spec.rb +++ b/spec/features/projects/infrastructure_registry_spec.rb @@ -43,7 +43,7 @@ RSpec.describe 'Infrastructure Registry' do expect(page).to have_current_path(project_infrastructure_registry_path(terraform_module.project, terraform_module)) - expect(page).to have_css('.packages-app h1[data-testid="title"]', text: terraform_module.name) + expect(page).to have_css('.packages-app h2[data-testid="title"]', text: terraform_module.name) expect(page).to have_content('Provision instructions') expect(page).to have_content('Registry setup') diff --git a/spec/features/projects/integrations/user_uses_inherited_settings_spec.rb b/spec/features/projects/integrations/user_uses_inherited_settings_spec.rb index f46cade9d5f..d2c4418f0d6 100644 --- a/spec/features/projects/integrations/user_uses_inherited_settings_spec.rb +++ b/spec/features/projects/integrations/user_uses_inherited_settings_spec.rb @@ -84,7 +84,7 @@ RSpec.describe 'User uses inherited settings', :js do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } let_it_be(:parent_settings) { { url: 'http://group.com', password: 'group' } } - let_it_be(:parent_integration) { create(:jira_integration, group: group, project: nil, **parent_settings) } + let_it_be(:parent_integration) { create(:jira_integration, :group, group: group, **parent_settings) } it_behaves_like 'inherited settings' end diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index 060b7ffbfc9..12e88bbf6a5 100644 --- a/spec/features/projects/jobs/user_browses_job_spec.rb +++ b/spec/features/projects/jobs/user_browses_job_spec.rb @@ -12,6 +12,7 @@ RSpec.describe 'User browses a job', :js do before do project.add_maintainer(user) project.enable_ci + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) @@ -36,8 +37,18 @@ RSpec.describe 'User browses a job', :js do expect(page).to have_content('Job has been erased') end - context 'with a failed job' do - let!(:build) { create(:ci_build, :failed, :trace_artifact, pipeline: pipeline) } + context 'with unarchived trace artifact' do + let!(:build) { create(:ci_build, :success, :unarchived_trace_artifact, :coverage, pipeline: pipeline) } + + it 'shows no trace message', :js do + wait_for_requests + + expect(page).to have_content('This job does not have a trace.') + end + end + + context 'with a failed job and live trace' do + let!(:build) { create(:ci_build, :failed, :trace_live, pipeline: pipeline) } it 'displays the failure reason' do wait_for_all_requests @@ -46,6 +57,18 @@ RSpec.describe 'User browses a job', :js do ".build-job > a[title='test - failed - (unknown failure)']") end end + + context 'with unarchived trace artifact' do + let!(:artifact) { create(:ci_job_artifact, :unarchived_trace_artifact, job: build) } + + it 'displays the failure reason from the live trace' do + wait_for_all_requests + within('.builds-container') do + expect(page).to have_selector( + ".build-job > a[title='test - failed - (unknown failure)']") + end + end + end end context 'when a failed job has been retried' 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 new file mode 100644 index 00000000000..e8a14694d88 --- /dev/null +++ b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User triggers manual job with variables', :js do + let(:user) { create(:user) } + let(:user_access_level) { :developer } + let(:project) { create(:project, :repository, namespace: user.namespace) } + let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') } + let!(:build) { create(:ci_build, :manual, pipeline: pipeline) } + + before do + project.add_maintainer(user) + project.enable_ci + + sign_in(user) + + visit(project_job_path(project, build)) + end + + it 'passes values correctly' do + page.within(find("[data-testid='ci-variable-row']")) do + find("[data-testid='ci-variable-key']").set('key_name') + find("[data-testid='ci-variable-value']").set('key_value') + end + + find("[data-testid='trigger-manual-job-btn']").click + + wait_for_requests + + expect(build.job_variables.as_json).to contain_exactly( + hash_including('key' => 'key_name', 'value' => 'key_value')) + end +end diff --git a/spec/features/projects/members/member_leaves_project_spec.rb b/spec/features/projects/members/member_leaves_project_spec.rb index c4bd0b81dc0..4881a7bdf1a 100644 --- a/spec/features/projects/members/member_leaves_project_spec.rb +++ b/spec/features/projects/members/member_leaves_project_spec.rb @@ -9,6 +9,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do before do project.add_developer(user) sign_in(user) + stub_feature_flags(bootstrap_confirmation_modals: false) end it 'user leaves project' do diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 113ba692497..dcaef5f4ef0 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Projects > Members > User requests access', :js do before do sign_in(user) visit project_path(project) + stub_feature_flags(bootstrap_confirmation_modals: false) end it 'request access feature is disabled' do diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index dacbaa826a0..4dedd5689de 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -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 diff --git a/spec/features/projects/packages_spec.rb b/spec/features/projects/packages_spec.rb index 9b1e87192f5..7fcc8200b1c 100644 --- a/spec/features/projects/packages_spec.rb +++ b/spec/features/projects/packages_spec.rb @@ -27,10 +27,6 @@ RSpec.describe 'Packages' do context 'when feature is available', :js do before do - # we are simply setting the featrure flag to false because the new UI has nothing to test yet - # when the refactor is complete or almost complete we will turn on the feature tests - # see https://gitlab.com/gitlab-org/gitlab/-/issues/330846 for status of this work - stub_feature_flags(package_list_apollo: false) visit_project_packages end diff --git a/spec/features/projects/pages/user_adds_domain_spec.rb b/spec/features/projects/pages/user_adds_domain_spec.rb index de9effe3dc7..06f130ae69c 100644 --- a/spec/features/projects/pages/user_adds_domain_spec.rb +++ b/spec/features/projects/pages/user_adds_domain_spec.rb @@ -14,6 +14,8 @@ RSpec.describe 'User adds pages domain', :js do project.add_maintainer(user) sign_in(user) + + stub_feature_flags(bootstrap_confirmation_modals: false) end context 'when pages are exposed on external HTTP address', :http_pages_enabled do 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 cf8438d5e6f..a3fc5804e13 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 @@ -14,6 +14,7 @@ RSpec.describe "Pages with Let's Encrypt", :https_pages_enabled do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) stub_lets_encrypt_settings + stub_feature_flags(bootstrap_confirmation_modals: false) project.add_role(user, role) sign_in(user) diff --git a/spec/features/projects/pages/user_edits_settings_spec.rb b/spec/features/projects/pages/user_edits_settings_spec.rb index 71d4cce2784..1226e1dc2ed 100644 --- a/spec/features/projects/pages/user_edits_settings_spec.rb +++ b/spec/features/projects/pages/user_edits_settings_spec.rb @@ -176,6 +176,7 @@ RSpec.describe 'Pages edits pages settings', :js do describe 'Remove page' do context 'when pages are deployed' do before do + stub_feature_flags(bootstrap_confirmation_modals: false) project.mark_pages_as_deployed end diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index 94e3331b173..9df430c0f78 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Pipeline Schedules', :js do context 'logged in as maintainer' do before do + stub_feature_flags(bootstrap_confirmation_modals: false) project.add_maintainer(user) gitlab_sign_in(user) end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index bd22c8632e4..e38c4989f26 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -317,6 +317,7 @@ RSpec.describe 'Pipelines', :js do end before do + stub_feature_flags(bootstrap_confirmation_modals: false) visit_project_pipelines end @@ -635,7 +636,7 @@ RSpec.describe 'Pipelines', :js do # header expect(page).to have_text("##{pipeline.id}") - expect(page).to have_selector(%Q(img[alt$="#{pipeline.user.name}'s avatar"])) + expect(page).to have_selector(%Q(img[src="#{pipeline.user.avatar_url}"])) expect(page).to have_link(pipeline.user.name, href: user_path(pipeline.user)) # stages diff --git a/spec/features/projects/releases/user_views_releases_spec.rb b/spec/features/projects/releases/user_views_releases_spec.rb index 6bc4c66b8ca..98935fdf872 100644 --- a/spec/features/projects/releases/user_views_releases_spec.rb +++ b/spec/features/projects/releases/user_views_releases_spec.rb @@ -123,11 +123,11 @@ RSpec.describe 'User views releases', :js do within('.release-block', match: :first) do expect(page).to have_content(release_v3.description) + expect(page).to have_content(release_v3.tag) + expect(page).to have_content(release_v3.name) # The following properties (sometimes) include Git info, # so they are not rendered for Guest users - expect(page).not_to have_content(release_v3.name) - expect(page).not_to have_content(release_v3.tag) expect(page).not_to have_content(release_v3.commit.short_id) end end diff --git a/spec/features/projects/settings/access_tokens_spec.rb b/spec/features/projects/settings/access_tokens_spec.rb index 4941b936c0c..d8de9e0449e 100644 --- a/spec/features/projects/settings/access_tokens_spec.rb +++ b/spec/features/projects/settings/access_tokens_spec.rb @@ -13,6 +13,7 @@ RSpec.describe 'Project > Settings > Access Tokens', :js do end before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) end diff --git a/spec/features/projects/settings/packages_settings_spec.rb b/spec/features/projects/settings/packages_settings_spec.rb index 62f31fd027b..e70839e9720 100644 --- a/spec/features/projects/settings/packages_settings_spec.rb +++ b/spec/features/projects/settings/packages_settings_spec.rb @@ -19,7 +19,7 @@ RSpec.describe 'Projects > Settings > Packages', :js do let(:packages_enabled) { true } it 'displays the packages toggle button' do - expect(page).to have_button('Packages', class: 'gl-toggle') + expect(page).to have_selector('[data-testid="toggle-label"]', text: 'Packages') expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true) end end @@ -28,7 +28,7 @@ RSpec.describe 'Projects > Settings > Packages', :js do let(:packages_enabled) { false } it 'does not show up in UI' do - expect(page).not_to have_button('Packages', class: 'gl-toggle') + expect(page).not_to have_selector('[data-testid="toggle-label"]', text: 'Packages') end end end diff --git a/spec/features/projects/settings/service_desk_setting_spec.rb b/spec/features/projects/settings/service_desk_setting_spec.rb index 0924f8320e1..0df4bd3f0d9 100644 --- a/spec/features/projects/settings/service_desk_setting_spec.rb +++ b/spec/features/projects/settings/service_desk_setting_spec.rb @@ -54,7 +54,7 @@ RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache do wait_for_requests project.reload - expect(find('[data-testid="incoming-email"]').value).to eq(project.service_desk_incoming_address) + expect(find('[data-testid="incoming-email"]').value).to eq(project.service_desk_custom_address) page.within '#js-service-desk' do fill_in('service-desk-project-suffix', with: 'foo') diff --git a/spec/features/projects/settings/user_searches_in_settings_spec.rb b/spec/features/projects/settings/user_searches_in_settings_spec.rb index 7ed96d01189..44b5464a1b0 100644 --- a/spec/features/projects/settings/user_searches_in_settings_spec.rb +++ b/spec/features/projects/settings/user_searches_in_settings_spec.rb @@ -7,6 +7,7 @@ RSpec.describe 'User searches project settings', :js do let_it_be(:project) { create(:project, :repository, namespace: user.namespace, pages_https_only: false) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) end diff --git a/spec/features/projects/settings/user_tags_project_spec.rb b/spec/features/projects/settings/user_tags_project_spec.rb index ff19ed22744..e9a2aa29352 100644 --- a/spec/features/projects/settings/user_tags_project_spec.rb +++ b/spec/features/projects/settings/user_tags_project_spec.rb @@ -2,22 +2,40 @@ require 'spec_helper' -RSpec.describe 'Projects > Settings > User tags a project' do +RSpec.describe 'Projects > Settings > User tags a project', :js do let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } + let!(:topic) { create(:topic, name: 'topic1') } before do sign_in(user) visit edit_project_path(project) + wait_for_all_requests end - it 'sets project topics' do - fill_in 'Topics', with: 'topic1, topic2' + it 'select existing topic' do + fill_in class: 'gl-token-selector-input', with: 'topic1' + wait_for_all_requests + + find('.gl-avatar-labeled[entity-name="topic1"]').click + + page.within '.general-settings' do + click_button 'Save changes' + end + + expect(find('#project_topic_list_field', visible: :hidden).value).to eq 'topic1' + end + + it 'select new topic' do + fill_in class: 'gl-token-selector-input', with: 'topic2' + wait_for_all_requests + + click_button 'Add "topic2"' page.within '.general-settings' do click_button 'Save changes' end - expect(find_field('Topics').value).to eq 'topic1, topic2' + expect(find('#project_topic_list_field', visible: :hidden).value).to eq 'topic2' end end diff --git a/spec/features/projects/show/no_password_spec.rb b/spec/features/projects/show/no_password_spec.rb index d18ff75b324..ed06f4e14d3 100644 --- a/spec/features/projects/show/no_password_spec.rb +++ b/spec/features/projects/show/no_password_spec.rb @@ -3,6 +3,9 @@ require 'spec_helper' RSpec.describe 'No Password Alert' do + let_it_be(:message_password_auth_enabled) { 'Your account is authenticated with SSO or SAML. To push and pull over HTTP with Git using this account, you must set a password or set up a Personal Access Token to use instead of a password. For more information, see Clone with HTTPS.' } + let_it_be(:message_password_auth_disabled) { 'Your account is authenticated with SSO or SAML. To push and pull over HTTP with Git using this account, you must set up a Personal Access Token to use instead of a password. For more information, see Clone with HTTPS.' } + let(:project) { create(:project, :repository, namespace: user.namespace) } context 'with internal auth enabled' do @@ -15,7 +18,7 @@ RSpec.describe 'No Password Alert' do let(:user) { create(:user) } it 'shows no alert' do - expect(page).not_to have_content "You won't be able to pull or push repositories via HTTP until you set a password on your account" + expect(page).not_to have_content message_password_auth_enabled end end @@ -23,7 +26,7 @@ RSpec.describe 'No Password Alert' do let(:user) { create(:user, password_automatically_set: true) } it 'shows a password alert' do - expect(page).to have_content "You won't be able to pull or push repositories via HTTP until you set a password on your account" + expect(page).to have_content message_password_auth_enabled end end end @@ -41,7 +44,7 @@ RSpec.describe 'No Password Alert' do gitlab_sign_in_via('saml', user, 'my-uid') visit project_path(project) - expect(page).to have_content "You won't be able to pull or push repositories via HTTP until you create a personal access token on your account" + expect(page).to have_content message_password_auth_disabled end end @@ -51,7 +54,7 @@ RSpec.describe 'No Password Alert' do gitlab_sign_in_via('saml', user, 'my-uid') visit project_path(project) - expect(page).not_to have_content "You won't be able to pull or push repositories via HTTP until you create a personal access token on your account" + expect(page).not_to have_content message_password_auth_disabled end end end diff --git a/spec/features/projects/show/user_uploads_files_spec.rb b/spec/features/projects/show/user_uploads_files_spec.rb index 51e41397439..92b54d83ef3 100644 --- a/spec/features/projects/show/user_uploads_files_spec.rb +++ b/spec/features/projects/show/user_uploads_files_spec.rb @@ -44,27 +44,27 @@ RSpec.describe 'Projects > Show > User uploads files' do end end - context 'when in the empty_repo_upload experiment' do - before do - stub_experiments(empty_repo_upload: :candidate) + context 'with an empty repo' do + let(:project) { create(:project, :empty_repo, creator: user) } + before do visit(project_path(project)) end - context 'with an empty repo' do - let(:project) { create(:project, :empty_repo, creator: user) } - - [true, false].each do |value| - include_examples 'uploads and commits a new text file via "upload file" button', drop: value - end + [true, false].each do |value| + include_examples 'uploads and commits a new text file via "upload file" button', drop: value end + end - context 'with a nonempty repo' do - let(:project) { create(:project, :repository, creator: user) } + context 'with a nonempty repo' do + let(:project) { create(:project, :repository, creator: user) } - [true, false].each do |value| - include_examples 'uploads and commits a new text file via "upload file" button', drop: value - end + before do + visit(project_path(project)) + end + + [true, false].each do |value| + include_examples 'uploads and commits a new text file via "upload file" button', drop: value end end end diff --git a/spec/features/projects/user_changes_project_visibility_spec.rb b/spec/features/projects/user_changes_project_visibility_spec.rb index 39b8cddd005..345d16982fd 100644 --- a/spec/features/projects/user_changes_project_visibility_spec.rb +++ b/spec/features/projects/user_changes_project_visibility_spec.rb @@ -22,7 +22,7 @@ RSpec.describe 'User changes public project visibility', :js do click_button 'Save changes' end - find('.js-confirm-danger-input').send_keys(project.path_with_namespace) + find('.js-legacy-confirm-danger-input').send_keys(project.path_with_namespace) page.within '.modal' do click_button 'Reduce project visibility' diff --git a/spec/features/projects/user_creates_project_spec.rb b/spec/features/projects/user_creates_project_spec.rb index 5d482f9fbd0..f5e8a5e8fc1 100644 --- a/spec/features/projects/user_creates_project_spec.rb +++ b/spec/features/projects/user_creates_project_spec.rb @@ -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' |