diff --git a/frontend/cypress/e2e/objective.cy.ts b/frontend/cypress/e2e/objective.cy.ts index 1445e1b243..ef9bbf0961 100644 --- a/frontend/cypress/e2e/objective.cy.ts +++ b/frontend/cypress/e2e/objective.cy.ts @@ -111,7 +111,6 @@ describe('OKR Objective e2e tests', () => { op.getObjectiveByNameAndState('he reopening of this objective will be canceled', 'successful') .findByTestId('three-dot-menu') - .scrollIntoView() .click(); op.selectFromThreeDotMenu('Objective wiedereröffnen'); diff --git a/frontend/cypress/support/helper/pom-helper/pages/overviewPage.ts b/frontend/cypress/support/helper/pom-helper/pages/overviewPage.ts index c515e5162e..ad6caf5a38 100644 --- a/frontend/cypress/support/helper/pom-helper/pages/overviewPage.ts +++ b/frontend/cypress/support/helper/pom-helper/pages/overviewPage.ts @@ -64,7 +64,8 @@ export default class CyOverviewPage extends Page { } getObjectiveByNameAndState(objectiveName: string, state: string) { - return this.getObjectivesByNameAndState(objectiveName, state).last().scrollIntoView(); + this.getObjectivesByNameAndState(objectiveName, state).last().as('objective').scrollIntoView(); + return cy.get('@objective'); } getObjectivesByNameAndState(objectiveName: string, state: string) { @@ -72,15 +73,19 @@ export default class CyOverviewPage extends Page { } getObjectiveByName(objectiveName: string) { - return this.getObjectivesByName(objectiveName).last().scrollIntoView(); + this.getObjectivesByName(objectiveName).last().as('objective').scrollIntoView(); + return cy.get('@objective'); } getObjectiveByTeamAndName(teamName: string, objectiveName: string) { - return this.getTeamByName(teamName) + this.getTeamByName(teamName) .find('.objective') .filter(filterByObjectiveName(objectiveName)) .last() + .as('team') .scrollIntoView(); + + return cy.get('@team'); } getObjectivesByName(objectiveName: string) { @@ -88,7 +93,8 @@ export default class CyOverviewPage extends Page { } getObjectiveByState(state: string) { - return this.getObjectivesByState(state).first().scrollIntoView(); + this.getObjectivesByState(state).first().as('objective').scrollIntoView(); + return cy.get('@objective'); } getObjectivesByState(state: string) { @@ -96,7 +102,8 @@ export default class CyOverviewPage extends Page { } getKeyResultByName(keyResultName: string) { - return this.getKeyResultsByName(keyResultName).last().scrollIntoView(); + this.getKeyResultsByName(keyResultName).last().as('keyResult').scrollIntoView(); + return cy.get('@keyResult'); } getKeyResultsByName(keyresultName: string) { @@ -105,14 +112,9 @@ export default class CyOverviewPage extends Page { selectFromThreeDotMenu(optionName: string) { cy.contains(optionName).should('exist'); - const chainable = cy - .get('.objective-three-dot-menu') - .contains(optionName) - .scrollIntoView() - .then(() => { - chainable.should('have.class', 'objective-menu-option'); - chainable.click(); - }); + cy.get('.objective-three-dot-menu').contains(optionName).as('option').scrollIntoView(); + + cy.get('@option').should('have.class', 'objective-menu-option').click(); } duplicateObjective(objectiveName: string) {