diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-16 21:09:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-16 21:09:02 +0000 |
commit | b9033ad4157010ccd8f37437de131ed70af90f45 (patch) | |
tree | 7d10ebd824040aabc585273e07dec6ebde64730f /spec/frontend | |
parent | 6d9c4dc2ef4c63bee8e9ca095dc2f0ed683a34f5 (diff) | |
download | gitlab-ce-b9033ad4157010ccd8f37437de131ed70af90f45.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
3 files changed, 33 insertions, 10 deletions
diff --git a/spec/frontend/alerts_settings/__snapshots__/alerts_settings_form_new_spec.js.snap b/spec/frontend/alerts_settings/__snapshots__/alerts_settings_form_new_spec.js.snap index e4ef232a320..815aa430d87 100644 --- a/spec/frontend/alerts_settings/__snapshots__/alerts_settings_form_new_spec.js.snap +++ b/spec/frontend/alerts_settings/__snapshots__/alerts_settings_form_new_spec.js.snap @@ -80,10 +80,10 @@ exports[`AlertsSettingsFormNew with default values renders the initial template <!----> <!----> <!----> - <!----> </div> </div> <!----> + <!----> </div> <div class=\\"gl-display-flex gl-justify-content-end\\"><button type=\\"reset\\" class=\\"btn gl-mr-3 js-no-auto-disable btn-default btn-md gl-button\\"> <!----> diff --git a/spec/frontend/alerts_settings/alerts_settings_form_new_spec.js b/spec/frontend/alerts_settings/alerts_settings_form_new_spec.js index 539ea5676ef..fbd482b1906 100644 --- a/spec/frontend/alerts_settings/alerts_settings_form_new_spec.js +++ b/spec/frontend/alerts_settings/alerts_settings_form_new_spec.js @@ -6,14 +6,15 @@ import { GlFormInput, GlToggle, GlFormTextarea, - GlButton, } from '@gitlab/ui'; +import waitForPromises from 'helpers/wait_for_promises'; import AlertsSettingsForm from '~/alerts_settings/components/alerts_settings_form_new.vue'; import { defaultAlertSettingsConfig } from './util'; import { typeSet } from '~/alerts_settings/constants'; describe('AlertsSettingsFormNew', () => { let wrapper; + const mockToastShow = jest.fn(); const createComponent = ({ data = {}, @@ -34,6 +35,11 @@ describe('AlertsSettingsFormNew', () => { glFeatures: { multipleHttpIntegrationsCustomMapping }, ...defaultAlertSettingsConfig, }, + mocks: { + $toast: { + show: mockToastShow, + }, + }, }); }; @@ -49,6 +55,7 @@ describe('AlertsSettingsFormNew', () => { wrapper.find(`[data-testid="multi-integrations-not-supported"]`); const findJsonTestSubmit = () => wrapper.find(`[data-testid="integration-test-and-submit"]`); const findJsonTextArea = () => wrapper.find(`[id = "test-payload"]`); + const findActionBtn = () => wrapper.find(`[data-testid="payload-action-btn"]`); afterEach(() => { if (wrapper) { @@ -307,12 +314,28 @@ describe('AlertsSettingsFormNew', () => { resetSamplePayloadConfirmed, }); await wrapper.vm.$nextTick(); - expect( - findTestPayloadSection() - .find(GlButton) - .text(), - ).toBe(caption); + expect(findActionBtn().text()).toBe(caption); + }); + }); + }); + + describe('Parsing payload', () => { + it('displays a toast message on successful parse', async () => { + jest.useFakeTimers(); + wrapper.setData({ + selectedIntegration: typeSet.http, + customMapping: { samplePayload: false }, }); + await wrapper.vm.$nextTick(); + + findActionBtn().vm.$emit('click'); + jest.advanceTimersByTime(1000); + + await waitForPromises(); + + expect(mockToastShow).toHaveBeenCalledWith( + 'Sample payload has been parsed. You can now map the fields.', + ); }); }); }); diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js index 7f0ff534db3..8fcee80a2d8 100644 --- a/spec/frontend/monitoring/components/charts/time_series_spec.js +++ b/spec/frontend/monitoring/components/charts/time_series_spec.js @@ -226,7 +226,7 @@ describe('Time series component', () => { ]); expect( - shallowWrapperContainsSlotText(wrapper.find(GlLineChart), 'tooltipContent', value), + shallowWrapperContainsSlotText(wrapper.find(GlLineChart), 'tooltip-content', value), ).toBe(true); }); @@ -651,7 +651,7 @@ describe('Time series component', () => { return wrapper.vm.$nextTick(() => { expect( - shallowWrapperContainsSlotText(findChartComponent(), 'tooltipTitle', mockTitle), + shallowWrapperContainsSlotText(findChartComponent(), 'tooltip-title', mockTitle), ).toBe(true); }); }); @@ -671,7 +671,7 @@ describe('Time series component', () => { it('uses deployment title', () => { expect( - shallowWrapperContainsSlotText(findChartComponent(), 'tooltipTitle', 'Deployed'), + shallowWrapperContainsSlotText(findChartComponent(), 'tooltip-title', 'Deployed'), ).toBe(true); }); |