Skip to content

Commit

Permalink
Add delay 0 to all cypress inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Nov 4, 2024
1 parent 628d99e commit 34d992d
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 67 deletions.
10 changes: 5 additions & 5 deletions frontend/cypress/e2e/checkIn.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('OKR Check-in e2e tests', () => {
cy.getByTestId('objective').first().getByTestId('add-keyResult').first().click();
cy.getByTestId('submit').should('be.disabled');

cy.getByTestId('titleInput').type('Title');
cy.getByTestId('titleInput').type('Title', { delay: 0 });
cy.getByTestId('ordinalTab').click();

cy.fillOutKeyResult(
Expand Down Expand Up @@ -203,11 +203,11 @@ describe('OKR Check-in e2e tests', () => {
cy.contains('CHF 30.-');
cy.contains('Confidence um Target Zone (CHF 213.-) zu erreichen');
cy.contains('5/10');
cy.getByTestId('check-in-metric-value').click().clear().type('200');
cy.getByTestId('check-in-metric-value').click().clear().type('200', { delay: 0 });
cy.getByTestId('confidence-slider').realMouseDown();
cy.contains('Here we are');
cy.contains('A cat would be great');
cy.getByTestId('changeInfo').clear().type('We bought a new sheep');
cy.getByTestId('changeInfo').clear().type('We bought a new sheep', { delay: 0 });
cy.getByTestId('submit-check-in').click();

cy.wait(200);
Expand All @@ -219,7 +219,7 @@ describe('OKR Check-in e2e tests', () => {
cy.getByTestId('objective').first().getByTestId('add-keyResult').first().click();
cy.getByTestId('submit').should('be.disabled');

cy.getByTestId('titleInput').type('Title');
cy.getByTestId('titleInput').type('Title', { delay: 0 });
cy.getByTestId('ordinalTab').click();

cy.fillOutKeyResult(
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('OKR Check-in e2e tests', () => {
cy.getByTestId('confidence-slider').realMouseDown();
cy.contains('There is a new car');
cy.contains('Buy now a new pool');
cy.getByTestId('changeInfo').clear().type('We bought a new dog');
cy.getByTestId('changeInfo').clear().type('We bought a new dog', { delay: 0 });
cy.getByTestId('submit-check-in').click();

cy.wait(200);
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('CRUD operations', () => {

it(`Create objective, should display error message`, () => {
cy.getByTestId('add-objective').first().click();
cy.getByTestId('title').first().type('description').clear();
cy.getByTestId('title').first().type('description', { delay: 0 }).clear();
cy.contains('Titel muss folgende Länge haben: 2-250 Zeichen');
cy.getByTestId('safe').should('be.disabled');
cy.getByTestId('safe-draft').should('be.disabled');
Expand Down
4 changes: 2 additions & 2 deletions frontend/cypress/e2e/duplicated-scoring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ describe('e2e test for scoring adjustment on objective duplicate', () => {
cy.getByTestId(`stretch-radio`).click();
cy.getByTestId('confidence-slider').click();
cy.realPress('{rightarrow}').realPress('{rightarrow}').realPress('{rightarrow}');
cy.getByTestId('changeInfo').click().type('Testveränderungen');
cy.getByTestId('initiatives').click().type('Testmassnahmen');
cy.getByTestId('changeInfo').click().type('Testveränderungen', { delay: 0 });
cy.getByTestId('initiatives').click().type('Testmassnahmen', { delay: 0 });
cy.getByTestId('submit-check-in').click();
cy.getByTestId('close-drawer').click({ force: true });

Expand Down
36 changes: 18 additions & 18 deletions frontend/cypress/e2e/keyresult.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('OKR Overview', () => {
cy.getByTestId('objective').first().getByTestId('add-keyResult').first().click();
cy.contains('Key Result erfassen');
cy.contains('Jaya Norris');
cy.getByTestId('titleInput').type('Title');
cy.getByTestId('titleInput').type('Title', { delay: 0 });

cy.getByTestId('ordinalTab').click();
cy.fillOutKeyResult(
Expand All @@ -94,10 +94,10 @@ describe('OKR Overview', () => {
cy.getByTestId('submit').should('not.be.disabled');
cy.getByTestId('actionInput').should('have.length', 3);

cy.getByTestId('actionInput').first().type('A new car');
cy.getByTestId('actionInput').last().type('A new house');
cy.getByTestId('actionInput').first().type('A new car', { delay: 0 });
cy.getByTestId('actionInput').last().type('A new house', { delay: 0 });
cy.getByTestId('add-action-plan-line').click();
cy.getByTestId('actionInput').last().type('A new company');
cy.getByTestId('actionInput').last().type('A new company', { delay: 0 });

cy.getByTestId('actionInput').first().should('have.value', 'A new car');
cy.getByTestId('actionInput').last().should('have.value', 'A new company');
Expand Down Expand Up @@ -222,67 +222,67 @@ describe('OKR Overview', () => {
cy.getByTestId('submit').should('be.disabled');
cy.contains('Titel muss folgende Länge haben: 2-250 Zeichen');

cy.getByTestId('titleInput').type('My title');
cy.getByTestId('titleInput').type('My title', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');
cy.getByTestId('baseline').clear();
cy.getByTestId('submit').should('be.disabled');
cy.contains('Baseline muss eine Zahl sein');

cy.getByTestId('baseline').type('abc');
cy.getByTestId('baseline').type('abc', { delay: 0 });
cy.getByTestId('submit').should('be.disabled');
cy.contains('Baseline muss eine Zahl sein');

cy.getByTestId('baseline').clear();
cy.getByTestId('baseline').type('45');
cy.getByTestId('baseline').type('45', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');
cy.getByTestId('stretchGoal').clear();
cy.getByTestId('submit').should('be.disabled');
cy.contains('Stretch Goal muss eine Zahl sein');

cy.getByTestId('stretchGoal').type('abc');
cy.getByTestId('stretchGoal').type('abc', { delay: 0 });
cy.getByTestId('submit').should('be.disabled');
cy.contains('Stretch Goal muss eine Zahl sein');

cy.getByTestId('stretchGoal').clear();
cy.getByTestId('stretchGoal').type('83');
cy.getByTestId('stretchGoal').type('83', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');
cy.getByTestId('ownerInput').clear();
cy.getByTestId('submit').should('be.disabled');

cy.getByTestId('ownerInput').type('abc');
cy.getByTestId('titleInput').type('Hello');
cy.getByTestId('ownerInput').type('abc', { delay: 0 });
cy.getByTestId('titleInput').type('Hello', { delay: 0 });
cy.getByTestId('submit').should('be.disabled');
cy.contains('Owner muss ausgewählt sein');

cy.getByTestId('ownerInput').clear();
cy.getByTestId('ownerInput').type('Pac').type('{downarrow}').type('{enter}');
cy.getByTestId('ownerInput').type('Pac').type('{downarrow}', { delay: 0 }).type('{enter}', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');

cy.getByTestId('ordinalTab').click();
cy.getByTestId('submit').should('be.disabled');

cy.getByTestId('commitZone').clear().type('Commit');
cy.getByTestId('targetZone').clear().type('Target');
cy.getByTestId('stretchZone').clear().type('Stretch');
cy.getByTestId('commitZone').clear().type('Commit', { delay: 0 });
cy.getByTestId('targetZone').clear().type('Target', { delay: 0 });
cy.getByTestId('stretchZone').clear().type('Stretch', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');

cy.getByTestId('commitZone').clear();
cy.getByTestId('submit').should('be.disabled');
cy.contains('Commit Zone muss folgende Länge haben: 1-400 Zeichen');

cy.getByTestId('commitZone').type('Commit');
cy.getByTestId('commitZone').type('Commit', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');
cy.getByTestId('targetZone').clear();
cy.getByTestId('submit').should('be.disabled');
cy.contains('Target Zone muss folgende Länge haben: 1-400 Zeichen');

cy.getByTestId('targetZone').type('Target');
cy.getByTestId('targetZone').type('Target', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');
cy.getByTestId('stretchZone').clear();
cy.getByTestId('submit').should('be.disabled');
cy.contains('Stretch Zone muss folgende Länge haben: 1-400 Zeichen');

cy.getByTestId('stretchZone').type('Commit');
cy.getByTestId('stretchZone').type('Commit', { delay: 0 });
cy.getByTestId('submit').should('not.be.disabled');
});

Expand Down
6 changes: 3 additions & 3 deletions frontend/cypress/e2e/objective-backlog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('OKR Objective Backlog e2e tests', () => {
it(`Create Objective in backlog quarter should not have save button`, () => {
cy.getByTestId('add-objective').first().click();

cy.getByTestId('title').first().clear().type('Objective in quarter backlog');
cy.getByTestId('title').first().clear().type('Objective in quarter backlog', { delay: 0 });
cy.get('select#quarter').select('Backlog');

cy.contains('Speichern').should('not.exist');
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('OKR Objective Backlog e2e tests', () => {
it(`Can release Objective to another quarter from backlog`, () => {
cy.visit('/?quarter=999');
cy.getByTestId('add-objective').first().click();
cy.getByTestId('title').first().clear().type('We can not release this');
cy.getByTestId('title').first().clear().type('We can not release this', { delay: 0 });
cy.getByTestId('safe').should('not.exist');
cy.getByTestId('safe-draft').click();

Expand All @@ -86,7 +86,7 @@ describe('OKR Objective Backlog e2e tests', () => {

cy.contains('Objective veröffentlichen');

cy.getByTestId('title').first().clear().type('This is our first released objective');
cy.getByTestId('title').first().clear().type('This is our first released objective', { delay: 0 });

cy.get('select#quarter').should('not.contain', 'Backlog');
cy.get('select#quarter').select('GJ ForTests');
Expand Down
8 changes: 4 additions & 4 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,22 @@ describe('OKR Objective e2e tests', () => {
cy.wait(500);

cy.getByTestId('objectiveSearch').first().click();
cy.getByTestId('objectiveSearch').first().type('Search after').wait(350);
cy.getByTestId('objectiveSearch').first().type('Search after', { delay: 0 }).wait(350);

cy.contains('Search after this objective');
cy.get('We dont want to search for this').should('not.exist');

cy.getByTestId('objectiveSearch').first().clear().type('this').wait(350);
cy.getByTestId('objectiveSearch').first().clear().type('this', { delay: 0 }).wait(350);

cy.contains('Search after this objective');
cy.contains('We dont want to search for this');

cy.getByTestId('objectiveSearch').first().clear().type('dont want to').wait(350);
cy.getByTestId('objectiveSearch').first().clear().type('dont want to', { delay: 0 }).wait(350);

cy.contains('We dont want to search for this');
cy.get('Search after this objective').should('not.exist');

cy.getByTestId('objectiveSearch').first().clear().type('there is no objective').wait(350);
cy.getByTestId('objectiveSearch').first().clear().type('there is no objective', { delay: 0 }).wait(350);

cy.get('We dont want to search for this').should('not.exist');
cy.get('Search after this objective').should('not.exist');
Expand Down
10 changes: 5 additions & 5 deletions frontend/cypress/e2e/scoring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ describe('Scoring component e2e tests', () => {
cy.getByTestId(`${zoneName}-radio`).click();
cy.getByTestId('confidence-slider').click();
cy.realPress('{rightarrow}').realPress('{rightarrow}').realPress('{rightarrow}');
cy.getByTestId('changeInfo').click().type('Testveränderungen');
cy.getByTestId('initiatives').click().type('Testmassnahmen');
cy.getByTestId('changeInfo').click().type('Testveränderungen', { delay: 0 });
cy.getByTestId('initiatives').click().type('Testmassnahmen', { delay: 0 });
cy.getByTestId('submit-check-in').click();
const percentage = getPercentageOrdinal(zoneName);
cy.validateScoring(false, percentage);
Expand All @@ -80,10 +80,10 @@ function setupMetricKR(baseline: number, stretchgoal: number, value: number) {
cy.createMetricKeyresult('Metric scoring keyresult', String(baseline), String(stretchgoal));
cy.getByTestId('keyresult').get(':contains("Metric scoring keyresult")').last().click();
cy.getByTestId('add-check-in').click();
cy.getByTestId('check-in-metric-value').clear().type(String(value));
cy.getByTestId('check-in-metric-value').clear().type(String(value), { delay: 0 });
cy.getByTestId('confidence-slider').click();
cy.realPress('{rightarrow}').realPress('{rightarrow}').realPress('{rightarrow}');
cy.getByTestId('changeInfo').click().type('Testveränderungen');
cy.getByTestId('initiatives').click().type('Testmassnahmen');
cy.getByTestId('changeInfo').click().type('Testveränderungen', { delay: 0 });
cy.getByTestId('initiatives').click().type('Testmassnahmen', { delay: 0 });
cy.getByTestId('submit-check-in').click();
}
46 changes: 23 additions & 23 deletions frontend/cypress/e2e/tab.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ describe('Tab workflow tests', () => {
}

function editInputFields(message: string) {
cy.focused().type('{selectall}{backspace}');
cy.focused().type(message);
cy.focused().type('{selectall}{backspace}', { delay: 0 });
cy.focused().type(message, { delay: 0 });
}

function fillInNewKeyResult() {
Expand All @@ -52,7 +52,7 @@ describe('Tab workflow tests', () => {
cy.realPress('ArrowDown'); // -> Entspricht Bob Baumeister (Stand 13.11.2023)
cy.realPress('Enter');
cy.tabForward();
cy.focused().type('Description!');
cy.focused().type('Description!', { delay: 0 });
cy.tabForward();
cy.realType('Action point one');
cy.tabForward();
Expand Down Expand Up @@ -110,9 +110,9 @@ describe('Tab workflow tests', () => {
cy.wait(500);
cy.contains('erfassen');
cy.tabForward();
cy.focused().type('Objective by Cypress');
cy.focused().type('Objective by Cypress', { delay: 0 });
cy.tabForward();
cy.focused().type('Description of Objective...');
cy.focused().type('Description of Objective...', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
Expand Down Expand Up @@ -150,7 +150,7 @@ describe('Tab workflow tests', () => {
cy.tabForward();
cy.focused().contains('GJ');
cy.tabForward();
cy.focused().type('Objective').wait(350); // Decided to try writing since this changes the url. Sadly you can't use contains on placeholders otherwise I would have done that
cy.focused().type('Objective', { delay: 0 }).wait(350); // Decided to try writing since this changes the url. Sadly you can't use contains on placeholders otherwise I would have done that
cy.url().should('include', 'objectiveQuery=objective');
cy.tabForward();
cy.tabForward();
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('Tab workflow tests', () => {
cy.realPress('Enter');
cy.tabForward();
cy.tabForward();
cy.focused().type('The optional comment');
cy.focused().type('The optional comment', { delay: 0 });
cy.tabForward();
cy.realPress('Enter');

Expand Down Expand Up @@ -342,16 +342,16 @@ describe('Tab workflow tests', () => {
openCreateKeyResult();
cy.wait(500);
cy.tabForward();
cy.focused().type('KeyResult metric by Cypress');
cy.focused().type('KeyResult metric by Cypress', { delay: 0 });
cy.contains('Einheit');
cy.tabForward();
cy.tabForward();
cy.tabForward(); // -> unit
cy.realPress('ArrowDown'); // -> Entspricht "CHF"
cy.tabForward(); // -> baseline
cy.focused().type('0');
cy.focused().type('0', { delay: 0 });
cy.tabForward(); // -> stretchgoal
cy.focused().type('10');
cy.focused().type('10', { delay: 0 });
fillInNewKeyResult();
cy.contains('KeyResult metric by Cypress');

Expand All @@ -360,29 +360,29 @@ describe('Tab workflow tests', () => {
openCreateKeyResult();
cy.wait(500);
cy.tabForward();
cy.focused().type('KeyResult');
cy.focused().type('KeyResult', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.realPress('ArrowDown'); // -> Entspricht "CHF"
cy.tabForward();
cy.focused().type('0');
cy.focused().type('0', { delay: 0 });
cy.tabForward();
cy.focused().type('10');
cy.focused().type('10', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 1');
cy.focused().type('Action 1', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 2');
cy.focused().type('Action 2', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.focused().type('Action 3');
cy.focused().type('Action 3', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.focused().type('Action 4');
cy.focused().type('Action 4', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.tabForward();
Expand All @@ -397,11 +397,11 @@ describe('Tab workflow tests', () => {
cy.realPress('Enter');
cy.tabForwardUntil('[data-testId="add-action-plan-line"]');
cy.realPress('Enter');
cy.focused().type('Action 2');
cy.focused().type('Action 2', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter');
cy.focused().type('Action 1');
cy.focused().type('Action 1', { delay: 0 });
cy.realPress('ArrowUp');
cy.tabForwardUntil('[data-testId="submit"]');
cy.realPress('Enter');
Expand Down Expand Up @@ -472,17 +472,17 @@ describe('Tab workflow tests', () => {
openCreateKeyResult();
cy.wait(500);
cy.tabForward(); // -> title
cy.focused().type('KeyResult ordinal by Cypress');
cy.focused().type('KeyResult ordinal by Cypress', { delay: 0 });
cy.tabForward();
cy.tabForward();
cy.realPress('Enter'); // -> switch to ordinal type
cy.contains('Commit Zone');
cy.tabForward();
cy.focused().type('Commit Zone');
cy.focused().type('Commit Zone', { delay: 0 });
cy.tabForward();
cy.focused().type('Target Zone');
cy.focused().type('Target Zone', { delay: 0 });
cy.tabForward();
cy.focused().type('Stretch Goal');
cy.focused().type('Stretch Goal', { delay: 0 });
fillInNewKeyResult();
cy.wait(500);
cy.contains('KeyResult ordinal by Cypress');
Expand Down
Loading

0 comments on commit 34d992d

Please sign in to comment.