Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/1238 Consistent button color schema #1315

Merged
merged 15 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions frontend/cypress/e2e/check-in.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 14 additions & 0 deletions frontend/cypress/e2e/key-result.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
});
32 changes: 8 additions & 24 deletions frontend/cypress/e2e/objective-backlog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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')
Expand All @@ -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');
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
20 changes: 8 additions & 12 deletions frontend/cypress/e2e/objective-crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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()
Expand All @@ -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');
});
Expand Down
84 changes: 57 additions & 27 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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');

Expand All @@ -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');

Expand All @@ -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');

Expand All @@ -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');

Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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'))
ManuelMoeri marked this conversation as resolved.
Show resolved Hide resolved
.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', () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/tab.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
30 changes: 28 additions & 2 deletions frontend/cypress/e2e/team-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"', () => {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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')
Expand Down
6 changes: 6 additions & 0 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Loading
Loading