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 authored and kcinay055679 committed Nov 21, 2024
1 parent a1111e7 commit 5449a85
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 22 deletions.
32 changes: 27 additions & 5 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as users from '../fixtures/users.json';
import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage';
import ObjectiveDialog from '../support/helper/dom-helper/dialogs/objectiveDialog';
import ConfirmDialog from '../support/helper/dom-helper/dialogs/confirmDialog';
import { onlyOn } from '@cypress/skip-test';
import { wait } from 'cypress-real-events/utils';

describe('OKR Objective e2e tests', () => {
let op = new CyOverviewPage();
Expand Down Expand Up @@ -57,8 +56,31 @@ describe('OKR Objective e2e tests', () => {
cy.getByTestId('successful').click();
cy.getByTestId('submit').click();

op.getObjectiveByNameAndState('We want to complete this successful', 'successful');
});
cy.getByTestId('objective')
.filter(':contains("We want to complete this successful")')
.last()
.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`, () => {
op.addObjective().fillObjectiveTitle('A not successful objective').submit();
Expand Down
32 changes: 15 additions & 17 deletions frontend/cypress/e2e/tab.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,20 +395,21 @@ describe('Tab workflow tests', () => {
tabAndCheck('save', 'Speichern');
tabAndCheck('cancel', 'Abbrechen');
});
it('Should tab register member', () => {
cy.getByTestId('team-management').click();
tabAndCheck('invite-member');

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.realPress('ArrowDown');
cy.realPress('ArrowDown');
cy.realPress('ArrowDown');
cy.realPress('ArrowDown');
cy.focused().contains('Objective löschen');
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="confirm-yes"]');
cy.realPress('Enter');
cy.contains('Member registrieren');
focusedShouldHaveTestId('close-dialog');
tabAndCheck('new-member-first-name');
tabAndCheck('new-member-last-name');
tabAndCheck('email-col_0');
cy.tabForward();
cy.focused().closest('app-puzzle-icon-button').should('have.attr', 'icon', 'delete-icon.svg');
tabAndCheck('new-member-add-row', 'Weiterer Member hinzufügen');
tabAndCheck('invite', 'Einladen');
tabAndCheck('new-member-cancel', 'Abbrechen');
});

it('Close create objective with tab', () => {
Expand Down Expand Up @@ -446,10 +447,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 5449a85

Please sign in to comment.