diff options
Diffstat (limited to 'spec/frontend/pages/projects')
4 files changed, 67 insertions, 3 deletions
diff --git a/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap b/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap index 43361bb6f24..21a38f066d9 100644 --- a/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap +++ b/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap @@ -3,6 +3,33 @@ exports[`Code Coverage when fetching data is successful matches the snapshot 1`] = ` <div> <div + class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-border-t gl-pt-4 gl-mb-3" + > + <h4 + class="gl-m-0" + sub-header="" + > + <gl-sprintf-stub + message="Code coverage statistics for %{ref} %{start_date} - %{end_date}" + /> + </h4> + + <gl-button-stub + buttontextclasses="" + category="primary" + data-testid="download-button" + href="url/" + icon="" + size="small" + variant="default" + > + + Download raw data (.csv) + + </gl-button-stub> + </div> + + <div class="gl-mt-3 gl-mb-3" > <!----> @@ -79,6 +106,7 @@ exports[`Code Coverage when fetching data is successful matches the snapshot 1`] legendmaxtext="Max" legendmintext="Min" option="[object Object]" + responsive="" thresholds="" /> </div> diff --git a/spec/frontend/pages/projects/graphs/code_coverage_spec.js b/spec/frontend/pages/projects/graphs/code_coverage_spec.js index 0f763e3220a..f272891919d 100644 --- a/spec/frontend/pages/projects/graphs/code_coverage_spec.js +++ b/spec/frontend/pages/projects/graphs/code_coverage_spec.js @@ -15,17 +15,26 @@ describe('Code Coverage', () => { let mockAxios; const graphEndpoint = '/graph'; + const graphStartDate = '13 February'; + const graphEndDate = '12 May'; + const graphRef = 'master'; + const graphCsvPath = 'url/'; const findAlert = () => wrapper.find(GlAlert); const findAreaChart = () => wrapper.find(GlAreaChart); const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem); const findFirstDropdownItem = () => findAllDropdownItems().at(0); const findSecondDropdownItem = () => findAllDropdownItems().at(1); + const findDownloadButton = () => wrapper.find('[data-testid="download-button"]'); const createComponent = () => { wrapper = shallowMount(CodeCoverage, { propsData: { graphEndpoint, + graphStartDate, + graphEndDate, + graphRef, + graphCsvPath, }, }); }; @@ -64,6 +73,10 @@ describe('Code Coverage', () => { it('shows no error messages', () => { expect(findAlert().exists()).toBe(false); }); + + it('does not render download button', () => { + expect(findDownloadButton().exists()).toBe(true); + }); }); describe('when fetching data fails', () => { @@ -112,6 +125,10 @@ describe('Code Coverage', () => { it('still renders an empty graph', () => { expect(findAreaChart().exists()).toBe(true); }); + + it('does not render download button', () => { + expect(findDownloadButton().exists()).toBe(false); + }); }); describe('dropdown options', () => { @@ -146,8 +163,8 @@ describe('Code Coverage', () => { await nextTick(); - expect(findFirstDropdownItem().attributes('ischecked')).toBeFalsy(); - expect(findSecondDropdownItem().attributes('ischecked')).toBeTruthy(); + expect(findFirstDropdownItem().attributes('ischecked')).toBe(undefined); + expect(findSecondDropdownItem().attributes('ischecked')).toBe('true'); }); it('updates the graph data when selecting a different option in dropdown', async () => { diff --git a/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js b/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js index 42eeff89bf4..5b9c48f0d9b 100644 --- a/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js +++ b/spec/frontend/pages/projects/pipeline_schedules/shared/components/timezone_dropdown_spec.js @@ -226,7 +226,6 @@ describe('Timezone Dropdown', () => { it('returns the correct object if the identifier exists', () => { const res = findTimezoneByIdentifier(tzList, identifier); - expect(res).toBeTruthy(); expect(res).toBe(tzList[2]); }); diff --git a/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js b/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js index 85660d09baa..f908508c4b5 100644 --- a/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js +++ b/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js @@ -127,6 +127,7 @@ describe('Settings Panel', () => { const findOperationsVisibilityInput = () => findOperationsSettings().findComponent(ProjectFeatureSetting); const findConfirmDangerButton = () => wrapper.findComponent(ConfirmDanger); + const findEnvironmentsSettings = () => wrapper.findComponent({ ref: 'environments-settings' }); afterEach(() => { wrapper.destroy(); @@ -786,4 +787,23 @@ describe('Settings Panel', () => { expect(findOperationsSettings().exists()).toBe(true); }); }); + + describe('Environments', () => { + describe('with feature flag', () => { + it('should show the environments toggle', () => { + wrapper = mountComponent({ + glFeatures: { splitOperationsVisibilityPermissions: true }, + }); + + expect(findEnvironmentsSettings().exists()).toBe(true); + }); + }); + describe('without feature flag', () => { + it('should not show the environments toggle', () => { + wrapper = mountComponent({}); + + expect(findEnvironmentsSettings().exists()).toBe(false); + }); + }); + }); }); |