diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-07 03:09:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-07 03:09:01 +0300 |
commit | 4e4519f1f8ee22cca599a8d9b7f7dbc7a9764052 (patch) | |
tree | f35947207d63ca022236b7637825ed17afb8c8e1 /spec | |
parent | 5de148b2f4b20e1e900cd085580ab0d7fa5f092b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/admin/analytics/devops_score/components/devops_score_spec.js | 17 | ||||
-rw-r--r-- | spec/frontend/analytics/devops_report/components/service_ping_disabled_spec.js | 12 | ||||
-rw-r--r-- | spec/frontend/security_configuration/app_spec.js | 27 | ||||
-rw-r--r-- | spec/frontend/security_configuration/components/app_spec.js (renamed from spec/frontend/security_configuration/components/redesigned_app_spec.js) | 10 | ||||
-rw-r--r-- | spec/frontend/security_configuration/configuration_table_spec.js | 52 | ||||
-rw-r--r-- | spec/frontend/security_configuration/upgrade_spec.js | 30 | ||||
-rw-r--r-- | spec/requests/robots_txt_spec.rb | 1 |
7 files changed, 18 insertions, 131 deletions
diff --git a/spec/frontend/admin/analytics/devops_score/components/devops_score_spec.js b/spec/frontend/admin/analytics/devops_score/components/devops_score_spec.js index cd8b70bccf0..8f8dac977de 100644 --- a/spec/frontend/admin/analytics/devops_score/components/devops_score_spec.js +++ b/spec/frontend/admin/analytics/devops_score/components/devops_score_spec.js @@ -1,15 +1,10 @@ -import { GlTable, GlBadge, GlEmptyState, GlLink } from '@gitlab/ui'; +import { GlTable, GlBadge, GlEmptyState } from '@gitlab/ui'; import { GlSingleStat } from '@gitlab/ui/dist/charts'; import { mount } from '@vue/test-utils'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import DevopsScore from '~/analytics/devops_report/components/devops_score.vue'; import DevopsScoreCallout from '~/analytics/devops_report/components/devops_score_callout.vue'; -import { - devopsScoreMetricsData, - devopsReportDocsPath, - noDataImagePath, - devopsScoreTableHeaders, -} from '../mock_data'; +import { devopsScoreMetricsData, noDataImagePath, devopsScoreTableHeaders } from '../mock_data'; describe('DevopsScore', () => { let wrapper; @@ -19,7 +14,6 @@ describe('DevopsScore', () => { mount(DevopsScore, { provide: { devopsScoreMetrics, - devopsReportDocsPath, noDataImagePath, }, }), @@ -32,6 +26,8 @@ describe('DevopsScore', () => { const findUsageCol = () => findCol('usageCol'); const findDevopsScoreApp = () => wrapper.findByTestId('devops-score-app'); const bannerExists = () => wrapper.findComponent(DevopsScoreCallout).exists(); + const findDocsLink = () => + wrapper.findByRole('link', { name: 'See example DevOps Score page in our documentation.' }); describe('with no data', () => { beforeEach(() => { @@ -54,7 +50,10 @@ describe('DevopsScore', () => { }); it('contains a link to the feature documentation', () => { - expect(wrapper.findComponent(GlLink).exists()).toBe(true); + expect(findDocsLink().exists()).toBe(true); + expect(findDocsLink().attributes('href')).toBe( + '/help/user/admin_area/analytics/dev_ops_report', + ); }); }); diff --git a/spec/frontend/analytics/devops_report/components/service_ping_disabled_spec.js b/spec/frontend/analytics/devops_report/components/service_ping_disabled_spec.js index 75ef9d9db94..c5c40e9a360 100644 --- a/spec/frontend/analytics/devops_report/components/service_ping_disabled_spec.js +++ b/spec/frontend/analytics/devops_report/components/service_ping_disabled_spec.js @@ -1,6 +1,6 @@ import { GlEmptyState, GlSprintf } from '@gitlab/ui'; import { TEST_HOST } from 'helpers/test_constants'; -import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; import ServicePingDisabled from '~/analytics/devops_report/components/service_ping_disabled.vue'; describe('~/analytics/devops_report/components/service_ping_disabled.vue', () => { @@ -11,21 +11,19 @@ describe('~/analytics/devops_report/components/service_ping_disabled.vue', () => }); const createWrapper = ({ isAdmin = false } = {}) => { - wrapper = shallowMountExtended(ServicePingDisabled, { + wrapper = mountExtended(ServicePingDisabled, { provide: { isAdmin, svgPath: TEST_HOST, - docsLink: TEST_HOST, primaryButtonPath: TEST_HOST, }, - stubs: { GlEmptyState, GlSprintf }, }); }; const findEmptyState = () => wrapper.findComponent(GlEmptyState); const findMessageForRegularUsers = () => wrapper.findComponent(GlSprintf); - const findDocsLink = () => wrapper.findByTestId('docs-link'); - const findPowerOnButton = () => wrapper.findByTestId('power-on-button'); + const findDocsLink = () => wrapper.findByRole('link', { name: 'service ping' }); + const findPowerOnButton = () => wrapper.findByRole('link', { name: 'Turn on service ping' }); it('renders empty state with provided SVG path', () => { createWrapper(); @@ -45,7 +43,7 @@ describe('~/analytics/devops_report/components/service_ping_disabled.vue', () => it('renders docs link', () => { expect(findDocsLink().exists()).toBe(true); - expect(findDocsLink().attributes('href')).toBe(TEST_HOST); + expect(findDocsLink().attributes('href')).toBe('/help/development/service_ping/index.md'); }); }); diff --git a/spec/frontend/security_configuration/app_spec.js b/spec/frontend/security_configuration/app_spec.js deleted file mode 100644 index 11d481fb210..00000000000 --- a/spec/frontend/security_configuration/app_spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import App from '~/security_configuration/components/app.vue'; -import ConfigurationTable from '~/security_configuration/components/configuration_table.vue'; - -describe('App Component', () => { - let wrapper; - - const createComponent = () => { - wrapper = shallowMount(App, {}); - }; - const findConfigurationTable = () => wrapper.findComponent(ConfigurationTable); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders correct primary & Secondary Heading', () => { - createComponent(); - expect(wrapper.text()).toContain('Security Configuration'); - expect(wrapper.text()).toContain('Testing & Compliance'); - }); - - it('renders ConfigurationTable Component', () => { - createComponent(); - expect(findConfigurationTable().exists()).toBe(true); - }); -}); diff --git a/spec/frontend/security_configuration/components/redesigned_app_spec.js b/spec/frontend/security_configuration/components/app_spec.js index 92e0443552c..f27f45f2b26 100644 --- a/spec/frontend/security_configuration/components/redesigned_app_spec.js +++ b/spec/frontend/security_configuration/components/app_spec.js @@ -4,6 +4,7 @@ import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { makeMockUserCalloutDismisser } from 'helpers/mock_user_callout_dismisser'; import stubChildren from 'helpers/stub_children'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import SecurityConfigurationApp, { i18n } from '~/security_configuration/components/app.vue'; import AutoDevopsAlert from '~/security_configuration/components/auto_dev_ops_alert.vue'; import AutoDevopsEnabledAlert from '~/security_configuration/components/auto_dev_ops_enabled_alert.vue'; import { @@ -19,9 +20,6 @@ import { } from '~/security_configuration/components/constants'; import FeatureCard from '~/security_configuration/components/feature_card.vue'; -import RedesignedSecurityConfigurationApp, { - i18n, -} from '~/security_configuration/components/redesigned_app.vue'; import UpgradeBanner from '~/security_configuration/components/upgrade_banner.vue'; import { REPORT_TYPE_LICENSE_COMPLIANCE, @@ -36,7 +34,7 @@ const projectPath = 'namespace/project'; useLocalStorageSpy(); -describe('redesigned App component', () => { +describe('App component', () => { let wrapper; let userCalloutDismissSpy; @@ -44,7 +42,7 @@ describe('redesigned App component', () => { userCalloutDismissSpy = jest.fn(); wrapper = extendedWrapper( - mount(RedesignedSecurityConfigurationApp, { + mount(SecurityConfigurationApp, { propsData, provide: { upgradePath, @@ -53,7 +51,7 @@ describe('redesigned App component', () => { projectPath, }, stubs: { - ...stubChildren(RedesignedSecurityConfigurationApp), + ...stubChildren(SecurityConfigurationApp), GlLink: false, GlSprintf: false, LocalStorageSync: false, diff --git a/spec/frontend/security_configuration/configuration_table_spec.js b/spec/frontend/security_configuration/configuration_table_spec.js deleted file mode 100644 index fbd72265c4b..00000000000 --- a/spec/frontend/security_configuration/configuration_table_spec.js +++ /dev/null @@ -1,52 +0,0 @@ -import { mount } from '@vue/test-utils'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import ConfigurationTable from '~/security_configuration/components/configuration_table.vue'; -import { scanners, UPGRADE_CTA } from '~/security_configuration/components/constants'; - -import { - REPORT_TYPE_SAST, - REPORT_TYPE_SECRET_DETECTION, -} from '~/vue_shared/security_reports/constants'; - -describe('Configuration Table Component', () => { - let wrapper; - - const createComponent = () => { - wrapper = extendedWrapper( - mount(ConfigurationTable, { - provide: { - projectPath: 'testProjectPath', - }, - }), - ); - }; - - const findHelpLinks = () => wrapper.findAll('[data-testid="help-link"]'); - - afterEach(() => { - wrapper.destroy(); - }); - - beforeEach(() => { - createComponent(); - }); - - describe.each(scanners.map((scanner, i) => [scanner, i]))('given scanner %s', (scanner, i) => { - it('should match strings', () => { - expect(wrapper.text()).toContain(scanner.name); - expect(wrapper.text()).toContain(scanner.description); - if (scanner.type === REPORT_TYPE_SAST) { - expect(wrapper.findByTestId(scanner.type).text()).toBe('Configure via Merge Request'); - } else if (scanner.type === REPORT_TYPE_SECRET_DETECTION) { - expect(wrapper.findByTestId(scanner.type).exists()).toBe(false); - } else { - expect(wrapper.findByTestId(scanner.type).text()).toMatchInterpolatedText(UPGRADE_CTA); - } - }); - - it('should show expected help link', () => { - const helpLink = findHelpLinks().at(i); - expect(helpLink.attributes('href')).toBe(scanner.helpPath); - }); - }); -}); diff --git a/spec/frontend/security_configuration/upgrade_spec.js b/spec/frontend/security_configuration/upgrade_spec.js deleted file mode 100644 index 20bb38aa469..00000000000 --- a/spec/frontend/security_configuration/upgrade_spec.js +++ /dev/null @@ -1,30 +0,0 @@ -import { mount } from '@vue/test-utils'; -import { UPGRADE_CTA } from '~/security_configuration/components/constants'; -import Upgrade from '~/security_configuration/components/upgrade.vue'; - -const TEST_URL = 'http://www.example.test'; -let wrapper; -const createComponent = (componentData = {}) => { - wrapper = mount(Upgrade, componentData); -}; - -afterEach(() => { - wrapper.destroy(); -}); - -describe('Upgrade component', () => { - beforeEach(() => { - createComponent({ provide: { upgradePath: TEST_URL } }); - }); - - it('renders correct text in link', () => { - expect(wrapper.text()).toMatchInterpolatedText(UPGRADE_CTA); - }); - - it('renders link with correct default attributes', () => { - expect(wrapper.find('a').attributes()).toMatchObject({ - href: TEST_URL, - target: '_blank', - }); - }); -}); diff --git a/spec/requests/robots_txt_spec.rb b/spec/requests/robots_txt_spec.rb index a8be4093a71..f6c9b018c68 100644 --- a/spec/requests/robots_txt_spec.rb +++ b/spec/requests/robots_txt_spec.rb @@ -28,6 +28,7 @@ RSpec.describe 'Robots.txt Requests', :aggregate_failures do it 'blocks the requests' do requests = [ + Gitlab::Experiment::Configuration.mount_at, '/autocomplete/users', '/autocomplete/projects', '/search', |