diff --git a/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts index 7a08611497354..32cc6d2cb8826 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts @@ -37,6 +37,7 @@ describe('Datasource control', () => { cy.get('#datasource_menu').click(); cy.get('a').contains('Edit Datasource').click(); // create new metric + cy.get('a[role="tab"]').contains('Metrics').click(); cy.get('button').contains('Add Item').click(); cy.get('input[value=""]').click(); cy.get('input[value=""]') @@ -53,6 +54,7 @@ describe('Datasource control', () => { // delete metric cy.get('#datasource_menu').click(); cy.get('a').contains('Edit Datasource').click(); + cy.get('a[role="tab"]').contains('Metrics').click(); cy.get(`input[value="${newMetricName}"]`) .closest('tr') .find('.fa-trash') diff --git a/superset-frontend/spec/javascripts/datasource/DatasourceModal_spec.jsx b/superset-frontend/spec/javascripts/datasource/DatasourceModal_spec.jsx index dde67f9d52390..aa5171f84a564 100644 --- a/superset-frontend/spec/javascripts/datasource/DatasourceModal_spec.jsx +++ b/superset-frontend/spec/javascripts/datasource/DatasourceModal_spec.jsx @@ -60,12 +60,10 @@ async function mountAndWait(props = mockedProps) { } describe('DatasourceModal', () => { - fetchMock.post(SAVE_ENDPOINT, SAVE_PAYLOAD); - const callsP = fetchMock.put(SAVE_ENDPOINT, SAVE_PAYLOAD); - let wrapper; beforeEach(async () => { + fetchMock.reset(); wrapper = await mountAndWait(); }); @@ -82,6 +80,7 @@ describe('DatasourceModal', () => { }); it('saves on confirm', async () => { + const callsP = fetchMock.post(SAVE_ENDPOINT, SAVE_PAYLOAD); act(() => { wrapper .find('button[data-test="datasource-modal-save"]') @@ -94,6 +93,9 @@ describe('DatasourceModal', () => { okButton.simulate('click'); }); await waitForComponentToPaint(wrapper); - expect(callsP._calls).toHaveLength(2); /* eslint no-underscore-dangle: 0 */ + const expected = ['http://localhost/datasource/save/']; + expect(callsP._calls.map(call => call[0])).toEqual( + expected, + ); /* eslint no-underscore-dangle: 0 */ }); });