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 @@
#js-tab-tests.tab-pane
#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) } }
= render_if_exists "projects/pipelines/tabs_content", pipeline: @pipeline, project: @project
......@@ -361,9 +361,11 @@ 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) }
context 'with build_report_summary feature flag disabled' do
before do
stub_feature_flags(build_report_summary: false)
visit_pipeline
wait_for_requests
end
......@@ -396,6 +398,35 @@ RSpec.describe 'Pipeline', :js do
end
end
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
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
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
end
context 'retrying jobs' do
before do
visit_pipeline
......
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