diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-13 21:11:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-13 21:11:14 +0300 |
commit | 4a064b8dc0bf350b1b3000698042b49113e758d1 (patch) | |
tree | c6db9e3d9fbe1c6368aa024ae0fea1fcebd10e8c /spec | |
parent | effc12bf9dac4bf1e48f1397c25e0381ac1bd76f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
5 files changed, 44 insertions, 24 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index 44486d0ed41..1fd223631cc 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -366,13 +366,21 @@ RSpec.describe Projects::CommitController, feature_category: :source_code_manage let(:target_project) { project } let(:create_merge_request) { nil } + let(:commit_id) do + forked_project.repository.commit_files( + user, + branch_name: 'feature', message: 'Commit to feature', + actions: [{ action: :create, file_path: 'encoding/CHANGELOG', content: 'New content' }] + ) + end + def send_request post :cherry_pick, params: { namespace_id: forked_project.namespace, project_id: forked_project, target_project_id: target_project.id, start_branch: 'feature', - id: forked_project.commit.id, + id: commit_id, create_merge_request: create_merge_request } end @@ -397,19 +405,19 @@ RSpec.describe Projects::CommitController, feature_category: :source_code_manage expect(response).to redirect_to project_commits_path(project, 'feature') expect(flash[:notice]).to eq('The commit has been successfully cherry-picked into feature.') - expect(project.commit('feature').message).to include(forked_project.commit.id) + expect(project.commit('feature').message).to include(commit_id) end context 'when the cherry pick is performed via merge request' do let(:create_merge_request) { true } it 'successfully cherry picks a commit from fork to a cherry pick branch' do - branch = forked_project.commit.cherry_pick_branch_name + branch = forked_project.commit(commit_id).cherry_pick_branch_name send_request expect(response).to redirect_to merge_request_url(project, branch) expect(flash[:notice]).to start_with("The commit has been successfully cherry-picked into #{branch}") - expect(project.commit(branch).message).to include(forked_project.commit.id) + expect(project.commit(branch).message).to include(commit_id) end end @@ -421,13 +429,13 @@ RSpec.describe Projects::CommitController, feature_category: :source_code_manage end it 'cherry picks a commit to the fork' do - branch = forked_project.commit.cherry_pick_branch_name + branch = forked_project.commit(commit_id).cherry_pick_branch_name send_request expect(response).to redirect_to merge_request_url(forked_project, branch) expect(flash[:notice]).to start_with("The commit has been successfully cherry-picked into #{branch}") - expect(project.commit('feature').message).not_to include(forked_project.commit.id) - expect(forked_project.commit(branch).message).to include(forked_project.commit.id) + expect(project.commit('feature').message).not_to include(commit_id) + expect(forked_project.commit(branch).message).to include(commit_id) end end diff --git a/spec/features/merge_request/user_sees_discussions_navigation_spec.rb b/spec/features/merge_request/user_sees_discussions_navigation_spec.rb index 7dfbeac07b4..338e4329190 100644 --- a/spec/features/merge_request/user_sees_discussions_navigation_spec.rb +++ b/spec/features/merge_request/user_sees_discussions_navigation_spec.rb @@ -132,24 +132,18 @@ RSpec.describe 'Merge request > User sees discussions navigation', :js, feature_ end describe 'Merge request discussions' do - shared_examples 'a page with no code discussions' do - let!(:first_discussion) do - create(:discussion_note_on_merge_request, - noteable: merge_request, - project: project - ).to_discussion - end + let_it_be(:first_discussion) do + create(:discussion_note_on_merge_request, noteable: merge_request, project: project).to_discussion + end - let!(:second_discussion) do - create(:discussion_note_on_merge_request, - noteable: merge_request, - project: project - ).to_discussion - end + let_it_be(:second_discussion) do + create(:discussion_note_on_merge_request, noteable: merge_request, project: project).to_discussion + end - let(:first_discussion_selector) { ".discussion[data-discussion-id='#{first_discussion.id}']" } - let(:second_discussion_selector) { ".discussion[data-discussion-id='#{second_discussion.id}']" } + let(:first_discussion_selector) { ".discussion[data-discussion-id='#{first_discussion.id}']" } + let(:second_discussion_selector) { ".discussion[data-discussion-id='#{second_discussion.id}']" } + shared_examples 'a page with no code discussions' do describe "Changes page discussions navigation" do it 'navigates to the first discussion on the Overview page' do goto_next_thread diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index 6ec57af2590..47139013b67 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -27,7 +27,7 @@ RSpec.describe 'Multi-file editor upload file', :js, feature_category: :web_ide set_cookie('new_repo', 'false') end - it 'uploads text file' do + it 'uploads text file', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/415220' do wait_for_all_requests # make the field visible so capybara can use it execute_script('document.querySelector("#file-upload").classList.remove("hidden")') diff --git a/spec/frontend/fixtures/pipeline_header.rb b/spec/frontend/fixtures/pipeline_header.rb index d25bf12623f..89f548caf72 100644 --- a/spec/frontend/fixtures/pipeline_header.rb +++ b/spec/frontend/fixtures/pipeline_header.rb @@ -23,6 +23,8 @@ RSpec.describe "GraphQL Pipeline Header", '(JavaScript fixtures)', type: :reques ref: 'master', user: user, status: :success, + duration: 7210, + created_at: 2.hours.ago, started_at: 1.hour.ago, finished_at: Time.current ) @@ -71,6 +73,7 @@ RSpec.describe "GraphQL Pipeline Header", '(JavaScript fixtures)', type: :reques ref: 'master', user: user, status: :failed, + duration: 7210, started_at: 1.hour.ago, finished_at: Time.current ) diff --git a/spec/frontend/pipelines/pipeline_details_header_spec.js b/spec/frontend/pipelines/pipeline_details_header_spec.js index 3b3f8ce5eb3..2fef4924cc7 100644 --- a/spec/frontend/pipelines/pipeline_details_header_spec.js +++ b/spec/frontend/pipelines/pipeline_details_header_spec.js @@ -71,6 +71,7 @@ describe('Pipeline details header', () => { const findDeleteButton = () => wrapper.findByTestId('delete-pipeline'); const findDeleteModal = () => wrapper.findComponent(GlModal); const findPipelineUserLink = () => wrapper.findByTestId('pipeline-user-link'); + const findPipelineDuration = () => wrapper.findByTestId('pipeline-duration-text'); const defaultHandlers = [[getPipelineDetailsQuery, successHandler]]; @@ -236,6 +237,16 @@ describe('Pipeline details header', () => { expect(findTimeAgo().exists()).toBe(true); }); + + it('displays pipeline duartion text', async () => { + createComponent(); + + await waitForPromises(); + + expect(findPipelineDuration().text()).toBe( + '120 minutes 10 seconds, queued for 3,600 seconds', + ); + }); }); describe('running pipeline', () => { @@ -253,8 +264,12 @@ describe('Pipeline details header', () => { expect(findTimeAgo().exists()).toBe(false); }); + it('does not display pipeline duration text', () => { + expect(findPipelineDuration().exists()).toBe(false); + }); + it('displays pipeline running text', () => { - expect(findPipelineRunningText()).toBe('In progress, queued for 3600 seconds'); + expect(findPipelineRunningText()).toBe('In progress, queued for 3,600 seconds'); }); }); |