Skip to content

Commit

Permalink
Refactor tabbing tests and remove as many waits as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Nov 6, 2024
1 parent 03e780c commit a27fe77
Showing 1 changed file with 94 additions and 94 deletions.
188 changes: 94 additions & 94 deletions frontend/cypress/e2e/tab.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('Tab workflow tests', () => {
cy.tabForwardUntil('[data-testId="show-all-checkins"]');
cy.focused().contains('Alle Check-ins anzeigen');
cy.realPress('Enter');
cy.contains('Confidence');
}

function fillOutOrdinalCheckin(commentary: string) {
Expand All @@ -107,8 +108,7 @@ describe('Tab workflow tests', () => {

function createNewObjectiveWithTab() {
openCreateObjective();
cy.wait(150);
cy.contains('erfassen');
cy.contains('Objective für');
cy.tabForward();
cy.focused().type('Objective by Cypress', { delay: 0 });
cy.tabForward();
Expand Down Expand Up @@ -203,8 +203,8 @@ describe('Tab workflow tests', () => {
openThreeDotMenu();
cy.focused().contains('Objective bearbeiten');
cy.realPress('Enter');
cy.contains('bearbeiten');
cy.wait(500);
cy.contains('Objective von');
cy.tabForward();
cy.tabForward();
editInputFields('Edited by Cypress');
cy.tabForward();
Expand All @@ -221,8 +221,8 @@ describe('Tab workflow tests', () => {
cy.realPress('ArrowDown');
cy.focused().contains('Objective duplizieren');
cy.realPress('Enter');
cy.wait(150);
cy.contains('duplizieren');
cy.contains('Objective von');
cy.tabForward();
cy.tabForward();
editInputFields('Duplicated by Cypress');
cy.tabForward();
Expand All @@ -245,10 +245,10 @@ describe('Tab workflow tests', () => {
cy.realPress('ArrowDown');
cy.focused().contains('Objective abschliessen');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Objective abschliessen');
cy.contains('Objective erreicht');
cy.contains('Objective nicht erreicht');
cy.contains('Objective abschliessen');
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.tabForward();
Expand Down Expand Up @@ -304,29 +304,28 @@ describe('Tab workflow tests', () => {

it('Edit key result with tab', () => {
openKeyresultDetail();
cy.wait(150);
cy.tabForwardUntil('[data-testId="edit-keyResult"]');
cy.focused().contains('Key Result bearbeiten');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Action Plan');
cy.tabForward();
cy.tabForward();
editInputFields('This has been edited by Cypress');
cy.tabForwardUntil('[data-testId="descriptionInput"]');
editInputFields('Description of Cypress');
cy.tabForwardUntil('[data-testId="submit"]');
cy.focused().contains('Speichern');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in erfassen');
cy.contains('This has been edited by Cypress');
});

it('Delete key result with tab', () => {
openKeyresultDetail();
cy.wait(150);
cy.tabForwardUntil('[data-testId="edit-keyResult"]');
cy.focused().contains('Key Result bearbeiten');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Action Plan');
cy.tabForwardUntil('[data-testId="delete-keyResult"]');
cy.focused().contains('Key Result löschen');
cy.realPress('Enter');
Expand All @@ -341,7 +340,7 @@ describe('Tab workflow tests', () => {
it('Create new key result metric with checkin and edit checkin with tab', () => {
// Create keyresult
openCreateKeyResult();
cy.wait(150);
cy.tabForward();
cy.tabForward();
cy.focused().type('KeyResult metric by Cypress', { delay: 0 });
cy.contains('Einheit');
Expand All @@ -356,80 +355,13 @@ describe('Tab workflow tests', () => {
fillInNewKeyResult();
cy.contains('KeyResult metric by Cypress');

//Actionplan
it('Create new key result with new actionplan', () => {
openCreateKeyResult();
cy.wait(150);
cy.tabForward();
cy.focused().type('KeyResult', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.realPress('ArrowDown'); // -> Entspricht "CHF"
cy.tabForward();
cy.focused().type('0', { delay: 0 });
cy.tabForward();
cy.focused().type('10', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 1', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 2', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 3', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.focused().type('Action 4', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
});

it('Edit actionplan of key result and change order of actions', () => {
openKeyresultDetail();
cy.wait(150);
cy.tabForwardUntil('[data-testId="edit-keyResult"]');
cy.focused().contains('Key Result bearbeiten');
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="add-action-plan-line"]');
cy.realPress('Enter');
cy.focused().type('Action 2', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.focused().type('Action 1', { delay: 0 });
cy.realPress('ArrowUp');
cy.tabForwardUntil('[data-testId="submit"]');
cy.realPress('Enter');
});

it('Edit actionplan of key result and delete action', () => {
openKeyresultDetail();
cy.wait(150);
cy.tabForwardUntil('[data-testId="edit-keyResult"]');
cy.focused().contains('Key Result bearbeiten');
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="add-action-plan-line"]');
cy.tabBackward();
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="confirmYes"]');
cy.realPress('Enter');
cy.tabForward();
cy.tabForwardUntil('[data-testId="submit"]');
cy.realPress('Enter');
});

// Create check-in
cy.getByTestId('keyresult').contains('KeyResult metric by Cypress').click();
cy.tabForwardUntil('[data-testId="add-check-in"]');
cy.focused().contains('Check-in erfassen');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Confidence');
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.tabForward();
Expand All @@ -443,14 +375,15 @@ describe('Tab workflow tests', () => {
cy.tabForward();
cy.focused().contains('Check-in speichern');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in erfassen');

// Edit checkin
openCheckInHistory();
cy.wait(150);
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in bearbeiten');
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.tabForward();
Expand All @@ -464,14 +397,79 @@ describe('Tab workflow tests', () => {
cy.tabForward();
cy.focused().contains('Speichern');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in History');
cy.contains('Check-in by Cypress (edited)');
});

it('Create new key result ordinal with checkin and edit checkin with tab', () => {
xit('Edit actionplan of key result and delete action', () => {
openKeyresultDetail();
cy.tabForwardUntil('[data-testId="edit-keyResult"]');
cy.focused().contains('Key Result bearbeiten');
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="add-action-plan-line"]');
cy.tabBackward();
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="confirmYes"]');
cy.realPress('Enter');
cy.tabForward();
cy.tabForwardUntil('[data-testId="submit"]');
cy.realPress('Enter');
});

xit('Edit actionplan of key result and change order of actions', () => {
openKeyresultDetail();
cy.tabForwardUntil('[data-testId="edit-keyResult"]');
cy.focused().contains('Key Result bearbeiten');
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="add-action-plan-line"]');
cy.realPress('Enter');
cy.focused().type('Action 2', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.focused().type('Action 1', { delay: 0 });
cy.realPress('ArrowUp');
cy.tabForwardUntil('[data-testId="submit"]');
cy.realPress('Enter');
});

it('Create new key result with new actionplan', () => {
openCreateKeyResult();
cy.tabForward();
cy.tabForward();
cy.focused().type('KeyResult', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.realPress('ArrowDown'); // -> Entspricht "CHF"
cy.tabForward();
cy.focused().type('0', { delay: 0 });
cy.tabForward();
cy.focused().type('10', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 1', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 2', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 3', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.focused().type('Action 4', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
});

it.only('Create new key result ordinal with checkin and edit checkin with tab', () => {
// Create keyresult
openCreateKeyResult();
cy.wait(150);
cy.tabForward();
cy.tabForward(); // -> title
cy.focused().type('KeyResult ordinal by Cypress', { delay: 0 });
cy.tabForward();
Expand All @@ -493,24 +491,26 @@ describe('Tab workflow tests', () => {
cy.tabForwardUntil('[data-testId="add-check-in"]');
cy.focused().contains('Check-in erfassen');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Action Plan');
cy.tabForward();
fillOutOrdinalCheckin('Check-in by Cypress');
cy.tabForward();
cy.focused().contains('Check-in speichern');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in erfassen');

// Edit checkin
openCheckInHistory();
cy.wait(150);
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in bearbeiten');
cy.tabForward();
fillOutOrdinalCheckin('Check-in by Cypress (edited)');
cy.tabForward();
cy.focused().contains('Speichern');
cy.realPress('Enter');
cy.wait(150);
cy.contains('Check-in History');
cy.contains('Check-in by Cypress (edited)');
});

Expand Down

0 comments on commit a27fe77

Please sign in to comment.