Commit b38f54ed authored by Mark Florian's avatar Mark Florian

Add pinning tests

These are [temporary tests][1] designed to idenitfy the complete
rendering behaviour of the existing implementation to support
a refactoring. They will be thrown away once the refactoring is
complete.

[1]: https://web.archive.org/web/20170826101146/http://wiki.c2.com/?PinningTests
parent 5a925f1e
import Vue, { nextTick } from 'vue';
import { initSecurityConfiguration } from 'ee/security_configuration';
import { resetHTMLFixture } from 'helpers/fixtures';
import { someEnabledEl, noneEnabledEl, someEnabledWithAutoDevOpsEl } from './mock_data';
const errorsAndWarnings = [];
const errorWarnHandler = (error, vm, info) => {
errorsAndWarnings.push(`Vue error/warning: Message: ${error}
vm.name: ${vm.name}
info: ${JSON.stringify(info)}
`);
};
Vue.config.errorHandler = errorWarnHandler;
Vue.config.warnHandler = errorWarnHandler;
describe('Security Configuration App', () => {
describe.each`
context | mountElHtml
${'some enabled scanners (gitlab-ui)'} | ${someEnabledEl}
${'no enabled scanners'} | ${noneEnabledEl}
${'some enabled by ADO'} | ${someEnabledWithAutoDevOpsEl}
`('given $context', ({ mountElHtml }) => {
beforeEach(() => {
setFixtures(mountElHtml);
const el = document.querySelector('#js-security-configuration');
initSecurityConfiguration(el);
return nextTick();
});
afterEach(() => {
resetHTMLFixture();
});
it('matches the snapshot', () => {
expect(errorsAndWarnings).toEqual([]);
expect(document.body).toMatchSnapshot();
});
});
});
export const someEnabledEl = `
<div data-auto-devops-help-page-path="/help/topics/autodevops/index" data-auto-devops-path="/gitlab-org/gitlab-ui/-/settings/ci_cd#autodevops-settings" data-auto-fix-enabled="{&quot;dependency_scanning&quot;:true,&quot;container_scanning&quot;:true}" data-auto-fix-help-path="/" data-auto-fix-user-path="/" data-can-enable-auto-devops data-can-toggle-auto-fix-settings data-container-scanning-help-path="/help/user/application_security/container_scanning/index" data-create-sast-merge-request-path="/gitlab-org/gitlab-ui/-/security/configuration/sast" data-dependency-scanning-help-path="/help/user/application_security/dependency_scanning/index" data-features="[{&quot;type&quot;:&quot;sast&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled&quot;,&quot;configuration_path&quot;:&quot;/gitlab-org/gitlab-ui/-/security/configuration/sast&quot;},{&quot;type&quot;:&quot;dast&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;dast_profiles&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Available for on-demand DAST&quot;,&quot;configuration_path&quot;:&quot;/gitlab-org/gitlab-ui/-/security/configuration/dast_profiles&quot;},{&quot;type&quot;:&quot;dependency_scanning&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;container_scanning&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;secret_detection&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;coverage_fuzzing&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;api_fuzzing&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:&quot;/gitlab-org/gitlab-ui/-/security/configuration/api_fuzzing&quot;},{&quot;type&quot;:&quot;license_scanning&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled&quot;,&quot;configuration_path&quot;:null}]" data-gitlab-ci-history-path="/gitlab-org/gitlab-ui/-/blame/main/.gitlab-ci.yml" data-gitlab-ci-present data-help-page-path="/help/user/application_security/index" data-latest-pipeline-path="/gitlab-org/gitlab-ui/-/pipelines/263335857" data-toggle-autofix-setting-endpoint="configuration/auto_fix" id="js-security-configuration"></div>`;
export const noneEnabledEl = `
<div data-auto-devops-help-page-path="/help/topics/autodevops/index" data-auto-devops-path="/markrian/qr/-/settings/ci_cd#autodevops-settings" data-auto-fix-enabled="{&quot;dependency_scanning&quot;:true,&quot;container_scanning&quot;:true}" data-auto-fix-help-path="/" data-auto-fix-user-path="/" data-can-enable-auto-devops data-can-toggle-auto-fix-settings data-container-scanning-help-path="/help/user/application_security/container_scanning/index" data-create-sast-merge-request-path="/markrian/qr/-/security/configuration/sast" data-dependency-scanning-help-path="/help/user/application_security/dependency_scanning/index" data-features="[{&quot;type&quot;:&quot;sast&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:&quot;/markrian/qr/-/security/configuration/sast&quot;},{&quot;type&quot;:&quot;dast&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;dast_profiles&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Available for on-demand DAST&quot;,&quot;configuration_path&quot;:&quot;/markrian/qr/-/security/configuration/dast_profiles&quot;},{&quot;type&quot;:&quot;dependency_scanning&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;container_scanning&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;secret_detection&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;coverage_fuzzing&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;api_fuzzing&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;license_scanning&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null}]" data-gitlab-ci-history-path="/markrian/qr/-/blame/master/.gitlab-ci.yml" data-gitlab-ci-present data-help-page-path="/help/user/application_security/index" data-latest-pipeline-path="/markrian/qr/-/pipelines/249400518" data-toggle-autofix-setting-endpoint="configuration/auto_fix" id="js-security-configuration"></div>`;
export const someEnabledWithAutoDevOpsEl = `
<div data-auto-devops-enabled data-auto-devops-help-page-path="/help/topics/autodevops/index" data-auto-devops-path="/markrian-test/test-public-project/-/settings/ci_cd#autodevops-settings" data-auto-fix-enabled="{&quot;dependency_scanning&quot;:true,&quot;container_scanning&quot;:true}" data-auto-fix-help-path="/" data-auto-fix-user-path="/" data-can-enable-auto-devops data-can-toggle-auto-fix-settings data-container-scanning-help-path="/help/user/application_security/container_scanning/index" data-create-sast-merge-request-path="/markrian-test/test-public-project/-/security/configuration/sast" data-dependency-scanning-help-path="/help/user/application_security/dependency_scanning/index" data-features="[{&quot;type&quot;:&quot;sast&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:&quot;/markrian-test/test-public-project/-/security/configuration/sast&quot;},{&quot;type&quot;:&quot;dast&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;dast_profiles&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Available for on-demand DAST&quot;,&quot;configuration_path&quot;:&quot;/markrian-test/test-public-project/-/security/configuration/dast_profiles&quot;},{&quot;type&quot;:&quot;dependency_scanning&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;container_scanning&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled with Auto DevOps&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;secret_detection&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled with Auto DevOps&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;coverage_fuzzing&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:null},{&quot;type&quot;:&quot;api_fuzzing&quot;,&quot;configured&quot;:false,&quot;status&quot;:&quot;Not enabled&quot;,&quot;configuration_path&quot;:&quot;/markrian-test/test-public-project/-/security/configuration/api_fuzzing&quot;},{&quot;type&quot;:&quot;license_scanning&quot;,&quot;configured&quot;:true,&quot;status&quot;:&quot;Enabled with Auto DevOps&quot;,&quot;configuration_path&quot;:null}]" data-gitlab-ci-history-path="/markrian-test/test-public-project/-/blame/master/.gitlab-ci.yml" data-help-page-path="/help/user/application_security/index" data-latest-pipeline-path="/markrian-test/test-public-project/-/pipelines/255361656" data-toggle-autofix-setting-endpoint="configuration/auto_fix" id="js-security-configuration"></div>`;
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