summaryrefslogtreecommitdiff
path: root/spec/features/projects/pipelines/pipeline_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/pipelines/pipeline_spec.rb')
-rw-r--r--spec/features/projects/pipelines/pipeline_spec.rb90
1 files changed, 64 insertions, 26 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