diff --git a/frontend/cypress/e2e/check-in.cy.ts b/frontend/cypress/e2e/check-in.cy.ts index f5505ccdef..fc1f6a5eee 100644 --- a/frontend/cypress/e2e/check-in.cy.ts +++ b/frontend/cypress/e2e/check-in.cy.ts @@ -455,6 +455,19 @@ describe('okr check-in', () => { cy.contains('This should not appear anywhere!') .should('not.exist'); }); + + it('should have a primary button on every check-in dialog', () => { + keyResultDetailPage.visit('Very important keyresult') + .createCheckIn() + .run(cy.buttonShouldBePrimary('submit-check-in')) + .cancel(); + + keyResultDetailPage + .showAllCheckIns() + .run(cy.buttonShouldBePrimary('close-button')) + .editLatestCheckIn() + .run(cy.buttonShouldBePrimary('submit-check-in')); + }); }); function isChecked(element: string, checked = true) { diff --git a/frontend/cypress/e2e/key-result.cy.ts b/frontend/cypress/e2e/key-result.cy.ts index 3fc0068c73..631cbd9595 100644 --- a/frontend/cypress/e2e/key-result.cy.ts +++ b/frontend/cypress/e2e/key-result.cy.ts @@ -453,4 +453,18 @@ describe('okr key-result', () => { cy.get('A keyresult to delete') .should('not.exist'); }); + + it('should have a primary button on every key-result dialog', () => { + overviewPage + .addKeyResult() + .fillKeyResultTitle('A key-result for testing purposes') + .withOrdinalValues('My commit zone', 'My target zone', 'My stretch goal') + .run(cy.buttonShouldBePrimary('submit')) + .submit(); + + keyResultDetailPage + .visit('A key-result for testing purposes') + .editKeyResult() + .run(cy.buttonShouldBePrimary('submit')); + }); }); diff --git a/frontend/cypress/e2e/objective-backlog.cy.ts b/frontend/cypress/e2e/objective-backlog.cy.ts index 13870e8967..d8f6adba8b 100644 --- a/frontend/cypress/e2e/objective-backlog.cy.ts +++ b/frontend/cypress/e2e/objective-backlog.cy.ts @@ -33,9 +33,7 @@ describe('okr objective backlog', () => { .submitDraftObjective(); overviewPage - .getObjectiveByNameAndState('Move to another quarter on edit', 'draft') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('Move to another quarter on edit', 'draft'); overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do() @@ -56,9 +54,7 @@ describe('okr objective backlog', () => { .submit(); overviewPage - .getObjectiveByNameAndState('We can not move this to backlog', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('We can not move this to backlog', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); cy.get('select#quarter') @@ -73,9 +69,7 @@ describe('okr objective backlog', () => { .fillObjectiveTitle('We can not release this') .submitDraftObjective(); - overviewPage.getObjectiveByNameAndState('We can not release this', 'draft') - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective('We can not release this', 'draft'); overviewPage.selectFromThreeDotMenu('Objective veröffentlichen'); cy.contains('Objective veröffentlichen'); @@ -112,9 +106,7 @@ describe('okr objective backlog', () => { .submitDraftObjective(); overviewPage - .getObjectiveByNameAndState('This is possible for edit', 'draft') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('This is possible for edit', 'draft'); overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do() @@ -131,9 +123,7 @@ describe('okr objective backlog', () => { .submitDraftObjective(); overviewPage - .getObjectiveByNameAndState('This goes to other quarter later', 'draft') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('This goes to other quarter later', 'draft'); overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do() @@ -151,9 +141,7 @@ describe('okr objective backlog', () => { .submitDraftObjective(); overviewPage - .getObjectiveByNameAndState('Ready for duplicate in backlog', 'draft') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('Ready for duplicate in backlog', 'draft'); overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do() @@ -170,9 +158,7 @@ describe('okr objective backlog', () => { .fillObjectiveTitle('Ready for duplicate to another quarter') .submitDraftObjective(); overviewPage - .getObjectiveByNameAndState('Ready for duplicate to another quarter', 'draft') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('Ready for duplicate to another quarter', 'draft'); overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do() @@ -195,9 +181,7 @@ describe('okr objective backlog', () => { .submit(); overviewPage - .getObjectiveByNameAndState('Possible to duplicate into backlog', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('Possible to duplicate into backlog', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective duplizieren'); ObjectiveDialog.do() diff --git a/frontend/cypress/e2e/objective-crud.cy.ts b/frontend/cypress/e2e/objective-crud.cy.ts index d915ed9c2a..c60c10eb0b 100644 --- a/frontend/cypress/e2e/objective-crud.cy.ts +++ b/frontend/cypress/e2e/objective-crud.cy.ts @@ -63,9 +63,8 @@ describe('crud operations', () => { overviewPage.addObjective() .fillObjectiveTitle(objectiveTitle) .submit(); - overviewPage.getObjectiveByName(objectiveTitle) - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective(objectiveTitle); + overviewPage.selectFromThreeDotMenu('Objective löschen'); ConfirmDialog.do() .checkForContentOnDialog('Objective löschen') @@ -80,9 +79,8 @@ describe('crud operations', () => { overviewPage.addObjective() .fillObjectiveTitle(objectiveTitle) .submit(); - overviewPage.getObjectiveByName(objectiveTitle) - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective(objectiveTitle); + overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do() .deleteObjective() @@ -99,18 +97,16 @@ describe('crud operations', () => { .fillObjectiveTitle(objectiveTitle) .submit(); - overviewPage.getObjectiveByName(objectiveTitle) - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective(objectiveTitle); + overviewPage.selectFromThreeDotMenu('Objective abschliessen'); cy.getByTestId('successful') .click(); cy.getByTestId('submit') .click(); - overviewPage.getObjectiveByName(objectiveTitle) - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective(objectiveTitle); + cy.contains('Objective löschen') .should('not.exist'); }); diff --git a/frontend/cypress/e2e/objective.cy.ts b/frontend/cypress/e2e/objective.cy.ts index a811370601..9d67058d81 100644 --- a/frontend/cypress/e2e/objective.cy.ts +++ b/frontend/cypress/e2e/objective.cy.ts @@ -16,10 +16,7 @@ describe('okr objective', () => { .fillObjectiveTitle('A objective in state draft') .submitDraftObjective(); - overviewPage - .getObjectiveByNameAndState('A objective in state draft', 'draft') - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective('A objective in state draft', 'draft'); overviewPage.selectFromThreeDotMenu('Objective veröffentlichen'); ConfirmDialog.do() @@ -57,15 +54,12 @@ describe('okr objective', () => { cy.contains(comment); }); - it('should reopen successful objective', () => { + it.only('should reopen successful objective', () => { overviewPage.addObjective() .fillObjectiveTitle('This objective will be reopened after') .submit(); - overviewPage - .getObjectiveByNameAndState('This objective will be reopened after', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + overviewPage.openThreeDotMenuOfObjective('This objective will be reopened after', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective abschliessen'); @@ -77,9 +71,7 @@ describe('okr objective', () => { cy.wait(500); overviewPage - .getObjectiveByNameAndState('This objective will be reopened after', 'successful') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('This objective will be reopened after', 'successful'); overviewPage.selectFromThreeDotMenu('Objective wiedereröffnen'); @@ -98,9 +90,7 @@ describe('okr objective', () => { .submit(); overviewPage - .getObjectiveByNameAndState('The reopening of this objective will be canceled', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('The reopening of this objective will be canceled', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective abschliessen'); @@ -112,9 +102,7 @@ describe('okr objective', () => { cy.wait(500); overviewPage - .getObjectiveByNameAndState('he reopening of this objective will be canceled', 'successful') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('he reopening of this objective will be canceled', 'successful'); overviewPage.selectFromThreeDotMenu('Objective wiedereröffnen'); @@ -134,9 +122,7 @@ describe('okr objective', () => { .submit(); overviewPage - .getObjectiveByNameAndState('This objective will be returned to draft state', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('This objective will be returned to draft state', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective als Draft speichern'); ConfirmDialog.do() @@ -156,9 +142,7 @@ describe('okr objective', () => { .submit(); overviewPage - .getObjectiveByNameAndState('Putting this objective back to draft state will be canceled', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('Putting this objective back to draft state will be canceled', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective als Draft speichern'); ConfirmDialog.do() @@ -251,9 +235,7 @@ describe('okr objective', () => { .submit(); overviewPage - .getObjectiveByNameAndState('Move to another quarter on edit', 'ongoing') - .findByTestId('three-dot-menu') - .click(); + .openThreeDotMenuOfObjective('Move to another quarter on edit', 'ongoing'); overviewPage.selectFromThreeDotMenu('Objective bearbeiten'); ObjectiveDialog.do() @@ -266,6 +248,54 @@ describe('okr objective', () => { overviewPage.visitNextQuarter(); cy.contains('Move to another quarter on edit'); }); + + it('should have primary button on all objective dialogs', () => { + overviewPage + .addObjective() + .fillObjectiveTitle('A objective for testing purposes') + .run(cy.buttonShouldBePrimary('save-draft')) + .submit(); + + overviewPage + .openThreeDotMenuOfObjective('A objective for testing purposes') + .selectFromThreeDotMenu('Objective bearbeiten'); + ObjectiveDialog.do() + .run(cy.buttonShouldBePrimary('save')) + .cancel(); + + overviewPage + .openThreeDotMenuOfObjective('A objective for testing purposes') + .selectFromThreeDotMenu('Objective abschliessen'); + cy.getByTestId('successful') + .click(); + cy.buttonShouldBePrimary('submit'); + cy.getByTestId('cancel') + .click(); + + overviewPage + .openThreeDotMenuOfObjective('A objective for testing purposes') + .selectFromThreeDotMenu('Objective als Draft speichern'); + ConfirmDialog.do() + .run(cy.buttonShouldBePrimary('confirm-yes')) + .cancel(); + + overviewPage + .openThreeDotMenuOfObjective('A objective for testing purposes') + .selectFromThreeDotMenu('Objective löschen'); + ConfirmDialog.do() + .run(cy.buttonShouldBePrimary('confirm-yes')) + .cancel(); + + overviewPage + .duplicateObjective('A objective for testing purposes') + .run(cy.buttonShouldBePrimary('save')) + .cancel(); + + overviewPage + .getObjectiveByName('A objective for testing purposes') + .click(); + cy.buttonShouldBePrimary('add-key-result-objective-detail'); + }); }); describe('tests via keyboard', () => { diff --git a/frontend/cypress/e2e/tab.cy.ts b/frontend/cypress/e2e/tab.cy.ts index ab40126c3b..d7d0f0aa11 100644 --- a/frontend/cypress/e2e/tab.cy.ts +++ b/frontend/cypress/e2e/tab.cy.ts @@ -204,7 +204,7 @@ describe('tabbing workflows', () => { cy.contains('Check-in History'); focusedShouldHaveTestId('close-dialog'); tabAndCheck('edit-check-in'); - tabAndCheck('closeButton', 'Schliessen'); + tabAndCheck('close-button', 'Schliessen'); cy.realPress('Enter'); tabAndCheck('add-check-in', 'Check-in erfassen'); tabAndCheck('edit-keyResult', 'Key Result bearbeiten'); diff --git a/frontend/cypress/e2e/team-management.cy.ts b/frontend/cypress/e2e/team-management.cy.ts index 9b78a576fa..51afa94883 100644 --- a/frontend/cypress/e2e/team-management.cy.ts +++ b/frontend/cypress/e2e/team-management.cy.ts @@ -348,6 +348,32 @@ describe('okr team-management', () => { cy.getByTestId('edit-okr-champion-readonly') .contains('Nein'); }); + + it('should have primary button on all team-management dialogs', () => { + teamManagementPage.elements.registerMember() + .click(); + InviteMembersDialog.do() + .run(cy.buttonShouldBePrimary('invite')) + .close(); + + cy.contains('LoremIpsum') + .click(); + cy.getByTestId('edit-team-button') + .click(); + + cy.buttonShouldBePrimary('save'); + cy.getByTestId('cancel') + .click(); + + cy.getByTestId('add-team-member') + .click(); + cy.getByTestId('search-member-to-add') + .click(); + cy.get('span') + .contains('Paco Eggimann') + .click(); + cy.buttonShouldBePrimary('save'); + }); }); describe('as "BL"', () => { @@ -375,7 +401,7 @@ describe('okr team-management', () => { .click(); cy.getByTestId('teamMoreButton') .should('not.exist'); - cy.getByTestId('editTeamButton') + cy.getByTestId('edit-team-button') .should('not.exist'); cy.getByTestId('member-list-more') .should('not.exist'); @@ -562,7 +588,7 @@ function checkRolesForEsha() { function editTeamNameAndTest(teamName: string) { cy.intercept('PUT', '**/teams/*') .as('saveTeam'); - cy.getByTestId('editTeamButton') + cy.getByTestId('edit-team-button') .click(); cy.getByTestId('add-team-name') .as('team-name') diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 51ba71718a..8877963ee4 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -75,6 +75,12 @@ Cypress.Commands.add('validateScoring', (isOverview: boolean, percentage: number validateScoring(isOverview, percentage); }); +Cypress.Commands.add('buttonShouldBePrimary', (buttonId: string) => { + cy.getByTestId(buttonId) + .should('have.attr', 'color', 'primary') + .and('have.attr', 'mat-flat-button'); +}); + function loginWithCredentials(username: string, password: string) { cy.visit('/'); cy.intercept('GET', '**/users/current') diff --git a/frontend/cypress/support/component.ts b/frontend/cypress/support/component.ts index d373c2a707..caf1fad3da 100644 --- a/frontend/cypress/support/component.ts +++ b/frontend/cypress/support/component.ts @@ -7,6 +7,7 @@ declare global { loginAsUser(user: any): Chainable; logout(): void; getByTestId(testsId: string, text?: string): Chainable; + buttonShouldBePrimary(buttonId: string): Chainable; findByTestId(testId: string, text?: string): Chainable; pressUntilContains(text: string, key: keyof typeof keyCodeDefinitions): void; tabForward(): void; diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts index 4fc5053e8c..819c54ac0a 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts @@ -8,7 +8,7 @@ export default class CheckInHistoryDialog extends Dialog { } override cancel() { - cy.getByTestId('closeButton') + cy.getByTestId('close-button') .click(); } diff --git a/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts b/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts index 4a48d7e3d4..e06f6f2444 100644 --- a/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts +++ b/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts @@ -164,6 +164,18 @@ export default class CyOverviewPage extends Page { .filter(filterByKeyResultName(keyResultName)); } + openThreeDotMenuOfObjective(objectiveName: string, objectiveState?: string) { + objectiveState + ? this.getObjectiveByNameAndState(objectiveName, objectiveState) + .findByTestId('three-dot-menu') + .click() + : this + .getObjectiveByName(objectiveName) + .findByTestId('three-dot-menu') + .click(); + return this; + } + selectFromThreeDotMenu(optionName: string) { cy.contains(optionName) .should('exist'); diff --git a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.html b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.html index d7c0c51a4c..e69dfbceed 100644 --- a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.html +++ b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.html @@ -69,7 +69,7 @@