From 301af1448b10dad646eefbdd345920bb6c8e501d Mon Sep 17 00:00:00 2001 From: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Date: Thu, 15 Dec 2022 21:26:12 +0530 Subject: [PATCH] fix(ui): cypress failure for webhook, slack, msteams (#9315) --- .../constants/redirections.constants.js | 12 -- .../ui/cypress/e2e/Pages/MSTeams.spec.js | 99 ----------------- .../ui/cypress/e2e/Pages/Slack.spec.js | 98 ----------------- .../ui/cypress/e2e/Pages/Webhooks.spec.js | 103 ------------------ 4 files changed, 312 deletions(-) delete mode 100644 openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/MSTeams.spec.js delete mode 100644 openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Slack.spec.js delete mode 100644 openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Webhooks.spec.js diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/redirections.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/redirections.constants.js index 89b755f6c45..ac3ce0a75b0 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/redirections.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/redirections.constants.js @@ -163,18 +163,6 @@ export const SETTINGS_LEFT_PANEL = { testid: '[data-menu-id*="elasticsearch"]', url: `${BASE_URL}/settings/eventPublishers/elasticsearch`, }, - webhooks: { - testid: '[data-menu-id*="webhook"]', - url: `${BASE_URL}/settings/integrations/webhook`, - }, - slack: { - testid: '[data-menu-id*="slack"]', - url: `${BASE_URL}/settings/integrations/slack`, - }, - msTeams: { - testid: '[data-menu-id*="msTeams"]', - url: `${BASE_URL}/settings/integrations/msTeams`, - }, bots: { testid: '[data-menu-id*="bots"]', url: `${BASE_URL}/settings/integrations/bots`, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/MSTeams.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/MSTeams.spec.js deleted file mode 100644 index 79a34ec0a48..00000000000 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/MSTeams.spec.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2021 Collate - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common'; - - -const MSteamName = `MSTeam-ct-test-${uuid()}`; -const updatedDescription = 'This is updated slack description'; -const endpointURL = 'http://localhost:8585'; - -describe('MSTeams Page', () => { - beforeEach(() => { - cy.login(); - - cy.get('[data-testid="appbar-item-settings"]') - .should('exist') - .should('be.visible') - .click(); - - cy.get('[data-testid="settings-left-panel"]') - .contains('MS Teams') - .scrollIntoView() - .should('be.visible') - .click(); - }); - - it('Add MSTeams', () => { - interceptURL('GET', '/api/v1/settings/bootstrappedFilters', 'addMSTeam'); - cy.get('[data-testid="add-webhook-button"]') - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@addMSTeam', 200); - cy.get('[data-testid="name"]').should('exist').type(MSteamName); - cy.get(descriptionBox).should('exist').type('This is MSTeams description'); - cy.get('[data-testid="endpoint-url"]') - .should('exist') - .type('http://localhost:8585/add-webhook/msteams'); - - interceptURL('POST', 'api/v1/webhook', 'createMSTeam'); - cy.get('[data-testid="save-webhook"]') - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@createMSTeam', 201); - cy.get('[data-testid="webhook-link"]') - .should('be.visible') - .should('exist') - .should('contain', MSteamName); - }); - - it('Edit MSTeams description', () => { - interceptURL('GET', `/api/v1/webhook/name/${MSteamName}`, 'editSlack'); - cy.get(`[data-testid="edit-action-${MSteamName}"]`) - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@editSlack', 200); - cy.get(descriptionBox).clear().type(updatedDescription); - cy.get('[data-testid="endpoint-url"]').clear().type(endpointURL); - interceptURL('PUT', '/api/v1/webhook', 'updateDescription'); - cy.get('[data-testid="save-webhook"]') - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@updateDescription', 200); - cy.get('[data-testid="viewer-container"]').should( - 'contain', - updatedDescription - ); - }); - - it('Delete MSTeams', () => { - cy.get(`[data-testid="delete-action-${MSteamName}"]`) - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - - interceptURL('DELETE', '/api/v1/webhook/*', 'deleteSlack'); - cy.get('[data-testid="save-button"]') - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@deleteSlack', 200); - cy.get('table').should('not.contain', MSteamName); - }); -}); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Slack.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Slack.spec.js deleted file mode 100644 index 0e069149fd3..00000000000 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Slack.spec.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2021 Collate - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common'; - -const slackName = `Slack-ct-test-${uuid()}`; -const updatedDescription = 'This is updated slack description'; -const endpointURL = 'http://localhost:8585'; - -describe('Slack Page', () => { - beforeEach(() => { - cy.login(); - - cy.get('[data-testid="appbar-item-settings"]') - .should('exist') - .should('be.visible') - .click(); - - cy.get('[data-testid="settings-left-panel"]') - .contains('Slack') - .scrollIntoView() - .should('be.visible') - .click(); - }); - - it('Add slack', () => { - interceptURL('GET', '/api/v1/settings/bootstrappedFilters', 'addSlack'); - cy.get('[data-testid="add-webhook-button"]') - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@addSlack', 200); - cy.get('[data-testid="name"]').should('exist').type(slackName); - cy.get(descriptionBox).should('exist').type('This is slack description'); - cy.get('[data-testid="endpoint-url"]') - .should('exist') - .type('http://localhost:8585/add-webhook/slack'); - - interceptURL('POST', 'api/v1/webhook', 'createWebhook'); - cy.get('[data-testid="save-webhook"]') - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@createWebhook', 201); - cy.get('[data-testid="webhook-link"]') - .should('be.visible') - .should('exist') - .should('contain', slackName); - }); - - it('Edit Slack description', () => { - interceptURL('GET', `/api/v1/webhook/name/${slackName}`, 'editSlack'); - cy.get(`[data-testid="edit-action-${slackName}"]`) - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@editSlack', 200); - cy.get(descriptionBox).clear().type(updatedDescription); - cy.get('[data-testid="endpoint-url"]').clear().type(endpointURL); - interceptURL('PUT', '/api/v1/webhook', 'updateDescription'); - cy.get('[data-testid="save-webhook"]') - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@updateDescription', 200); - cy.get('[data-testid="viewer-container"]').should( - 'contain', - updatedDescription - ); - }); - - it('Delete Slack', () => { - cy.get(`[data-testid="delete-action-${slackName}"]`) - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - - interceptURL('DELETE', '/api/v1/webhook/*', 'deleteSlack'); - cy.get('[data-testid="save-button"]') - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@deleteSlack', 200); - cy.get('table').should('not.contain', slackName); - }); -}); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Webhooks.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Webhooks.spec.js deleted file mode 100644 index 03eb0c3c408..00000000000 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Webhooks.spec.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2021 Collate - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common'; - - -const webhookName = `Webhook-ct-test-${uuid()}`; -const updatedDescription = 'This is updated webhook description'; -const endpointURL = 'http://localhost:8585'; - -describe('Webooks Page', () => { - beforeEach(() => { - cy.login(); - - cy.get('[data-testid="appbar-item-settings"]') - .should('exist') - .should('be.visible') - .click(); - - cy.get('[data-testid="settings-left-panel"]') - .contains('Webhook') - .scrollIntoView() - .should('be.visible') - .click(); - }); - - it('Add webhook', () => { - interceptURL('GET', '/api/v1/settings/bootstrappedFilters', 'addWebhook'); - cy.get('[data-testid="add-webhook-button"]') - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@addWebhook', 200); - cy.get('[data-testid="name"]').should('exist').type(webhookName); - cy.get(descriptionBox).should('exist').type('This is webhook description'); - cy.get('[data-testid="endpoint-url"]') - .should('exist') - .type('http://localhost:8585/add-webhook'); - - interceptURL('POST', 'api/v1/webhook', 'createWebhook'); - cy.get('[data-testid="save-webhook"]') - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@createWebhook', 201); - cy.get('[data-testid="webhook-link"]') - .should('be.visible') - .should('exist') - .should('contain', webhookName); - }); - - it('Edit Webhook description', () => { - interceptURL('GET', `/api/v1/webhook/name/${webhookName}`, 'editWebhook'); - cy.get(`[data-testid="edit-action-${webhookName}"]`) - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@editWebhook', 200); - cy.get(descriptionBox).should('exist').clear().type(updatedDescription); - cy.get('[data-testid="endpoint-url"]') - .should('exist') - .clear() - .type(endpointURL); - interceptURL('PUT', '/api/v1/webhook', 'updateDescription'); - cy.get('[data-testid="save-webhook"]') - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@updateDescription', 200); - //uncomment this code once webhook description issue is fixed - // cy.get('[data-testid="viewer-container"]').should( - // 'contain', - // updatedDescription - // ); - }); - - it('Delete webhook', () => { - cy.get(`[data-testid="delete-action-${webhookName}"]`) - .scrollIntoView() - .should('exist') - .should('be.visible') - .click(); - - interceptURL('DELETE', '/api/v1/webhook/*', 'deleteWebhook'); - cy.get('[data-testid="save-button"]') - .should('exist') - .should('be.visible') - .click(); - verifyResponseStatusCode('@deleteWebhook', 200); - cy.get('table').should('not.contain', webhookName); - }); -});