Skip to content

Commit

Permalink
add test to test delete action
Browse files Browse the repository at this point in the history
  • Loading branch information
nevio18324 committed Nov 7, 2024
1 parent 4f75641 commit 1ccacfc
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 16 deletions.
3 changes: 1 addition & 2 deletions frontend/cypress/e2e/crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
20 changes: 20 additions & 0 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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').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();
Expand Down
22 changes: 8 additions & 14 deletions frontend/cypress/e2e/tab.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down Expand Up @@ -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();
Expand Down
141 changes: 141 additions & 0 deletions frontend/src/app/components/team/team.component.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1ccacfc

Please sign in to comment.