diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/features/projects/pipelines | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/features/projects/pipelines')
-rw-r--r-- | spec/features/projects/pipelines/pipeline_spec.rb | 90 | ||||
-rw-r--r-- | spec/features/projects/pipelines/pipelines_spec.rb | 17 |
2 files changed, 67 insertions, 40 deletions
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index c6a002ad18b..2ca584ab8f6 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -111,7 +111,7 @@ RSpec.describe 'Pipeline', :js do end context 'when there is one related merge request' do - before do + let!(:merge_request) do create(:merge_request, source_project: project, source_branch: pipeline.ref) @@ -123,7 +123,7 @@ RSpec.describe 'Pipeline', :js do within '.related-merge-requests' do expect(page).to have_content('1 related merge request: ') expect(page).to have_selector('.js-truncated-mr-list') - expect(page).to have_link('!1 My title 1') + expect(page).to have_link("#{merge_request.to_reference} #{merge_request.title}") expect(page).not_to have_selector('.js-full-mr-list') expect(page).not_to have_selector('.text-expander') @@ -132,9 +132,16 @@ RSpec.describe 'Pipeline', :js do end context 'when there are two related merge requests' do - before do - create(:merge_request, source_project: project, source_branch: pipeline.ref) - create(:merge_request, source_project: project, source_branch: pipeline.ref, target_branch: 'fix') + let!(:merge_request1) do + create(:merge_request, + source_project: project, + source_branch: pipeline.ref) + end + let!(:merge_request2) do + create(:merge_request, + source_project: project, + source_branch: pipeline.ref, + target_branch: 'fix') end it 'links to the most recent related merge request' do @@ -142,7 +149,7 @@ RSpec.describe 'Pipeline', :js do within '.related-merge-requests' do expect(page).to have_content('2 related merge requests: ') - expect(page).to have_link('!2 My title 3') + expect(page).to have_link("#{merge_request2.to_reference} #{merge_request2.title}") expect(page).to have_selector('.text-expander') expect(page).to have_selector('.js-full-mr-list', visible: false) end @@ -354,37 +361,68 @@ RSpec.describe 'Pipeline', :js do end describe 'test tabs' do - let(:pipeline) { create(:ci_pipeline, :with_test_reports, project: project) } + let(:pipeline) { create(:ci_pipeline, :with_test_reports, :with_report_results, project: project) } - before do - visit_pipeline - wait_for_requests - end + context 'with build_report_summary feature flag disabled' do + before do + stub_feature_flags(build_report_summary: false) + visit_pipeline + wait_for_requests + end + + context 'with test reports' do + it 'shows badge counter in Tests tab' do + expect(pipeline.test_reports.total_count).to eq(4) + expect(page.find('.js-test-report-badge-counter').text).to eq(pipeline.test_reports.total_count.to_s) + end - context 'with test reports' do - it 'shows badge counter in Tests tab' do - expect(pipeline.test_reports.total_count).to eq(4) - expect(page.find('.js-test-report-badge-counter').text).to eq(pipeline.test_reports.total_count.to_s) + it 'does not call test_report.json endpoint by default', :js do + expect(page).to have_selector('.js-no-tests-to-show', visible: :all) + end + + it 'does call test_report.json endpoint when tab is selected', :js do + find('.js-tests-tab-link').click + wait_for_requests + + expect(page).to have_content('Jobs') + expect(page).to have_selector('.js-tests-detail', visible: :all) + end end - it 'does not call test_report.json endpoint by default', :js do - expect(page).to have_selector('.js-no-tests-to-show', visible: :all) + context 'without test reports' do + let(:pipeline) { create(:ci_pipeline, project: project) } + + it 'shows zero' do + expect(page.find('.js-test-report-badge-counter', visible: :all).text).to eq("0") + end end + end - it 'does call test_report.json endpoint when tab is selected', :js do - find('.js-tests-tab-link').click + context 'with build_report_summary feature flag enabled' do + before do + visit_pipeline wait_for_requests + end + + context 'with test reports' do + it 'shows badge counter in Tests tab' do + expect(page.find('.js-test-report-badge-counter').text).to eq(pipeline.test_report_summary.total_count.to_s) + end - expect(page).to have_content('Test suites') - expect(page).to have_selector('.js-tests-detail', visible: :all) + it 'calls summary.json endpoint', :js do + find('.js-tests-tab-link').click + + expect(page).to have_content('Jobs') + expect(page).to have_selector('.js-tests-detail', visible: :all) + end end - end - context 'without test reports' do - let(:pipeline) { create(:ci_pipeline, project: project) } + context 'without test reports' do + let(:pipeline) { create(:ci_pipeline, project: project) } - it 'shows nothing' do - expect(page.find('.js-test-report-badge-counter', visible: :all).text).to eq("") + it 'shows zero' do + expect(page.find('.js-test-report-badge-counter', visible: :all).text).to eq("0") + end end end end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 0e33204f851..0eb92f3e679 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -65,19 +65,8 @@ RSpec.describe 'Pipelines', :js do expect(page.find('.js-pipelines-tab-all .badge').text).to include('1') end - it 'shows a tab for Pending pipelines and count' do - expect(page.find('.js-pipelines-tab-pending').text).to include('Pending') - expect(page.find('.js-pipelines-tab-pending .badge').text).to include('0') - end - - it 'shows a tab for Running pipelines and count' do - expect(page.find('.js-pipelines-tab-running').text).to include('Running') - expect(page.find('.js-pipelines-tab-running .badge').text).to include('1') - end - it 'shows a tab for Finished pipelines and count' do expect(page.find('.js-pipelines-tab-finished').text).to include('Finished') - expect(page.find('.js-pipelines-tab-finished .badge').text).to include('0') end it 'shows a tab for Branches' do @@ -89,9 +78,9 @@ RSpec.describe 'Pipelines', :js do end it 'updates content when tab is clicked' do - page.find('.js-pipelines-tab-pending').click + page.find('.js-pipelines-tab-finished').click wait_for_requests - expect(page).to have_content('There are currently no pending pipelines.') + expect(page).to have_content('There are currently no finished pipelines.') end end @@ -539,7 +528,7 @@ RSpec.describe 'Pipelines', :js do end it 'renders a mini pipeline graph' do - expect(page).to have_selector('.js-mini-pipeline-graph') + expect(page).to have_selector('[data-testid="widget-mini-pipeline-graph"]') expect(page).to have_selector('.js-builds-dropdown-button') end |