diff options
Diffstat (limited to 'spec/frontend')
7 files changed, 55 insertions, 45 deletions
diff --git a/spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js b/spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js index 23ec170961a..64e9c11a584 100644 --- a/spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js +++ b/spec/frontend/ci/runner/components/cells/runner_summary_cell_spec.js @@ -82,14 +82,15 @@ describe('RunnerTypeCell', () => { it('Displays the runner description', () => { expect(wrapper.text()).toContain(mockRunner.description); + expect(wrapper.findByText(I18N_NO_DESCRIPTION).exists()).toBe(false); }); - it('Displays the no runner description', () => { + it('Displays "No description" for missing runner description', () => { createComponent({ description: null, }); - expect(wrapper.text()).toContain(I18N_NO_DESCRIPTION); + expect(wrapper.findByText(I18N_NO_DESCRIPTION).classes()).toContain('gl-text-secondary'); }); it('Displays last contact', () => { diff --git a/spec/frontend/environments/empty_state_spec.js b/spec/frontend/environments/empty_state_spec.js index d067c4c80e0..593200859e4 100644 --- a/spec/frontend/environments/empty_state_spec.js +++ b/spec/frontend/environments/empty_state_spec.js @@ -11,12 +11,17 @@ describe('~/environments/components/empty_state.vue', () => { const findNewEnvironmentLink = () => wrapper.findByRole('link', { - name: s__('Environments|New environment'), + name: s__('Environments|Create an environment'), }); const findDocsLink = () => wrapper.findByRole('link', { - name: s__('Environments|How do I create an environment?'), + name: 'Learn more', + }); + + const finfEnablingReviewButton = () => + wrapper.findByRole('button', { + name: s__('Environments|Enable review apps'), }); const createWrapper = ({ propsData = {} } = {}) => @@ -29,38 +34,44 @@ describe('~/environments/components/empty_state.vue', () => { provide: { newEnvironmentPath: NEW_PATH }, }); - it('shows an empty state for available environments', () => { - wrapper = createWrapper(); - - const title = wrapper.findByRole('heading', { - name: s__("Environments|You don't have any environments."), + describe('without search term', () => { + beforeEach(() => { + wrapper = createWrapper(); }); - expect(title.exists()).toBe(true); - }); + it('shows an empty state environments', () => { + const title = wrapper.findByRole('heading', { + name: s__('Environments|Get started with environments'), + }); - it('shows an empty state for stopped environments', () => { - wrapper = createWrapper({ propsData: { scope: ENVIRONMENTS_SCOPE.STOPPED } }); + expect(title.exists()).toBe(true); + }); + + it('shows a link to the the help path', () => { + const link = findDocsLink(); - const title = wrapper.findByRole('heading', { - name: s__("Environments|You don't have any stopped environments."), + expect(link.attributes('href')).toBe(HELP_PATH); }); - expect(title.exists()).toBe(true); - }); + it('shows a link to creating a new environment', () => { + const link = findNewEnvironmentLink(); - it('shows a link to the the help path', () => { - wrapper = createWrapper(); + expect(link.attributes('href')).toBe(NEW_PATH); + }); - const link = findDocsLink(); + it('shows a button to enable review apps', () => { + const button = finfEnablingReviewButton(); - expect(link.attributes('href')).toBe(HELP_PATH); - }); + expect(button.exists()).toBe(true); + }); + + it('should emit enable review', () => { + const button = finfEnablingReviewButton(); - it('hides a link to creating a new environment', () => { - const link = findNewEnvironmentLink(); + button.vm.$emit('click'); - expect(link.exists()).toBe(false); + expect(wrapper.emitted('enable-review')).toBeDefined(); + }); }); describe('with search term', () => { @@ -86,10 +97,16 @@ describe('~/environments/components/empty_state.vue', () => { expect(link.exists()).toBe(false); }); - it('shows a link to create a new environment', () => { + it('hide a link to create a new environment', () => { const link = findNewEnvironmentLink(); - expect(link.attributes('href')).toBe(NEW_PATH); + expect(link.exists()).toBe(false); + }); + + it('hide a button to enable review apps', () => { + const button = finfEnablingReviewButton(); + + expect(button.exists()).toBe(false); }); }); }); diff --git a/spec/frontend/environments/enable_review_app_modal_spec.js b/spec/frontend/environments/enable_review_app_modal_spec.js index ee728775980..f5571609931 100644 --- a/spec/frontend/environments/enable_review_app_modal_spec.js +++ b/spec/frontend/environments/enable_review_app_modal_spec.js @@ -10,7 +10,7 @@ jest.mock('lodash/uniqueId', () => (x) => `${x}77`); const EXPECTED_COPY_PRE_ID = 'enable-review-app-copy-string-77'; -describe('Enable Review App Modal', () => { +describe('Enable Review Apps Modal', () => { let wrapper; let modal; diff --git a/spec/frontend/environments/environments_app_spec.js b/spec/frontend/environments/environments_app_spec.js index 6f2ee6f06cd..dc450eb2aa7 100644 --- a/spec/frontend/environments/environments_app_spec.js +++ b/spec/frontend/environments/environments_app_spec.js @@ -170,12 +170,8 @@ describe('~/environments/components/environments_app.vue', () => { folder: resolvedFolder, }); - const button = wrapper.findByRole('button', { name: s__('Environments|Enable review app') }); - button.trigger('click'); - - await nextTick(); - - expect(wrapper.findByText(s__('ReviewApp|Enable Review App')).exists()).toBe(true); + const button = wrapper.findByRole('button', { name: s__('Environments|Enable review apps') }); + expect(button.exists()).toBe(true); }); it('should not show a button to open the review app modal if review apps are configured', async () => { @@ -187,7 +183,7 @@ describe('~/environments/components/environments_app.vue', () => { folder: resolvedFolder, }); - const button = wrapper.findByRole('button', { name: s__('Environments|Enable review app') }); + const button = wrapper.findByRole('button', { name: s__('Environments|Enable review apps') }); expect(button.exists()).toBe(false); }); diff --git a/spec/frontend/google_tag_manager/index_spec.js b/spec/frontend/google_tag_manager/index_spec.js index ec9e1ef8e5f..dd8e886e6bc 100644 --- a/spec/frontend/google_tag_manager/index_spec.js +++ b/spec/frontend/google_tag_manager/index_spec.js @@ -6,7 +6,6 @@ import { trackProjectImport, trackNewRegistrations, trackSaasTrialSubmit, - trackSaasTrialSkip, trackSaasTrialGroup, trackSaasTrialGetStarted, trackTrialAcceptTerms, @@ -143,9 +142,6 @@ describe('~/google_tag_manager/index', () => { describe.each([ createOmniAuthTestCase(trackFreeTrialAccountSubmissions, 'freeThirtyDayTrial'), createOmniAuthTestCase(trackNewRegistrations, 'standardSignUp'), - createTestCase(trackSaasTrialSkip, { - links: [{ cls: 'js-skip-trial', expectation: { event: 'saasTrialSkip' } }], - }), createTestCase(trackSaasTrialGroup, { forms: [{ cls: 'js-saas-trial-group', expectation: { event: 'saasTrialGroup' } }], }), diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js index 68a430b0403..f0772bce167 100644 --- a/spec/frontend/pipelines/pipelines_spec.js +++ b/spec/frontend/pipelines/pipelines_spec.js @@ -42,7 +42,7 @@ describe('Pipelines', () => { let trackingSpy; const paths = { - emptyStateSvgPath: '/assets/illustrations/pipelines_empty.svg', + emptyStateSvgPath: '/assets/illustrations/empty-state/empty-pipeline-md.svg', errorStateSvgPath: '/assets/illustrations/pipelines_failed.svg', noPipelinesSvgPath: '/assets/illustrations/pipelines_pending.svg', ciLintPath: '/ci/lint', @@ -53,7 +53,7 @@ describe('Pipelines', () => { }; const noPermissions = { - emptyStateSvgPath: '/assets/illustrations/pipelines_empty.svg', + emptyStateSvgPath: '/assets/illustrations/empty-state/empty-pipeline-md.svg', errorStateSvgPath: '/assets/illustrations/pipelines_failed.svg', noPipelinesSvgPath: '/assets/illustrations/pipelines_pending.svg', }; diff --git a/spec/frontend/super_sidebar/components/help_center_spec.js b/spec/frontend/super_sidebar/components/help_center_spec.js index b48d4469362..808c30436a3 100644 --- a/spec/frontend/super_sidebar/components/help_center_spec.js +++ b/spec/frontend/super_sidebar/components/help_center_spec.js @@ -4,7 +4,7 @@ import toggleWhatsNewDrawer from '~/whats_new'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import HelpCenter from '~/super_sidebar/components/help_center.vue'; import { helpPagePath } from '~/helpers/help_page_helper'; -import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; +import { DOMAIN, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { STORAGE_KEY } from '~/whats_new/utils/notification'; import { helpCenterState } from '~/super_sidebar/constants'; @@ -52,7 +52,7 @@ describe('HelpCenter component', () => { }, { text: HelpCenter.i18n.docs, - href: 'https://docs.gitlab.com', + href: `https://docs.${DOMAIN}`, extraAttrs: trackingAttrs('gitlab_documentation'), }, { @@ -62,7 +62,7 @@ describe('HelpCenter component', () => { }, { text: HelpCenter.i18n.forum, - href: 'https://forum.gitlab.com/', + href: `https://forum.${DOMAIN}/`, extraAttrs: trackingAttrs('community_forum'), }, { @@ -72,7 +72,7 @@ describe('HelpCenter component', () => { }, { text: HelpCenter.i18n.feedback, - href: 'https://about.gitlab.com/submit-feedback', + href: `${PROMO_URL}/submit-feedback`, extraAttrs: trackingAttrs('submit_feedback'), }, ]; |