diff --git a/frontend/cypress/e2e/check-in.cy.ts b/frontend/cypress/e2e/check-in.cy.ts index d71c16fb55..f1ff021f7c 100644 --- a/frontend/cypress/e2e/check-in.cy.ts +++ b/frontend/cypress/e2e/check-in.cy.ts @@ -1,5 +1,4 @@ import * as users from '../fixtures/users.json'; -import { onlyOn } from '@cypress/skip-test'; import { uniqueSuffix } from '../support/helper/utils'; import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage'; import { Unit } from '../../src/app/shared/types/enums/Unit'; @@ -10,17 +9,18 @@ import ConfirmDialog from '../support/helper/dom-helper/dialogs/confirmDialog'; describe('OKR Check-in e2e tests', () => { describe('tests via click', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); let keyresultDetailPage = new KeyResultDetailPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); keyresultDetailPage = new KeyResultDetailPage(); cy.loginAsUser(users.gl); }); it(`Create checkin metric`, () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('Very important keyresult') .withMetricValues(Unit.PERCENT, '21', '51') .fillKeyResultDescription('This is my description') @@ -41,7 +41,8 @@ describe('OKR Check-in e2e tests', () => { }); it(`Create checkin metric with confidence 0`, () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('Very important keyresult') .withMetricValues(Unit.PERCENT, '21', '51') .fillKeyResultDescription('This is my description') @@ -62,7 +63,8 @@ describe('OKR Check-in e2e tests', () => { }); it(`Create checkin metric with value below baseline`, () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('This will not be good') .withMetricValues(Unit.PERCENT, '21', '52') .fillKeyResultDescription('This is my description') @@ -81,7 +83,8 @@ describe('OKR Check-in e2e tests', () => { }); it('Create checkin ordinal', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('A new ordinal keyresult for our company') .withOrdinalValues('New house', 'New car', 'New pool') .fillKeyResultDescription('This is my description') @@ -102,7 +105,8 @@ describe('OKR Check-in e2e tests', () => { }); it('Should generate checkin list', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('This will give a checkin list') .withMetricValues(Unit.PERCENT, '21', '52') .fillKeyResultDescription('This is my description') @@ -122,22 +126,24 @@ describe('OKR Check-in e2e tests', () => { .fillCheckInCommentary('This was a good idea') .fillCheckInInitiatives('Will be difficult') .submit(); - keyresultDetailPage.showAllCheckins(); + keyresultDetailPage + .showAllCheckins() + .checkForAttribute('Confidence:', '5 / 10') + .checkForAttribute('Confidence:', '6 / 10') + .checkForAttribute('Veränderungen:', 'We bought a new house') + .checkForAttribute('Veränderungen:', 'This was a good idea') + .checkForAttribute('Massnahmen:', 'We have to buy more PCs') + .checkForAttribute('Massnahmen:', 'Will be difficult'); cy.contains('Check-in History'); cy.contains(getCurrentDate()); cy.contains('Wert: 30%'); cy.contains('Wert: 50%'); - checkForAttribute('Confidence:', '5 / 10'); - checkForAttribute('Confidence:', '6 / 10'); - checkForAttribute('Veränderungen:', 'We bought a new house'); - checkForAttribute('Veränderungen:', 'This was a good idea'); - checkForAttribute('Massnahmen:', 'We have to buy more PCs'); - checkForAttribute('Massnahmen:', 'Will be difficult'); }); it('Edit metric checkin', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('Here we edit a metric checkin') .withMetricValues(Unit.CHF, '10', '300') .fillKeyResultDescription('This is my description') @@ -167,7 +173,8 @@ describe('OKR Check-in e2e tests', () => { }); it('Should generate right labels in checkin history list', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('A new KeyResult for checking checkin list') .withMetricValues(Unit.EUR, '10', '300') .fillKeyResultDescription('This is my description') @@ -187,7 +194,8 @@ describe('OKR Check-in e2e tests', () => { CheckInHistoryDialog.do().close(); keyresultDetailPage.close(); - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('There is another kr with fte') .withMetricValues(Unit.FTE, '10', '300') .fillKeyResultDescription('This is my description') @@ -207,7 +215,8 @@ describe('OKR Check-in e2e tests', () => { }); it('Edit ordinal checkin', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('For editing ordinal checkin') .withOrdinalValues('New house', 'New car', 'New pool') .fillKeyResultDescription('This is my description') @@ -233,9 +242,10 @@ describe('OKR Check-in e2e tests', () => { }); it(`Should display confirm dialog when creating checkin on draft objective`, () => { - op.addObjective().fillObjectiveTitle('draft objective title').selectQuarter('3').submitDraftObjective(); - op.visitNextQuarter(); - op.addKeyResult(undefined, 'draft objective title') + overviewPage.addObjective().fillObjectiveTitle('draft objective title').selectQuarter('3').submitDraftObjective(); + overviewPage.visitNextQuarter(); + overviewPage + .addKeyResult(undefined, 'draft objective title') .fillKeyResultTitle('I am a metric keyresult for testing') .withMetricValues(Unit.PERCENT, '21', '52') .fillKeyResultDescription('This is my description') @@ -251,9 +261,10 @@ describe('OKR Check-in e2e tests', () => { it(`Should only display last value div if last checkin is present`, () => { const objectiveName = uniqueSuffix('new objective'); - op.addObjective().fillObjectiveTitle(objectiveName).selectQuarter('3').submit(); - op.visitNextQuarter(); - op.addKeyResult(undefined, objectiveName) + overviewPage.addObjective().fillObjectiveTitle(objectiveName).selectQuarter('3').submit(); + overviewPage.visitNextQuarter(); + overviewPage + .addKeyResult(undefined, objectiveName) .fillKeyResultTitle('I am a keyresult metric') .withMetricValues(Unit.PERCENT, '45', '60') .fillKeyResultDescription('Description') @@ -286,7 +297,3 @@ function getCurrentDate() { return dd_str + '.' + mm_str + '.' + yyyy; } - -function checkForAttribute(title: string, value: string) { - cy.get('mat-dialog-container').contains(value).parent().should('contain', title); -} diff --git a/frontend/cypress/e2e/duplicated-scoring.cy.ts b/frontend/cypress/e2e/duplicated-scoring.cy.ts index f87377c057..e3b2798a6d 100644 --- a/frontend/cypress/e2e/duplicated-scoring.cy.ts +++ b/frontend/cypress/e2e/duplicated-scoring.cy.ts @@ -3,17 +3,18 @@ import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage'; import KeyResultDetailPage from '../support/helper/dom-helper/pages/keyResultDetailPage'; describe('e2e test for scoring adjustment on objective duplicate', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); let keyresultDetailPage = new KeyResultDetailPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); keyresultDetailPage = new KeyResultDetailPage(); cy.loginAsUser(users.gl); }); it('Duplicate ordinal checkin and validate value of scoring component', () => { - op.addKeyResult('Puzzle ITC', 'Wir wollen die Kundenzufriedenheit steigern') + overviewPage + .addKeyResult('Puzzle ITC', 'Wir wollen die Kundenzufriedenheit steigern') .fillKeyResultTitle('stretch keyresult for testing') .withOrdinalValues('Ex. val', 'Ex. val', 'Ex. val') .submit(); @@ -32,16 +33,18 @@ describe('e2e test for scoring adjustment on objective duplicate', () => { keyresultDetailPage.close(); cy.wait('@indexPage'); - op.duplicateObjective('Wir wollen die Kundenzufriedenheit steigern') + overviewPage + .duplicateObjective('Wir wollen die Kundenzufriedenheit steigern') .fillObjectiveTitle('A duplicated Objective for this tool') .selectQuarter('3') .submit(); - op.checkForToaster('Das Objective wurde erfolgreich erstellt.', 'success'); + overviewPage.checkForToaster('Das Objective wurde erfolgreich erstellt.', 'success'); - cy.visit('/?quarter=3'); + overviewPage.visitNextQuarter(); - op.getKeyResultByName('stretch keyresult for testing') + overviewPage + .getKeyResultByName('stretch keyresult for testing') .findByTestId('scoring-component') .findByTestId('fail') .as('fail-area'); diff --git a/frontend/cypress/e2e/key-result.cy.ts b/frontend/cypress/e2e/key-result.cy.ts index 1fb661ad61..0ba70755eb 100644 --- a/frontend/cypress/e2e/key-result.cy.ts +++ b/frontend/cypress/e2e/key-result.cy.ts @@ -5,17 +5,18 @@ import { Unit } from '../../src/app/shared/types/enums/Unit'; import KeyResultDialog from '../support/helper/dom-helper/dialogs/keyResultDialog'; describe('OKR Overview', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); let keyResultDetailPage = new KeyResultDetailPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); keyResultDetailPage = new KeyResultDetailPage(); cy.loginAsUser(users.gl); }); it('Create new metric KeyResult', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .checkForDialogTextMetric() .fillKeyResultTitle('I am a metric keyresult') .withMetricValues(Unit.PERCENT, '21', '52') @@ -38,7 +39,8 @@ describe('OKR Overview', () => { }); it('Create new ordinal KeyResult', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('I am a ordinal keyresult') .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') .checkForDialogTextOrdinal() @@ -65,7 +67,8 @@ describe('OKR Overview', () => { }); it('Create new KeyResult and Save and New', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .checkForDialogTextMetric() .fillKeyResultTitle('I am a metric keyresult with a new one') .withMetricValues(Unit.PERCENT, '21', '52') @@ -77,7 +80,8 @@ describe('OKR Overview', () => { }); it('Create and edit KeyResult with Action Plan', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('This is a keyresult with an action plan') .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') .fillOwner('Bob Baumeister') @@ -103,7 +107,8 @@ describe('OKR Overview', () => { }); it('Edit a KeyResult without type change', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('We want not to change keyresult title') .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') .checkForDialogTextOrdinal() @@ -135,7 +140,8 @@ describe('OKR Overview', () => { }); it('Edit a KeyResult with type change', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('Here we want to change keyresult title') .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') .checkForDialogTextOrdinal() @@ -167,7 +173,7 @@ describe('OKR Overview', () => { }); it('Check validation in keyresult dialog', () => { - op.addKeyResult().checkForDialogTextMetric(); + overviewPage.addKeyResult().checkForDialogTextMetric(); cy.getByTestId('submit').should('be.disabled'); KeyResultDialog.do() .fillKeyResultTitle('I am a metric keyresult') @@ -240,7 +246,8 @@ describe('OKR Overview', () => { }); it('Delete existing keyresult', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('A keyresult to delete') .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') .checkForDialogTextOrdinal() diff --git a/frontend/cypress/e2e/objective-backlog.cy.ts b/frontend/cypress/e2e/objective-backlog.cy.ts index c30053e0df..b9d58ff14b 100644 --- a/frontend/cypress/e2e/objective-backlog.cy.ts +++ b/frontend/cypress/e2e/objective-backlog.cy.ts @@ -3,15 +3,16 @@ import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage'; import ObjectiveDialog from '../support/helper/dom-helper/dialogs/objectiveDialog'; describe('OKR Objective Backlog e2e tests', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); cy.loginAsUser(users.gl); }); it(`Create Objective in backlog quarter should not have save button`, () => { - op.addObjective() + overviewPage + .addObjective() .fillObjectiveTitle('Objective in quarter backlog') .selectQuarter('Backlog') .run(cy.contains('Speichern').should('not.exist')) @@ -20,40 +21,46 @@ describe('OKR Objective Backlog e2e tests', () => { cy.contains('Objective in quarter backlog').should('not.exist'); - op.visitBacklogQuarter(); + overviewPage.visitBacklogQuarter(); cy.contains('Objective in quarter backlog'); }); it(`Edit Objective and move to backlog`, () => { - op.addObjective().fillObjectiveTitle('Move to another quarter on edit').submitDraftObjective(); + overviewPage.addObjective().fillObjectiveTitle('Move to another quarter on edit').submitDraftObjective(); - op.getObjectiveByNameAndState('Move to another quarter on edit', 'draft').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage + .getObjectiveByNameAndState('Move to another quarter on edit', 'draft') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do().fillObjectiveTitle('This goes now to backlog').selectQuarter('Backlog').submit(); cy.contains('This goes now to backlog').should('not.exist'); - op.visitBacklogQuarter(); + overviewPage.visitBacklogQuarter(); cy.contains('This goes now to backlog'); }); it(`Edit ongoing Objective can not choose backlog in quarter select`, () => { - op.addObjective().fillObjectiveTitle('We can not move this to backlog').submit(); + overviewPage.addObjective().fillObjectiveTitle('We can not move this to backlog').submit(); - op.getObjectiveByNameAndState('We can not move this to backlog', 'ongoing').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage + .getObjectiveByNameAndState('We can not move this to backlog', 'ongoing') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); cy.get('select#quarter').should('contain', 'GJ ForTests'); cy.get('select#quarter').should('not.contain', 'Backlog'); }); it(`Can release Objective to another quarter from backlog`, () => { - op.visitBacklogQuarter(); - op.addObjective().fillObjectiveTitle('We can not release this').submitDraftObjective(); + overviewPage.visitBacklogQuarter(); + overviewPage.addObjective().fillObjectiveTitle('We can not release this').submitDraftObjective(); - op.getObjectiveByNameAndState('We can not release this', 'draft').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective veröffentlichen'); + overviewPage.getObjectiveByNameAndState('We can not release this', 'draft').findByTestId('three-dot-menu').click(); + overviewPage.selectFromThreeDotMenu('Objective veröffentlichen'); cy.contains('Objective veröffentlichen'); cy.getByTestId('title').first().as('title'); @@ -69,75 +76,86 @@ describe('OKR Objective Backlog e2e tests', () => { cy.contains('This is our first released objective').should('not.exist'); - op.visitGJForTests(); + overviewPage.visitGJForTests(); cy.contains('This is our first released objective'); }); it(`Can edit Objective title in backlog`, () => { - op.visitBacklogQuarter(); - op.addObjective().fillObjectiveTitle('This is possible for edit').submitDraftObjective(); + overviewPage.visitBacklogQuarter(); + overviewPage.addObjective().fillObjectiveTitle('This is possible for edit').submitDraftObjective(); - op.getObjectiveByNameAndState('This is possible for edit', 'draft').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage + .getObjectiveByNameAndState('This is possible for edit', 'draft') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do().fillObjectiveTitle('My new title').submit(); - op.getObjectiveByNameAndState('My new title', 'draft'); + overviewPage.getObjectiveByNameAndState('My new title', 'draft'); }); it(`Can edit Objective in backlog and change quarter`, () => { - op.visitBacklogQuarter(); - op.addObjective().fillObjectiveTitle('This goes to other quarter later').submitDraftObjective(); + overviewPage.visitBacklogQuarter(); + overviewPage.addObjective().fillObjectiveTitle('This goes to other quarter later').submitDraftObjective(); - op.getObjectiveByNameAndState('This goes to other quarter later', 'draft').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage + .getObjectiveByNameAndState('This goes to other quarter later', 'draft') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do().selectQuarter('GJ ForTests').submit(); - op.visitGJForTests(); - op.getObjectiveByNameAndState('This goes to other quarter later', 'draft'); + overviewPage.visitGJForTests(); + overviewPage.getObjectiveByNameAndState('This goes to other quarter later', 'draft'); }); it(`Can duplicate in backlog`, () => { - op.visitBacklogQuarter(); - op.addObjective().fillObjectiveTitle('Ready for duplicate in backlog').submitDraftObjective(); + overviewPage.visitBacklogQuarter(); + overviewPage.addObjective().fillObjectiveTitle('Ready for duplicate in backlog').submitDraftObjective(); - op.getObjectiveByNameAndState('Ready for duplicate in backlog', 'draft').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective duplizieren'); + overviewPage + .getObjectiveByNameAndState('Ready for duplicate in backlog', 'draft') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do().fillObjectiveTitle('This is a new duplication in backlog').submit(); - op.getObjectiveByNameAndState('Ready for duplicate in backlog', 'draft'); - op.getObjectiveByNameAndState('This is a new duplication in backlog', 'draft'); + overviewPage.getObjectiveByNameAndState('Ready for duplicate in backlog', 'draft'); + overviewPage.getObjectiveByNameAndState('This is a new duplication in backlog', 'draft'); }); it('should duplicate from backlog', () => { - op.visitBacklogQuarter(); - op.addObjective().fillObjectiveTitle('Ready for duplicate to another quarter').submitDraftObjective(); - op.getObjectiveByNameAndState('Ready for duplicate to another quarter', 'draft') + overviewPage.visitBacklogQuarter(); + overviewPage.addObjective().fillObjectiveTitle('Ready for duplicate to another quarter').submitDraftObjective(); + overviewPage + .getObjectiveByNameAndState('Ready for duplicate to another quarter', 'draft') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective duplizieren'); + overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do().fillObjectiveTitle('New duplication from backlog').selectQuarter('GJ ForTests').submit(); - op.getObjectiveByNameAndState('Ready for duplicate to another quarter', 'draft').should('exist'); + overviewPage.getObjectiveByNameAndState('Ready for duplicate to another quarter', 'draft').should('exist'); cy.contains('New duplication from backlog').should('not.exist'); - op.visitGJForTests(); - op.getObjectiveByNameAndState('New duplication from backlog', 'draft').should('exist'); + overviewPage.visitGJForTests(); + overviewPage.getObjectiveByNameAndState('New duplication from backlog', 'draft').should('exist'); }); it(`Can duplicate ongoing Objective to backlog`, () => { - op.addObjective().fillObjectiveTitle('Possible to duplicate into backlog').submit(); + overviewPage.addObjective().fillObjectiveTitle('Possible to duplicate into backlog').submit(); - op.getObjectiveByNameAndState('Possible to duplicate into backlog', 'ongoing') + overviewPage + .getObjectiveByNameAndState('Possible to duplicate into backlog', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective duplizieren'); + overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do().selectQuarter('Backlog').submit(); - op.visitBacklogQuarter(); + overviewPage.visitBacklogQuarter(); cy.contains('Possible to duplicate into backlog'); }); }); diff --git a/frontend/cypress/e2e/objective-crud.cy.ts b/frontend/cypress/e2e/objective-crud.cy.ts index 8045e09e28..06a7545d03 100644 --- a/frontend/cypress/e2e/objective-crud.cy.ts +++ b/frontend/cypress/e2e/objective-crud.cy.ts @@ -3,10 +3,10 @@ import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage'; import ObjectiveDialog from '../support/helper/dom-helper/dialogs/objectiveDialog'; describe('CRUD operations', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); cy.loginAsUser(users.gl); }); @@ -15,17 +15,18 @@ describe('CRUD operations', () => { ['draft objective title', 'save-draft', 'draft-icon.svg'], ].forEach(([objectiveTitle, buttonTestId, icon]) => { it(`Create objective, no keyresults`, () => { - op.addObjective().fillObjectiveTitle(objectiveTitle).selectQuarter('3'); + overviewPage.addObjective().fillObjectiveTitle(objectiveTitle).selectQuarter('3'); cy.getByTestId(buttonTestId).click(); - cy.visit('/?quarter=3'); - op.getObjectiveByName(objectiveTitle) + overviewPage.visitNextQuarter(); + overviewPage + .getObjectiveByName(objectiveTitle) .findByTestId('objective-state') .should('have.attr', 'src', `assets/icons/${icon}`); }); }); it(`Create objective, should display error message`, () => { - op.addObjective(); + overviewPage.addObjective(); cy.getByTestId('title').first().type('title').clear(); cy.contains('Titel muss folgende Länge haben: 2-250 Zeichen'); cy.getByTestId('save').should('be.disabled'); @@ -35,14 +36,14 @@ describe('CRUD operations', () => { it(`Create objective, cancel`, () => { const objectiveTitle = 'this is a canceled objective'; - op.addObjective().selectQuarter('3').cancel(); - cy.visit('/?quarter=3'); + overviewPage.addObjective().selectQuarter('3').cancel(); + overviewPage.visitNextQuarter(); cy.contains(objectiveTitle).should('not.exist'); }); it(`Delete existing objective`, () => { - cy.get('.objective').first().findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage.getFirstObjective().findByTestId('three-dot-menu').click(); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do() .deleteObjective() .checkTitle('Objective löschen') @@ -53,22 +54,22 @@ describe('CRUD operations', () => { }); it(`Open objective aside via click`, () => { - cy.getByTestId('objective').first().find('.title').click(); + overviewPage.getFirstObjective().find('.title').click(); cy.url().should('include', 'objective'); }); it(`update objective`, () => { const updatedTitle = 'This is an updated title'; - cy.get('.objective').first().findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage.getFirstObjective().findByTestId('three-dot-menu').click(); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do().fillObjectiveTitle(updatedTitle).submit(); cy.contains(updatedTitle).should('exist'); }); it(`Duplicate objective`, () => { const duplicatedTitle = 'This is a duplicated objective'; - cy.get('.objective').first().findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective duplizieren'); + overviewPage.getFirstObjective().findByTestId('three-dot-menu').click(); + overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do().fillObjectiveTitle(duplicatedTitle).submit(); cy.contains(duplicatedTitle).should('exist'); }); diff --git a/frontend/cypress/e2e/objective.cy.ts b/frontend/cypress/e2e/objective.cy.ts index 7a9a0add64..ebe6a41af5 100644 --- a/frontend/cypress/e2e/objective.cy.ts +++ b/frontend/cypress/e2e/objective.cy.ts @@ -4,35 +4,39 @@ import ObjectiveDialog from '../support/helper/dom-helper/dialogs/objectiveDialo import ConfirmDialog from '../support/helper/dom-helper/dialogs/confirmDialog'; describe('OKR Objective e2e tests', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); cy.loginAsUser(users.gl); }); describe('tests via click', () => { it(`Release Objective from Draft to Ongoing`, () => { - op.addObjective().fillObjectiveTitle('A objective in state draft').submitDraftObjective(); + overviewPage.addObjective().fillObjectiveTitle('A objective in state draft').submitDraftObjective(); - op.getObjectiveByNameAndState('A objective in state draft', 'draft').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective veröffentlichen'); + overviewPage + .getObjectiveByNameAndState('A objective in state draft', 'draft') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective veröffentlichen'); ConfirmDialog.do() .checkTitle('Objective veröffentlichen') .checkDescription('Soll dieses Objective veröffentlicht werden?') .submit(); - op.getObjectiveByNameAndState('A objective in state draft', 'ongoing').should('exist'); + overviewPage.getObjectiveByNameAndState('A objective in state draft', 'ongoing').should('exist'); }); it(`Complete Objective with Successful`, () => { - op.addObjective().fillObjectiveTitle('We want to complete this successful').submit(); + overviewPage.addObjective().fillObjectiveTitle('We want to complete this successful').submit(); - op.getObjectiveByNameAndState('We want to complete this successful', 'ongoing') + overviewPage + .getObjectiveByNameAndState('We want to complete this successful', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective abschliessen'); + overviewPage.selectFromThreeDotMenu('Objective abschliessen'); cy.contains('Bewertung'); cy.contains('Objective erreicht'); @@ -44,14 +48,17 @@ describe('OKR Objective e2e tests', () => { cy.getByTestId('successful').click(); cy.getByTestId('submit').click(); - op.getObjectiveByNameAndState('We want to complete this successful', 'successful'); + overviewPage.getObjectiveByNameAndState('We want to complete this successful', 'successful'); }); it(`Complete Objective with Not-Successful`, () => { - op.addObjective().fillObjectiveTitle('A not successful objective').submit(); + overviewPage.addObjective().fillObjectiveTitle('A not successful objective').submit(); - op.getObjectiveByNameAndState('A not successful objective', 'ongoing').findByTestId('three-dot-menu').click(); - op.selectFromThreeDotMenu('Objective abschliessen'); + overviewPage + .getObjectiveByNameAndState('A not successful objective', 'ongoing') + .findByTestId('three-dot-menu') + .click(); + overviewPage.selectFromThreeDotMenu('Objective abschliessen'); cy.contains('Bewertung'); cy.contains('Objective erreicht'); @@ -63,103 +70,116 @@ describe('OKR Objective e2e tests', () => { cy.getByTestId('not-successful').click(); cy.getByTestId('submit').click(); - op.getObjectiveByNameAndState('A not successful objective', 'not-successful'); + overviewPage.getObjectiveByNameAndState('A not successful objective', 'not-successful'); }); it(`Reopen Successful Objective`, () => { - op.addObjective().fillObjectiveTitle('This objective will be reopened after').submit(); + overviewPage.addObjective().fillObjectiveTitle('This objective will be reopened after').submit(); - op.getObjectiveByNameAndState('This objective will be reopened after', 'ongoing') + overviewPage + .getObjectiveByNameAndState('This objective will be reopened after', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective abschliessen'); + overviewPage.selectFromThreeDotMenu('Objective abschliessen'); cy.getByTestId('successful').click(); cy.getByTestId('submit').click(); cy.wait(500); - op.getObjectiveByNameAndState('This objective will be reopened after', 'successful') + overviewPage + .getObjectiveByNameAndState('This objective will be reopened after', 'successful') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective wiedereröffnen'); + overviewPage.selectFromThreeDotMenu('Objective wiedereröffnen'); ConfirmDialog.do() .checkTitle('Objective wiedereröffnen') .checkDescription('Soll dieses Objective wiedereröffnet werden?') .submit(); - op.getObjectiveByNameAndState('This objective will be reopened after', 'ongoing').should('exist'); + overviewPage.getObjectiveByNameAndState('This objective will be reopened after', 'ongoing').should('exist'); }); it(`Cancel Reopen Successful Objective`, () => { - op.addObjective().fillObjectiveTitle('The reopening of this objective will be canceled').submit(); + overviewPage.addObjective().fillObjectiveTitle('The reopening of this objective will be canceled').submit(); - op.getObjectiveByNameAndState('The reopening of this objective will be canceled', 'ongoing') + overviewPage + .getObjectiveByNameAndState('The reopening of this objective will be canceled', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective abschliessen'); + overviewPage.selectFromThreeDotMenu('Objective abschliessen'); cy.getByTestId('successful').click(); cy.getByTestId('submit').click(); cy.wait(500); - op.getObjectiveByNameAndState('he reopening of this objective will be canceled', 'successful') + overviewPage + .getObjectiveByNameAndState('he reopening of this objective will be canceled', 'successful') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective wiedereröffnen'); + overviewPage.selectFromThreeDotMenu('Objective wiedereröffnen'); ConfirmDialog.do() .checkTitle('Objective wiedereröffnen') .checkDescription('Soll dieses Objective wiedereröffnet werden?') .cancel(); - op.getObjectiveByNameAndState('The reopening of this objective will be canceled', 'successful').should('exist'); + overviewPage + .getObjectiveByNameAndState('The reopening of this objective will be canceled', 'successful') + .should('exist'); }); it('Cancel Ongoing objective back to draft state', () => { - op.addObjective().fillObjectiveTitle('This objective will be returned to draft state').submit(); + overviewPage.addObjective().fillObjectiveTitle('This objective will be returned to draft state').submit(); - op.getObjectiveByNameAndState('This objective will be returned to draft state', 'ongoing') + overviewPage + .getObjectiveByNameAndState('This objective will be returned to draft state', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective als Draft speichern'); + overviewPage.selectFromThreeDotMenu('Objective als Draft speichern'); ConfirmDialog.do() .checkTitle('Objective als Draft speichern') .checkDescription('Soll dieses Objective als Draft gespeichert werden?') .submit(); - op.getObjectiveByNameAndState('This objective will be returned to draft state', 'draft').should('exist'); + overviewPage + .getObjectiveByNameAndState('This objective will be returned to draft state', 'draft') + .should('exist'); }); it('Ongoing objective back to draft state', () => { - op.addObjective().fillObjectiveTitle('Putting this objective back to draft state will be canceled').submit(); + overviewPage + .addObjective() + .fillObjectiveTitle('Putting this objective back to draft state will be canceled') + .submit(); - op.getObjectiveByNameAndState('Putting this objective back to draft state will be canceled', 'ongoing') + overviewPage + .getObjectiveByNameAndState('Putting this objective back to draft state will be canceled', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective als Draft speichern'); + overviewPage.selectFromThreeDotMenu('Objective als Draft speichern'); ConfirmDialog.do() .checkTitle('Objective als Draft speichern') .checkDescription('Soll dieses Objective als Draft gespeichert werden?') .cancel(); - op.getObjectiveByNameAndState('Putting this objective back to draft state will be canceled', 'ongoing').should( - 'exist', - ); + overviewPage + .getObjectiveByNameAndState('Putting this objective back to draft state will be canceled', 'ongoing') + .should('exist'); }); it(`Search for Objective`, () => { - op.addObjective().fillObjectiveTitle('Search after this objective').submit(); + overviewPage.addObjective().fillObjectiveTitle('Search after this objective').submit(); - op.addObjective().fillObjectiveTitle('We dont want to search for this').submit(); + overviewPage.addObjective().fillObjectiveTitle('We dont want to search for this').submit(); cy.contains('Search after this objective'); cy.contains('We dont want to search for this'); @@ -193,28 +213,29 @@ describe('OKR Objective e2e tests', () => { }); it(`Create Objective in other quarter`, () => { - op.addObjective().fillObjectiveTitle('Objective in quarter 3').selectQuarter('3').submit(); + overviewPage.addObjective().fillObjectiveTitle('Objective in quarter 3').selectQuarter('3').submit(); cy.contains('Objective in quarter 3').should('not.exist'); - op.visitNextQuarter(); + overviewPage.visitNextQuarter(); cy.contains('Objective in quarter 3'); }); it(`Edit Objective and move to other quarter`, () => { - op.addObjective().fillObjectiveTitle('Move to another quarter on edit').submit(); + overviewPage.addObjective().fillObjectiveTitle('Move to another quarter on edit').submit(); - op.getObjectiveByNameAndState('Move to another quarter on edit', 'ongoing') + overviewPage + .getObjectiveByNameAndState('Move to another quarter on edit', 'ongoing') .findByTestId('three-dot-menu') .click(); - op.selectFromThreeDotMenu('Objective bearbeiten'); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do().selectQuarter('3').submit(); cy.contains('Move to another quarter on edit').should('not.exist'); - op.visitNextQuarter(); + overviewPage.visitNextQuarter(); cy.contains('Move to another quarter on edit'); }); }); diff --git a/frontend/cypress/e2e/overview.cy.ts b/frontend/cypress/e2e/overview.cy.ts index f8dff7e0d8..4528a5fb15 100644 --- a/frontend/cypress/e2e/overview.cy.ts +++ b/frontend/cypress/e2e/overview.cy.ts @@ -7,12 +7,11 @@ describe('OKR Overview', () => { }); it('should have the current quarter with label Aktuell', () => { - cy.visit('/?quarter=2'); cy.getByTestId('quarterFilter').contains('Aktuell'); }); it('Check order of teams', () => { - FilterHelper.do().toggleOption('Alle'); + FilterHelper.do().optionShouldNotBeSelected('Alle').toggleOption('Alle'); const textsExpectedOrder = ['LoremIpsum', 'Puzzle ITC', '/BBT', 'we are cube.³']; cy.get('.team-title:contains("we are cube.³")'); cy.get('.team-title').then((elements) => { diff --git a/frontend/cypress/e2e/scoring.cy.ts b/frontend/cypress/e2e/scoring.cy.ts index 9e36a7eea5..e86da67685 100644 --- a/frontend/cypress/e2e/scoring.cy.ts +++ b/frontend/cypress/e2e/scoring.cy.ts @@ -5,11 +5,11 @@ import { Unit } from '../../src/app/shared/types/enums/Unit'; import KeyResultDetailPage from '../support/helper/dom-helper/pages/keyResultDetailPage'; describe('Scoring component e2e tests', () => { - let op = new CyOverviewPage(); + let overviewPage = new CyOverviewPage(); let keyresultDetailPage = new KeyResultDetailPage(); beforeEach(() => { - op = new CyOverviewPage(); + overviewPage = new CyOverviewPage(); keyresultDetailPage = new KeyResultDetailPage(); cy.loginAsUser(users.gl); }); @@ -34,7 +34,9 @@ describe('Scoring component e2e tests', () => { keyresultDetailPage.close(); cy.validateScoring(true, percentage); - op.getKeyResultByName(`Metric kr with check-in value ${value}`).not(':contains(*[class="scoring-error-badge"])'); + overviewPage + .getKeyResultByName(`Metric kr with check-in value ${value}`) + .not(':contains(*[class="scoring-error-badge"])'); }); }); @@ -55,13 +57,14 @@ describe('Scoring component e2e tests', () => { keyresultDetailPage.close(); cy.validateScoring(true, 0); - op.getKeyResultByName(`Check indicator with value ${value}`).get('.scoring-error-badge'); + overviewPage.getKeyResultByName(`Check indicator with value ${value}`).get('.scoring-error-badge'); }); }); [['fail'], ['commit'], ['target'], ['stretch']].forEach(([zoneName]) => { it('Create ordinal checkin and validate value of scoring component', () => { - op.addKeyResult() + overviewPage + .addKeyResult() .fillKeyResultTitle('Ordinal scoring keyresult') .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') .checkForDialogTextOrdinal() diff --git a/frontend/cypress/e2e/tab.cy.ts b/frontend/cypress/e2e/tab.cy.ts index 1ebd30711f..3a6a685159 100644 --- a/frontend/cypress/e2e/tab.cy.ts +++ b/frontend/cypress/e2e/tab.cy.ts @@ -4,7 +4,7 @@ import { Unit } from '../../src/app/shared/types/enums/Unit'; import KeyResultDetailPage from '../support/helper/dom-helper/pages/keyResultDetailPage'; describe('Tab workflow tests', () => { - let overviewPage: CyOverviewPage; + let overviewPage = new CyOverviewPage(); beforeEach(() => { cy.loginAsUser(users.gl); overviewPage = new CyOverviewPage(); diff --git a/frontend/cypress/e2e/teammanagement.cy.ts b/frontend/cypress/e2e/teammanagement.cy.ts index b0e8bbfab7..5603e88143 100644 --- a/frontend/cypress/e2e/teammanagement.cy.ts +++ b/frontend/cypress/e2e/teammanagement.cy.ts @@ -4,6 +4,7 @@ import ConfirmDialog from '../support/helper/dom-helper/dialogs/confirmDialog'; import TeammanagementPage from '../support/helper/dom-helper/pages/teammanagementPage'; import CyOverviewPage from '../support/helper/dom-helper/pages/overviewPage'; import InviteMembersDialog from '../support/helper/dom-helper/dialogs/inviteMembersDialog'; +import FilterHelper from '../support/helper/dom-helper/filterHelper'; describe('Team management tests', () => { const teamName = uniqueSuffix('New Team'); @@ -16,8 +17,7 @@ describe('Team management tests', () => { it('should preserve team filter', () => { CyOverviewPage.do().visitViaURL(); - cy.get('mat-chip:visible:contains("/BBT")').click(); - cy.get('mat-chip:visible:contains("Puzzle ITC")').click(); + FilterHelper.do().toggleOption('/BBT').toggleOption('Puzzle ITC'); checkTeamsSelected(); CyOverviewPage.do().visitTeammanagement(); checkTeamsSelected(); @@ -29,9 +29,7 @@ describe('Team management tests', () => { }); function checkTeamsSelected() { - cy.url().should('include', 'teams='); - cy.url().should('include', '6'); - cy.url().should('include', '4'); + FilterHelper.do().optionShouldBeSelected('LoremIpsum').optionShouldBeSelected('/BBT'); } }); diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts index ebe710c7ec..d984f8b7a5 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts @@ -19,4 +19,9 @@ export default class CheckInHistoryDialog extends Dialog { getPage(): Chainable { return cy.get('app-check-in-history-dialog'); } + + checkForAttribute(title: string, value: string) { + cy.get('mat-dialog-container').contains(value).parent().should('contain', title); + return this; + } } diff --git a/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts b/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts index e1d691d8f0..e261cc4efe 100644 --- a/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts +++ b/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts @@ -63,6 +63,10 @@ export default class CyOverviewPage extends Page { return cy.contains('.team-title', teamName).parentsUntil('#overview').last(); } + getFirstObjective() { + return cy.get('.objective').first(); + } + getObjectiveByNameAndState(objectiveName: string, state: string) { this.getObjectivesByNameAndState(objectiveName, state).last().as('objective').scrollIntoView(); return cy.get('@objective');