Commit e0adafd2 authored by Mark Florian's avatar Mark Florian Committed by Brandon Labuschagne

Add basic Security Configuration feature spec

This is to support the rearchitecturing work in
https://gitlab.com/groups/gitlab-org/-/epics/5460.

Addresses https://gitlab.com/gitlab-org/gitlab/-/issues/322462.
parent bf63dd6f
...@@ -171,7 +171,13 @@ export default { ...@@ -171,7 +171,13 @@ export default {
</gl-sprintf> </gl-sprintf>
</gl-alert> </gl-alert>
<gl-table ref="securityControlTable" :items="features" :fields="fields" stacked="md"> <gl-table
ref="securityControlTable"
:items="features"
:fields="fields"
stacked="md"
:tbody-tr-attr="{ 'data-testid': 'security-scanner-row' }"
>
<template #cell(feature)="{ item }"> <template #cell(feature)="{ item }">
<div class="gl-text-gray-900">{{ item.name }}</div> <div class="gl-text-gray-900">{{ item.name }}</div>
<div> <div>
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User sees Security Configuration table', :js do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
before_all do
project.add_developer(user)
end
before do
sign_in(user)
end
context 'with security_dashboard feature available' do
before do
stub_licensed_features(security_dashboard: true)
end
context 'with no SAST report' do
it 'shows SAST is not enabled' do
visit(project_security_configuration_path(project))
within_sast_row do
expect(page).to have_text('SAST')
expect(page).to have_text('Not enabled')
expect(page).to have_css('[data-testid="enableButton"]')
end
end
end
context 'with SAST report' do
before do
pipeline = create(:ci_pipeline, project: project)
create(:ci_build, :sast, pipeline: pipeline, status: 'success')
end
it 'shows SAST is enabled' do
visit(project_security_configuration_path(project))
within_sast_row do
expect(page).to have_text('SAST')
expect(page).to have_text('Enabled')
expect(page).to have_css('[data-testid="configureButton"]')
end
end
end
end
def within_sast_row
within '[data-testid="security-scanner-row"]:nth-of-type(1)' do
yield
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