diff options
Diffstat (limited to 'spec/frontend/jobs')
8 files changed, 33 insertions, 12 deletions
diff --git a/spec/frontend/jobs/components/artifacts_block_spec.js b/spec/frontend/jobs/components/artifacts_block_spec.js index 11bd645916e..a709a59cadd 100644 --- a/spec/frontend/jobs/components/artifacts_block_spec.js +++ b/spec/frontend/jobs/components/artifacts_block_spec.js @@ -8,7 +8,10 @@ describe('Artifacts block', () => { const createWrapper = propsData => mount(ArtifactsBlock, { - propsData, + propsData: { + helpUrl: 'help-url', + ...propsData, + }, }); const findArtifactRemoveElt = () => wrapper.find('[data-testid="artifacts-remove-timeline"]'); @@ -68,6 +71,12 @@ describe('Artifacts block', () => { expect(trimText(findArtifactRemoveElt().text())).toBe( `The artifacts were removed ${formattedDate}`, ); + + expect( + findArtifactRemoveElt() + .find('[data-testid="artifact-expired-help-link"]') + .attributes('href'), + ).toBe('help-url'); }); it('does not show the keep button', () => { @@ -94,6 +103,12 @@ describe('Artifacts block', () => { expect(trimText(findArtifactRemoveElt().text())).toBe( `The artifacts will be removed ${formattedDate}`, ); + + expect( + findArtifactRemoveElt() + .find('[data-testid="artifact-expired-help-link"]') + .attributes('href'), + ).toBe('help-url'); }); it('renders the keep button', () => { diff --git a/spec/frontend/jobs/components/job_app_spec.js b/spec/frontend/jobs/components/job_app_spec.js index e9ecafcd4c3..94653d4d4c7 100644 --- a/spec/frontend/jobs/components/job_app_spec.js +++ b/spec/frontend/jobs/components/job_app_spec.js @@ -33,6 +33,7 @@ describe('Job App', () => { }; const props = { + artifactHelpUrl: 'help/artifact', runnerHelpUrl: 'help/runner', deploymentHelpUrl: 'help/deployment', runnerSettingsUrl: 'settings/ci-cd/runners', diff --git a/spec/frontend/jobs/components/log/collapsible_section_spec.js b/spec/frontend/jobs/components/log/collapsible_section_spec.js index bf2f8c05806..66f22162c97 100644 --- a/spec/frontend/jobs/components/log/collapsible_section_spec.js +++ b/spec/frontend/jobs/components/log/collapsible_section_spec.js @@ -35,7 +35,7 @@ describe('Job Log Collapsible Section', () => { }); it('renders an icon with the closed state', () => { - expect(findCollapsibleLineSvg().classes()).toContain('ic-angle-right'); + expect(findCollapsibleLineSvg().attributes('data-testid')).toBe('angle-right-icon'); }); }); @@ -52,7 +52,7 @@ describe('Job Log Collapsible Section', () => { }); it('renders an icon with the open state', () => { - expect(findCollapsibleLineSvg().classes()).toContain('ic-angle-down'); + expect(findCollapsibleLineSvg().attributes('data-testid')).toBe('angle-down-icon'); }); it('renders collapsible lines content', () => { diff --git a/spec/frontend/jobs/components/log/line_header_spec.js b/spec/frontend/jobs/components/log/line_header_spec.js index 5ce69221dab..bb90949b1f4 100644 --- a/spec/frontend/jobs/components/log/line_header_spec.js +++ b/spec/frontend/jobs/components/log/line_header_spec.js @@ -38,7 +38,7 @@ describe('Job Log Header Line', () => { }); it('renders the line number component', () => { - expect(wrapper.contains(LineNumber)).toBe(true); + expect(wrapper.find(LineNumber).exists()).toBe(true); }); it('renders a span the provided text', () => { @@ -90,7 +90,7 @@ describe('Job Log Header Line', () => { }); it('renders the duration badge', () => { - expect(wrapper.contains(DurationBadge)).toBe(true); + expect(wrapper.find(DurationBadge).exists()).toBe(true); }); }); }); diff --git a/spec/frontend/jobs/components/log/line_spec.js b/spec/frontend/jobs/components/log/line_spec.js index ec3a3968f14..c2412a807c3 100644 --- a/spec/frontend/jobs/components/log/line_spec.js +++ b/spec/frontend/jobs/components/log/line_spec.js @@ -35,7 +35,7 @@ describe('Job Log Line', () => { }); it('renders the line number component', () => { - expect(wrapper.contains(LineNumber)).toBe(true); + expect(wrapper.find(LineNumber).exists()).toBe(true); }); it('renders a span the provided text', () => { diff --git a/spec/frontend/jobs/components/log/log_spec.js b/spec/frontend/jobs/components/log/log_spec.js index 02cdb31d27e..015d5e01a46 100644 --- a/spec/frontend/jobs/components/log/log_spec.js +++ b/spec/frontend/jobs/components/log/log_spec.js @@ -42,6 +42,8 @@ describe('Job Log', () => { wrapper.destroy(); }); + const findCollapsibleLine = () => wrapper.find('.collapsible-line'); + describe('line numbers', () => { it('renders a line number for each open line', () => { expect(wrapper.find('#L1').text()).toBe('1'); @@ -56,18 +58,22 @@ describe('Job Log', () => { describe('collapsible sections', () => { it('renders a clickable header section', () => { - expect(wrapper.find('.collapsible-line').attributes('role')).toBe('button'); + expect(findCollapsibleLine().attributes('role')).toBe('button'); }); it('renders an icon with the open state', () => { - expect(wrapper.find('.collapsible-line svg').classes()).toContain('ic-angle-down'); + expect( + findCollapsibleLine() + .find('[data-testid="angle-down-icon"]') + .exists(), + ).toBe(true); }); describe('on click header section', () => { it('calls toggleCollapsibleLine', () => { jest.spyOn(wrapper.vm, 'toggleCollapsibleLine'); - wrapper.find('.collapsible-line').trigger('click'); + findCollapsibleLine().trigger('click'); expect(wrapper.vm.toggleCollapsibleLine).toHaveBeenCalled(); }); diff --git a/spec/frontend/jobs/components/manual_variables_form_spec.js b/spec/frontend/jobs/components/manual_variables_form_spec.js index 82fd73ef033..547f146cf88 100644 --- a/spec/frontend/jobs/components/manual_variables_form_spec.js +++ b/spec/frontend/jobs/components/manual_variables_form_spec.js @@ -1,5 +1,5 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; -import { GlDeprecatedButton } from '@gitlab/ui'; +import { GlButton } from '@gitlab/ui'; import Form from '~/jobs/components/manual_variables_form.vue'; const localVue = createLocalVue(); @@ -95,7 +95,7 @@ describe('Manual Variables Form', () => { }); it('removes the variable row', () => { - wrapper.find(GlDeprecatedButton).vm.$emit('click'); + wrapper.find(GlButton).vm.$emit('click'); expect(wrapper.vm.variables.length).toBe(0); }); diff --git a/spec/frontend/jobs/store/helpers.js b/spec/frontend/jobs/store/helpers.js index 81a769b4a6e..78e33394b63 100644 --- a/spec/frontend/jobs/store/helpers.js +++ b/spec/frontend/jobs/store/helpers.js @@ -1,6 +1,5 @@ import state from '~/jobs/store/state'; -// eslint-disable-next-line import/prefer-default-export export const resetStore = store => { store.replaceState(state()); }; |