Commit 7e457277 authored by mfluharty's avatar mfluharty

Reorganize licensed vs unlicensed tests

Explicitly stub licensed feature
Remove unecessary wait_for_requests's
parent 4b8eb0fa
......@@ -169,6 +169,29 @@ RSpec.describe 'Pipeline', :js do
describe 'GET /:project/pipelines/:id/codequality_report', :aggregate_failures do
shared_examples_for 'full codequality report' do
context 'when licensed' do
before do
stub_licensed_features(full_codequality_report: true)
end
context 'with code quality artifact' do
before do
create(:ee_ci_build, :codequality, pipeline: pipeline)
visit codequality_report_project_pipeline_path(project, pipeline)
end
it 'shows code quality tab pane as active, quality issue with link to file, and events for data tracking' do
expect(page).to have_content('Code Quality')
expect(page).to have_css('#js-tab-codequality')
expect(page).to have_content('Method `new_array` has 12 arguments (exceeds 4 allowed). Consider refactoring.')
expect(find_link('foo.rb:10')[:href]).to end_with(project_blob_path(project, File.join(pipeline.commit.id, 'foo.rb')) + '#L10')
expect(page).to have_selector('[data-track-event="click_button"]')
expect(page).to have_selector('[data-track-label="get_codequality_report"]')
end
end
context 'with no code quality artifact' do
before do
create(:ee_ci_build, pipeline: pipeline)
......@@ -180,6 +203,7 @@ RSpec.describe 'Pipeline', :js do
expect(page).not_to have_css('#js-tab-codequality')
end
end
end
context 'when unlicensed' do
before do
......@@ -187,7 +211,6 @@ RSpec.describe 'Pipeline', :js do
create(:ee_ci_build, :codequality, pipeline: pipeline)
visit project_pipeline_path(project, pipeline)
wait_for_requests
end
it 'does not show code quality tab' do
......@@ -195,25 +218,6 @@ RSpec.describe 'Pipeline', :js do
expect(page).not_to have_css('#js-tab-codequality')
end
end
context 'with code quality artifact' do
before do
create(:ee_ci_build, :codequality, pipeline: pipeline)
visit codequality_report_project_pipeline_path(project, pipeline)
wait_for_requests
end
it 'shows code quality tab pane as active, quality issue with link to file, and events for data tracking' do
expect(page).to have_content('Code Quality')
expect(page).to have_css('#js-tab-codequality')
expect(page).to have_content('Method `new_array` has 12 arguments (exceeds 4 allowed). Consider refactoring.')
expect(find_link('foo.rb:10')[:href]).to end_with(project_blob_path(project, File.join(pipeline.commit.id, 'foo.rb')) + '#L10')
expect(page).to have_selector('[data-track-event="click_button"]')
expect(page).to have_selector('[data-track-label="get_codequality_report"]')
end
end
end
context 'for a branch pipeline' do
......
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