Commit 15e74547 authored by Scott Hampton's avatar Scott Hampton

Update pipeline spec

Pipeline spec needs to stub the feature flag
for the build report sumary to be false so that
the existing tests will pass.

Also added a couple tests for when the feature
flag is enabled. Made sure the pipeline was
created with a build report included.
parent cfaf663b
...@@ -87,6 +87,6 @@ ...@@ -87,6 +87,6 @@
#js-tab-tests.tab-pane #js-tab-tests.tab-pane
#js-pipeline-tests-detail{ data: { full_report_endpoint: test_report_project_pipeline_path(@project, @pipeline, format: :json), #js-pipeline-tests-detail{ data: { full_report_endpoint: test_report_project_pipeline_path(@project, @pipeline, format: :json),
summary_endpoint: Feature.enabled?(:build_report_summary, @project) ? summary_project_tests_path(@project, @pipeline, format: :json) : '', summary_endpoint: Feature.enabled?(:build_report_summary, @project) ? summary_project_pipeline_tests_path(@project, @pipeline, format: :json) : '',
count_endpoint: test_reports_count_project_pipeline_path(@project, @pipeline, format: :json) } } count_endpoint: test_reports_count_project_pipeline_path(@project, @pipeline, format: :json) } }
= render_if_exists "projects/pipelines/tabs_content", pipeline: @pipeline, project: @project = render_if_exists "projects/pipelines/tabs_content", pipeline: @pipeline, project: @project
...@@ -361,37 +361,68 @@ RSpec.describe 'Pipeline', :js do ...@@ -361,37 +361,68 @@ RSpec.describe 'Pipeline', :js do
end end
describe 'test tabs' do 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 context 'with build_report_summary feature flag disabled' do
visit_pipeline before do
wait_for_requests stub_feature_flags(build_report_summary: false)
end visit_pipeline
wait_for_requests
end
context 'with test reports' do context 'with test reports' do
it 'shows badge counter in Tests tab' do it 'shows badge counter in Tests tab' do
expect(pipeline.test_reports.total_count).to eq(4) 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) expect(page.find('.js-test-report-badge-counter').text).to eq(pipeline.test_reports.total_count.to_s)
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)
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('Test suites')
expect(page).to have_selector('.js-tests-detail', visible: :all)
end
end end
it 'does not call test_report.json endpoint by default', :js do context 'without test reports' do
expect(page).to have_selector('.js-no-tests-to-show', visible: :all) 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
end
it 'does call test_report.json endpoint when tab is selected', :js do context 'with build_report_summary feature flag enabled' do
find('.js-tests-tab-link').click before do
visit_pipeline
wait_for_requests wait_for_requests
end
expect(page).to have_content('Test suites') context 'with test reports' do
expect(page).to have_selector('.js-tests-detail', visible: :all) 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
it 'calls summary.json endpoint', :js do
find('.js-tests-tab-link').click
expect(page).to have_content('Test suites')
expect(page).to have_selector('.js-tests-detail', visible: :all)
end
end end
end
context 'without test reports' do context 'without test reports' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
it 'shows zero' do it 'shows zero' do
expect(page.find('.js-test-report-badge-counter', visible: :all).text).to eq("0") expect(page.find('.js-test-report-badge-counter', visible: :all).text).to eq("0")
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment