From 47fab5406c8406891315ac27beab1f2fbe43b0a1 Mon Sep 17 00:00:00 2001 From: lgalis Date: Wed, 21 Aug 2024 16:14:56 -0400 Subject: [PATCH] Revert "[EDA] [SER] Event Stream tests" (#3023) --- .../eda/Credentials/credentials-crud.cy.ts | 27 ------- .../eda/Event-Streams/event-stream-list.cy.ts | 78 ------------------- .../Event-Streams/event-streams-crud.cy.ts | 74 ------------------ cypress/support/commands.d.ts | 22 ------ cypress/support/eda-commands.ts | 44 ----------- 5 files changed, 245 deletions(-) delete mode 100644 cypress/e2e/eda/Event-Streams/event-stream-list.cy.ts delete mode 100644 cypress/e2e/eda/Event-Streams/event-streams-crud.cy.ts diff --git a/cypress/e2e/eda/Credentials/credentials-crud.cy.ts b/cypress/e2e/eda/Credentials/credentials-crud.cy.ts index 2b7c8e9c2f..94ebae290b 100644 --- a/cypress/e2e/eda/Credentials/credentials-crud.cy.ts +++ b/cypress/e2e/eda/Credentials/credentials-crud.cy.ts @@ -121,31 +121,4 @@ cyLabel(['aaas-unsupported'], function () { }); }); }); - - it('get warning while deleting a credential already in use by an event stream', () => { - cy.createBasicWebhookCredential().then((credential) => { - cy.createBasicWebhook(credential).then((webhook) => { - cy.log('name', credential); - cy.navigateTo('eda', 'credentials'); - cy.verifyPageTitle('Credentials'); - cy.clickTableRow(credential.name); - cy.intercept('DELETE', edaAPI`/eda-credentials/${credential.id.toString()}/?force=true`).as( - 'deleted' - ); - cy.verifyPageTitle(credential.name); - cy.clickPageAction('delete-credential'); - cy.clickModalConfirmCheckbox(); - cy.get('.pf-v5-c-alert__title').contains( - `The following credentials are in use: ${credential.name}` - ); - cy.clickModalButton('Delete credential'); - cy.wait('@deleted').then((deleted) => { - expect(deleted?.response?.statusCode).to.eql(204); - cy.verifyPageTitle('Credentials'); - }); - cy.deleteWebhook(webhook); - cy.deleteEdaCredential(credential); - }); - }); - }); }); diff --git a/cypress/e2e/eda/Event-Streams/event-stream-list.cy.ts b/cypress/e2e/eda/Event-Streams/event-stream-list.cy.ts deleted file mode 100644 index f2d32c3bb4..0000000000 --- a/cypress/e2e/eda/Event-Streams/event-stream-list.cy.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/// - -import { edaAPI } from '../../../support/formatApiPathForEDA'; -import { EdaWebhook } from '../../../../frontend/eda/interfaces/EdaWebhook'; -import { EdaCredential } from '../../../../frontend/eda/interfaces/EdaCredential'; - -//Tests a user's ability to perform necessary actions on the Projects list in the EDA UI. -describe('Event Streams List', () => { - let EdaWebhook1: EdaWebhook; - let EdaWebhook2: EdaWebhook; - let EdaCredential: EdaCredential; - - before(() => { - cy.createBasicWebhookCredential().then((credential) => { - EdaCredential = credential; - cy.createBasicWebhook(credential).then((webhook) => { - EdaWebhook1 = webhook; - }); - cy.createBasicWebhook(credential).then((webhook) => { - EdaWebhook2 = webhook; - }); - }); - }); - - after(() => { - cy.deleteWebhook(EdaWebhook1); - cy.deleteWebhook(EdaWebhook2); - cy.deleteEdaCredential(EdaCredential); - }); - - it('renders the Event Streams page and filter', () => { - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.filterTableByText(EdaWebhook1.name); - cy.get('td[data-cy=name-column-cell]').should('contain', EdaWebhook1.name); - cy.clickButton(/^Clear all filters$/); - cy.filterTableByText(EdaWebhook2.name); - cy.get('td[data-cy=name-column-cell]').should('contain', EdaWebhook2.name); - }); - - it('can switch the event stream to test mode from the list view', () => { - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.intercept('PATCH', edaAPI`/webhooks/${EdaWebhook1.id.toString()}/`).as('webhook1'); - cy.filterTableByText(EdaWebhook1.name); - cy.clickTableRowAction('name', EdaWebhook1.name, 'switch-to-test-mode', { - disableFilter: true, - inKebab: true, - }); - cy.wait('@webhook1').then((webhook1) => { - expect(webhook1?.response?.statusCode).to.eql(200); - }); - cy.clickButton(/^Clear all filters$/); - }); - - it('can bulk delete event streams', () => { - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.selectTableRow(EdaWebhook1.name, true); - cy.clickButton(/^Clear all filters$/); - cy.selectTableRow(EdaWebhook2.name, true); - cy.clickToolbarKebabAction('delete-selected-event-streams'); - cy.intercept('DELETE', edaAPI`/webhooks/${EdaWebhook1.id.toString()}/`).as('webhook1'); - cy.intercept('DELETE', edaAPI`/webhooks/${EdaWebhook2.id.toString()}/`).as('webhook2'); - cy.clickModalConfirmCheckbox(); - cy.clickModalButton('Delete event streams'); - cy.wait('@webhook1').then((webhook1) => { - expect(webhook1?.response?.statusCode).to.eql(204); - }); - cy.wait('@webhook2').then((webhook2) => { - expect(webhook2?.response?.statusCode).to.eql(204); - }); - cy.assertModalSuccess(); - cy.clickButton(/^Close$/); - cy.clickButton(/^Clear all filters$/); - }); -}); diff --git a/cypress/e2e/eda/Event-Streams/event-streams-crud.cy.ts b/cypress/e2e/eda/Event-Streams/event-streams-crud.cy.ts deleted file mode 100644 index 85edb7ee39..0000000000 --- a/cypress/e2e/eda/Event-Streams/event-streams-crud.cy.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/// - -//Tests a user's ability to create, edit, and delete a Project in the EDA UI. - -import { randomString } from '../../../../framework/utils/random-string'; -import { EdaCredential } from '../../../../frontend/eda/interfaces/EdaCredential'; - -describe('Event Streams CRUD', () => { - let edaCredential: EdaCredential; - const name = 'E2E Event Stream ' + randomString(4); - - before(() => { - cy.createBasicWebhookCredential().then((credential) => { - edaCredential = credential; - }); - }); - - after(() => { - cy.deleteEdaCredential(edaCredential); - }); - - it('can create an event stream, and assert the information showing on the details page', () => { - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.clickButton(/^Create event stream$/); - cy.getByDataCy('name').type(name); - cy.selectSingleSelectOption('[data-cy="webhook_type_id"]', 'Basic Webhook'); - cy.selectSingleSelectOption('[data-cy="credential_id"]', edaCredential.name); - cy.clickButton(/^Create event stream$/); - cy.verifyPageTitle(name); - cy.hasDetail('Name', name); - cy.hasDetail('Event stream type', 'basic'); - cy.hasDetail('Url', 'external_webhook'); - }); - - it('cannot create event stream without mandatory fields', () => { - const name = 'E2E Event Stream validation check' + randomString(4); - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.clickButton(/^Create event stream$/); - cy.getByDataCy('name').type(name); - cy.selectSingleSelectOption('[data-cy="webhook_type_id"]', 'Basic Webhook'); - cy.clickButton(/^Create event stream$/); - cy.contains(/^Credential is required.$/); - }); - - it('can edit an event stream', () => { - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.clickTableRow(name, true); - cy.verifyPageTitle(`${name}`); - cy.getByDataCy('edit-event-stream').click(); - cy.verifyPageTitle(`Edit ${name}`); - cy.getByDataCy('name') - .clear() - .type(name + ' edited'); - cy.clickButton(/^Save event stream$/); - cy.verifyPageTitle(`${name} edited`); - }); - - it('can delete an event stream', () => { - cy.navigateTo('eda', 'webhooks'); - cy.verifyPageTitle('Event Streams'); - cy.clickTableRow(`${name} edited`, true); - cy.verifyPageTitle(`${name} edited`); - cy.clickPageAction('delete-event-stream'); - cy.clickModalConfirmCheckbox(); - cy.clickModalButton('Delete event streams'); - cy.verifyPageTitle('Event Streams'); - cy.getTableRowByText(`${name} edited`, true); - cy.containsBy('.pf-v5-c-empty-state__title-text', 'No results found'); - }); -}); diff --git a/cypress/support/commands.d.ts b/cypress/support/commands.d.ts index 8b552adc26..6012325936 100644 --- a/cypress/support/commands.d.ts +++ b/cypress/support/commands.d.ts @@ -30,7 +30,6 @@ import { WorkflowJobTemplate } from '../../frontend/awx/interfaces/WorkflowJobTe import { WorkflowNode } from '../../frontend/awx/interfaces/WorkflowNode'; import { EdaControllerToken } from '../../frontend/eda/interfaces/EdaControllerToken'; import { EdaCredential } from '../../frontend/eda/interfaces/EdaCredential'; -import { EdaWebhook } from '../../frontend/eda/interfaces/EdaWebhook'; import { EdaCredentialType } from '../../frontend/eda/interfaces/EdaCredentialType'; import { EdaDecisionEnvironment } from '../../frontend/eda/interfaces/EdaDecisionEnvironment'; import { EdaProject } from '../../frontend/eda/interfaces/EdaProject'; @@ -1356,27 +1355,6 @@ declare global { */ createEdaCredential(): Chainable; - /** - * Creates an EDA credential of type Basic Webhook and returns the same. - * - * @returns {Chainable} - */ - createBasicWebhookCredential(): Chainable; - - /** - * Creates an Event Stream with the Basic Webhook type credential and returns the same. - * - * @returns {Chainable} - */ - createBasicWebhook(credential: EdaCredential): Chainable; - - /** - * Deletes the Event Stream which is provided. - * - * @returns {Chainable} - */ - deleteWebhook(Webhook: EdaWebhook): Chainable; - /** * Some of the Eda roles (Admin, Contributor etc) have resources * with more than 5 set of actions. this command helps in asserting diff --git a/cypress/support/eda-commands.ts b/cypress/support/eda-commands.ts index da6a2b1f11..f59108e356 100644 --- a/cypress/support/eda-commands.ts +++ b/cypress/support/eda-commands.ts @@ -9,7 +9,6 @@ import { EdaCredentialType, EdaCredentialTypeCreate, } from '../../frontend/eda/interfaces/EdaCredentialType'; -import { EdaWebhook, EdaWebhookCreate } from '../../frontend/eda/interfaces/EdaWebhook'; import { EdaDecisionEnvironment } from '../../frontend/eda/interfaces/EdaDecisionEnvironment'; import { EdaProject } from '../../frontend/eda/interfaces/EdaProject'; import { EdaResult } from '../../frontend/eda/interfaces/EdaResult'; @@ -293,49 +292,6 @@ Cypress.Commands.add('createEdaCredential', () => { }); }); -Cypress.Commands.add('createBasicWebhookCredential', () => { - cy.requestPost(edaAPI`/eda-credentials/`, { - name: 'E2E Basic Webhook Credential ' + randomString(4), - credential_type_id: 7, - description: 'This is a basic webhook credential', - inputs: { - username: 'username', - password: 'password', - }, - }).then((edaCredential) => { - Cypress.log({ - displayName: 'EDA CREDENTIAL CREATION :', - message: [`Created 👉 ${edaCredential.name}`], - }); - return edaCredential; - }); -}); - -Cypress.Commands.add('createBasicWebhook', (credential: EdaCredential) => { - cy.requestPost(edaAPI`/webhooks/`, { - name: 'E2E Basic Webhook ' + randomString(4), - webhook_type: 'basic', - eda_credential_id: credential.id, - }).then((Webhook) => { - Cypress.log({ - displayName: 'EDA WEBHOOK CREATION :', - message: [`Created 👉 ${Webhook.name}`], - }); - return Webhook; - }); -}); - -Cypress.Commands.add('deleteWebhook', (Webhook: EdaWebhook) => { - cy.requestDelete(edaAPI`/webhooks/${Webhook.id.toString()}/?force=true`, { - failOnStatusCode: false, - }).then(() => { - Cypress.log({ - displayName: 'EDA WEBHOOK DELETION :', - message: [`Deleted 👉 ${Webhook.name}`], - }); - }); -}); - Cypress.Commands.add('deleteEdaCredential', (credential: EdaCredential) => { cy.requestDelete(edaAPI`/eda-credentials/${credential.id.toString()}/?force=true`, { failOnStatusCode: false,