From 5609f4e03be1a90f7714fb5031cc1f29ab253336 Mon Sep 17 00:00:00 2001 From: Alexander Turinske <aturinske@gitlab.com> Date: Mon, 16 Dec 2024 18:40:58 -0800 Subject: [PATCH] Update tests for vue 3 - remove find method for unstubbed component --- ...container_scanning_for_registry_tab_spec.js | 18 ++++++++---------- scripts/frontend/quarantined_vue3_specs.txt | 1 - 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/container_scanning_for_registry_tab_spec.js b/ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/container_scanning_for_registry_tab_spec.js index 6e9908b93a7ed..b397a776807bd 100644 --- a/ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/container_scanning_for_registry_tab_spec.js +++ b/ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/container_scanning_for_registry_tab_spec.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; -import { GlAlert, GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui'; -import { mount } from '@vue/test-utils'; +import { GlAlert, GlEmptyState, GlSprintf } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import component from 'ee/security_dashboard/components/shared/vulnerability_report/container_scanning_for_registry_tab.vue'; @@ -19,10 +19,7 @@ describe('Container scanning for registry', () => { const findVulnerabilityReportTab = () => wrapper.findComponent(VulnerabilityReportTab); const findBanner = () => wrapper.findComponent(GlAlert); - const findBannerText = () => findBanner().findComponent(GlSprintf); const findEmptyState = () => wrapper.findComponent(GlEmptyState); - const findEmptyStateText = () => findEmptyState().findComponent(GlSprintf); - const findEmptyStateLink = () => findEmptyState().findComponent(GlLink); const waitForApolloRequestRender = async () => { await waitForPromises(); @@ -63,12 +60,13 @@ describe('Container scanning for registry', () => { data: graphQLProjectContainerScanningForRegistryOnMock.data, }); - wrapper = mount(component, { + wrapper = shallowMount(component, { apolloProvider, propsData: { isActiveTab: true, }, stubs: { + GlSprintf, VulnerabilityReportTab: stubComponent(VulnerabilityReportTab, { template: RENDER_ALL_SLOTS_TEMPLATE, }), @@ -98,8 +96,8 @@ describe('Container scanning for registry', () => { expect(findVulnerabilityReportTab().exists()).toBe(true); expect(findBanner().exists()).toBe(true); - expect(findBanner().text()).toContain('Container Scanning for registry is active'); - expect(findBannerText().text()).toBe( + expect(findBanner().props('title')).toBe('Container Scanning for registry is active'); + expect(findBanner().text()).toContain( 'Container Scanning for Registry scans the latest tag of each image. It scans for vulnerabilities in the container', ); expect(findEmptyState().exists()).toBe(false); @@ -147,9 +145,9 @@ describe('Container scanning for registry', () => { expect(findVulnerabilityReportTab().exists()).toBe(true); expect(findBanner().exists()).toBe(false); expect(findEmptyState().exists()).toBe(true); - expect(findEmptyStateText().text()).toBe( + expect(findEmptyState().text()).toContain( 'Container Scanning for Registry scans the latest tag of each image for vulnerabilities.', ); - expect(findEmptyStateLink().text()).toBe('How do I enable Container Scanning for Registry?'); + expect(findEmptyState().text()).toContain('How do I enable Container Scanning for Registry?'); }); }); diff --git a/scripts/frontend/quarantined_vue3_specs.txt b/scripts/frontend/quarantined_vue3_specs.txt index 51534f5918b69..fe3303aad60e9 100644 --- a/scripts/frontend/quarantined_vue3_specs.txt +++ b/scripts/frontend/quarantined_vue3_specs.txt @@ -92,7 +92,6 @@ ee/spec/frontend/security_configuration/dast_profiles/components/dast_profiles_l ee/spec/frontend/security_dashboard/components/shared/empty_states/dashboard_has_no_vulnerabilities_spec.js ee/spec/frontend/security_dashboard/components/shared/filters/querystring_sync_spec.js ee/spec/frontend/security_dashboard/components/shared/vulnerability_details_graphql/details_section_spec.js -ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/container_scanning_for_registry_tab_spec.js ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/vulnerability_list_graphql_spec.js ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/vulnerability_report_spec.js ee/spec/frontend/security_dashboard/components/shared/vulnerability_report/vulnerability_report_tabs_spec.js -- GitLab