Commit 7dae08d1 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '322462-security-configuration-feature-spec' into 'master'

Add feature specs for Security Configuration page

See merge request gitlab-org/gitlab!55052
parents 3b28f1cc e0adafd2
......@@ -171,7 +171,13 @@ export default {
</gl-sprintf>
</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 }">
<div class="gl-text-gray-900">{{ item.name }}</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