diff --git a/frontend/cypress/e2e/crud.cy.ts b/frontend/cypress/e2e/crud.cy.ts index bbe1dec6cc..b96a31a9c1 100644 --- a/frontend/cypress/e2e/crud.cy.ts +++ b/frontend/cypress/e2e/crud.cy.ts @@ -49,8 +49,7 @@ describe('CRUD operations', () => { it(`Delete existing objective`, () => { cy.get('.objective').first().getByTestId('three-dot-menu').click(); - cy.get('.mat-mdc-menu-content').contains('Objective bearbeiten').click(); - cy.getByTestId('delete').click(); + cy.get('.mat-mdc-menu-content').contains('Objective löschen').click(); cy.get("button[type='submit']").contains('Ja').click(); }); diff --git a/frontend/cypress/e2e/objective.cy.ts b/frontend/cypress/e2e/objective.cy.ts index afca9c4c76..195115deff 100644 --- a/frontend/cypress/e2e/objective.cy.ts +++ b/frontend/cypress/e2e/objective.cy.ts @@ -1,5 +1,6 @@ import * as users from '../fixtures/users.json'; import { onlyOn } from '@cypress/skip-test'; +import { wait } from 'cypress-real-events/utils'; describe('OKR Objective e2e tests', () => { describe('tests via click', () => { @@ -68,6 +69,25 @@ describe('OKR Objective e2e tests', () => { .getByTestId('objective-state') .should('have.attr', 'src', `assets/icons/successful-icon.svg`); }); + it('delete objective with success', () => { + cy.getByTestId('add-objective').first().click({ force: true }); + cy.fillOutObjective('We want to delete this objective', 'safe', undefined, '', false); + cy.getByTestId('objective') + .filter(':contains("We want to delete this objective")') + .last() + .getByTestId('three-dot-menu') + .click({ force: true }) + .get('.objective-menu-option') + .contains('Objective löschen') + .click({ force: true }); + wait(200); + cy.contains('Objective löschen'); + cy.contains( + 'Möchtest du dieses Objective wirklich löschen? Zugehörige Key Results werden dadurch ebenfalls gelöscht!', + ); + cy.getByTestId('confirm-yes').click({ force: true }); + cy.get('We want to delete this objective').should('not.exist'); + }); it(`Complete Objective with Not-Successful`, () => { cy.getByTestId('add-objective').first().click(); diff --git a/frontend/cypress/e2e/tab.cy.ts b/frontend/cypress/e2e/tab.cy.ts index 343f1b979d..8f52190c57 100644 --- a/frontend/cypress/e2e/tab.cy.ts +++ b/frontend/cypress/e2e/tab.cy.ts @@ -274,22 +274,19 @@ describe('Tab workflow tests', () => { createNewObjectiveWithTab(); }); - it('Delete objective with tab', () => { + it.only('Delete objective with tab', () => { createNewObjectiveWithTab(); cy.wait(500); cy.get('.objective').last().focus(); cy.tabForwardUntil('[data-testId="three-dot-menu"]'); cy.focused().realPress('Enter'); - cy.focused().contains('Objective bearbeiten'); + cy.realPress('ArrowDown'); + cy.realPress('ArrowDown'); + cy.realPress('ArrowDown'); + cy.realPress('ArrowDown'); + cy.focused().contains('Objective löschen'); cy.realPress('Enter'); - cy.contains('bearbeiten'); - cy.tabForwardUntil('[data-testId="delete"]'); - cy.focused().contains('Objective Löschen'); - cy.realPress('Enter'); - cy.wait(500); - cy.tabForward(); - cy.contains('Objective löschen'); - cy.focused().contains('Ja'); + cy.tabForwardUntil('[data-testId="confirm-yes"]'); cy.realPress('Enter'); }); @@ -328,10 +325,7 @@ describe('Tab workflow tests', () => { cy.wait(500); cy.tabForwardUntil('[data-testId="edit-keyResult"]'); cy.focused().contains('Key Result bearbeiten'); - cy.realPress('Enter'); - cy.wait(500); - cy.tabForwardUntil('[data-testId="delete-keyResult"]'); - cy.focused().contains('Key Result löschen'); + cy.realPress('Enter'); cy.wait(500); cy.tabForward();