Commit d464f9e2 authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Add test case for `first_class_vulnerabilities` feature flag

parent da46b9ff
......@@ -2,11 +2,13 @@
require 'spec_helper'
describe 'Group overview', :js do
describe 'Group overview', :js, :aggregate_failures do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:empty_project) { create(:project, namespace: group) }
subject(:visit_page) { visit group_path(group) }
before do
stub_feature_flags(first_class_vulnerabilities: false)
group.add_owner(user)
......@@ -15,7 +17,7 @@ describe 'Group overview', :js do
context 'when the default value of "Group Overview content" preference is used' do
it 'displays the Details view' do
visit group_path(group)
visit_page
page.within(find('.content')) do
expect(page).to have_content 'Subgroups and projects'
......@@ -35,19 +37,45 @@ describe 'Group overview', :js do
context 'and Security Dashboard feature is available for a group' do
let(:group) { create(:group_with_plan, plan: :gold_plan) }
let(:project) { create(:project, :public, namespace: group) }
before do
create(:vulnerability, :with_findings, project: project)
end
context 'when the "first_class_vulnerabilities" feature flag is not enabled' do
it 'displays the Security Dashboard view' do
visit_page
expect(page).to have_selector('.js-security-dashboard-table')
it 'displays the Security Dashboard view' do
visit group_path(group)
page.within(find('aside')) do
expect(page).to have_content 'Vulnerabilities over time'
expect(page).to have_selector('.js-vulnerabilities-chart-time-info')
expect(page).to have_selector('.js-vulnerabilities-chart-severity-level-breakdown')
expect(page).to have_selector('.js-security-dashboard-table')
expect(page).to have_content 'Project security status'
expect(page).to have_selector('.js-projects-security-status')
end
page.within(all('div.row')[1]) do
expect(page).not_to have_content 'Detected'
end
end
end
context 'when the "first_class_vulnerabilities" feature flag is enabled' do
before do
stub_feature_flags(first_class_vulnerabilities: true)
end
page.within(find('aside')) do
expect(page).to have_content 'Vulnerabilities over time'
expect(page).to have_selector('.js-vulnerabilities-chart-time-info')
expect(page).to have_selector('.js-vulnerabilities-chart-severity-level-breakdown')
it 'loads the first class group security dashboard' do
visit_page
expect(page).to have_content 'Project security status'
expect(page).to have_selector('.js-projects-security-status')
page.within(all('div.row')[1]) do
expect(page).to have_content 'Detected'
expect(page).to have_content 'Severity'
end
end
end
end
......@@ -56,7 +84,7 @@ describe 'Group overview', :js do
let(:group) { create(:group_with_plan, plan: :bronze_plan) }
it 'displays the "Security Dashboard unavailable" empty state' do
visit group_path(group)
visit_page
page.within(find('.content')) do
expect(page).to have_content "Either you don't have permission to view this dashboard or "\
......
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