Skip to content

Commit

Permalink
apply eslint
Browse files Browse the repository at this point in the history
squash branch

update eslint config

run formatter

fix tests

revert to single quotes

regen package-lock

move eslint dependendencies to devDependencies and update comment in eslint-config

remove not needed parent clings

fix typo in comment in scoring component tests

put both statements inside if statement

change asignment of args in global ts

add curly to eslint config

put curly into quotes

update comments to clarify that they are for lint

replace multiple ifs with one switch

replace multiple ifs with one switch

replace multiple ifs with one switch

turn no-non-null-assertion off and bring back all usages of

add strict equality

fix eslint errors

remove not needed comment

add todo for error handling oauth interceptor

update comments so its clear that linter needs them

revert change made accidentally

fix frontend unit tests

revert changes made accidentally

bring back all not null assertions and create some switch statements in scoring component for readability
  • Loading branch information
kcinay055679 authored and nevio18324 committed Dec 24, 2024
1 parent d984f1f commit 08e3d38
Show file tree
Hide file tree
Showing 85 changed files with 1,127 additions and 662 deletions.
18 changes: 11 additions & 7 deletions frontend/cypress/e2e/check-in.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('OKR Check-in e2e tests', () => {
cy.loginAsUser(users.gl);
});

it(`Create checkin metric`, () => {
it('Create checkin metric', () => {
overviewPage
.addKeyResult()
.fillKeyResultTitle('Very important keyresult')
Expand All @@ -40,7 +40,7 @@ describe('OKR Check-in e2e tests', () => {
cy.contains('We bought a new house');
});

it(`Create checkin metric with confidence 0`, () => {
it('Create checkin metric with confidence 0', () => {
overviewPage
.addKeyResult()
.fillKeyResultTitle('Very important keyresult')
Expand All @@ -62,7 +62,7 @@ describe('OKR Check-in e2e tests', () => {
cy.contains('We bought a new house');
});

it(`Create checkin metric with value below baseline`, () => {
it('Create checkin metric with value below baseline', () => {
overviewPage
.addKeyResult()
.fillKeyResultTitle('This will not be good')
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('OKR Check-in e2e tests', () => {
cy.contains('STRETCH');
});

it(`Should display confirm dialog when creating checkin on draft objective`, () => {
it('Should display confirm dialog when creating checkin on draft objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('draft objective title')
.selectQuarter('3')
Expand All @@ -271,7 +271,7 @@ describe('OKR Check-in e2e tests', () => {
.checkDescription('Dein Objective befindet sich noch im DRAFT Status. Möchtest du das Check-in trotzdem erfassen?');
});

it(`Should only display last value div if last checkin is present`, () => {
it('Should only display last value div if last checkin is present', () => {
const objectiveName = uniqueSuffix('new objective');

overviewPage.addObjective()
Expand Down Expand Up @@ -312,8 +312,12 @@ function getCurrentDate() {

let dd_str = '' + dd;
let mm_str = '' + mm;
if (dd < 10) dd_str = '0' + dd_str;
if (mm < 10) mm_str = '0' + mm_str;
if (dd < 10) {
dd_str = '0' + dd_str;
}
if (mm < 10) {
mm_str = '0' + mm_str;
}

return dd_str + '.' + mm_str + '.' + yyyy;
}
16 changes: 8 additions & 8 deletions frontend/cypress/e2e/objective-backlog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('OKR Objective Backlog e2e tests', () => {
cy.loginAsUser(users.gl);
});

it(`Create Objective in backlog quarter should not have save button`, () => {
it('Create Objective in backlog quarter should not have save button', () => {
overviewPage
.addObjective()
.fillObjectiveTitle('Objective in quarter backlog')
Expand All @@ -27,7 +27,7 @@ describe('OKR Objective Backlog e2e tests', () => {
cy.contains('Objective in quarter backlog');
});

it(`Edit Objective and move to backlog`, () => {
it('Edit Objective and move to backlog', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Move to another quarter on edit')
.submitDraftObjective();
Expand All @@ -50,7 +50,7 @@ describe('OKR Objective Backlog e2e tests', () => {
cy.contains('This goes now to backlog');
});

it(`Edit ongoing Objective can not choose backlog in quarter select`, () => {
it('Edit ongoing Objective can not choose backlog in quarter select', () => {
overviewPage.addObjective()
.fillObjectiveTitle('We can not move this to backlog')
.submit();
Expand All @@ -67,7 +67,7 @@ describe('OKR Objective Backlog e2e tests', () => {
.should('not.contain', 'Backlog');
});

it(`Can release Objective to another quarter from backlog`, () => {
it('Can release Objective to another quarter from backlog', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('We can not release this')
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('OKR Objective Backlog e2e tests', () => {
cy.contains('This is our first released objective');
});

it(`Can edit Objective title in backlog`, () => {
it('Can edit Objective title in backlog', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('This is possible for edit')
Expand All @@ -124,7 +124,7 @@ describe('OKR Objective Backlog e2e tests', () => {
overviewPage.getObjectiveByNameAndState('My new title', 'draft');
});

it(`Can edit Objective in backlog and change quarter`, () => {
it('Can edit Objective in backlog and change quarter', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('This goes to other quarter later')
Expand All @@ -144,7 +144,7 @@ describe('OKR Objective Backlog e2e tests', () => {
overviewPage.getObjectiveByNameAndState('This goes to other quarter later', 'draft');
});

it(`Can duplicate in backlog`, () => {
it('Can duplicate in backlog', () => {
overviewPage.visitBacklogQuarter();
overviewPage.addObjective()
.fillObjectiveTitle('Ready for duplicate in backlog')
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('OKR Objective Backlog e2e tests', () => {
.should('exist');
});

it(`Can duplicate ongoing Objective to backlog`, () => {
it('Can duplicate ongoing Objective to backlog', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Possible to duplicate into backlog')
.submit();
Expand Down
14 changes: 7 additions & 7 deletions frontend/cypress/e2e/objective-crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('CRUD operations', () => {
'draft-icon.svg']].forEach(([objectiveTitle,
buttonTestId,
icon]) => {
it(`Create objective, no keyresults`, () => {
it('Create objective, no keyresults', () => {
overviewPage.addObjective()
.fillObjectiveTitle(objectiveTitle)
.selectQuarter('3');
Expand All @@ -32,7 +32,7 @@ describe('CRUD operations', () => {
});
});

it(`Create objective, should display error message`, () => {
it('Create objective, should display error message', () => {
overviewPage.addObjective();
cy.getByTestId('title')
.first()
Expand All @@ -47,7 +47,7 @@ describe('CRUD operations', () => {
.should('not.be.disabled');
});

it(`Create objective, cancel`, () => {
it('Create objective, cancel', () => {
const objectiveTitle = 'this is a canceled objective';
overviewPage.addObjective()
.selectQuarter('3')
Expand All @@ -57,7 +57,7 @@ describe('CRUD operations', () => {
.should('not.exist');
});

it(`Delete existing objective`, () => {
it('Delete existing objective', () => {
overviewPage.getFirstObjective()
.findByTestId('three-dot-menu')
.click();
Expand All @@ -69,15 +69,15 @@ describe('CRUD operations', () => {
.submit();
});

it(`Open objective aside via click`, () => {
it('Open objective aside via click', () => {
overviewPage.getFirstObjective()
.find('.title')
.click();
cy.url()
.should('include', 'objective');
});

it(`update objective`, () => {
it('update objective', () => {
const updatedTitle = 'This is an updated title';
overviewPage.getFirstObjective()
.findByTestId('three-dot-menu')
Expand All @@ -90,7 +90,7 @@ describe('CRUD operations', () => {
.should('exist');
});

it(`Duplicate objective`, () => {
it('Duplicate objective', () => {
const duplicatedTitle = 'This is a duplicated objective';
overviewPage.getFirstObjective()
.findByTestId('three-dot-menu')
Expand Down
18 changes: 9 additions & 9 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('OKR Objective e2e tests', () => {
});

describe('tests via click', () => {
it(`Release Objective from Draft to Ongoing`, () => {
it('Release Objective from Draft to Ongoing', () => {
overviewPage.addObjective()
.fillObjectiveTitle('A objective in state draft')
.submitDraftObjective();
Expand All @@ -31,7 +31,7 @@ describe('OKR Objective e2e tests', () => {
.should('exist');
});

it(`Complete Objective with Successful`, () => {
it('Complete Objective with Successful', () => {
overviewPage.addObjective()
.fillObjectiveTitle('We want to complete this successful')
.submit();
Expand All @@ -58,7 +58,7 @@ describe('OKR Objective e2e tests', () => {
overviewPage.getObjectiveByNameAndState('We want to complete this successful', 'successful');
});

it(`Complete Objective with Not-Successful`, () => {
it('Complete Objective with Not-Successful', () => {
overviewPage.addObjective()
.fillObjectiveTitle('A not successful objective')
.submit();
Expand All @@ -84,7 +84,7 @@ describe('OKR Objective e2e tests', () => {
overviewPage.getObjectiveByNameAndState('A not successful objective', 'not-successful');
});

it(`Reopen Successful Objective`, () => {
it('Reopen Successful Objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('This objective will be reopened after')
.submit();
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('OKR Objective e2e tests', () => {
.should('exist');
});

it(`Cancel Reopen Successful Objective`, () => {
it('Cancel Reopen Successful Objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('The reopening of this objective will be canceled')
.submit();
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('OKR Objective e2e tests', () => {
.should('exist');
});

it(`Search for Objective`, () => {
it('Search for Objective', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Search after this objective')
.submit();
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('OKR Objective e2e tests', () => {
.should('not.exist');
});

it(`Create Objective in other quarter`, () => {
it('Create Objective in other quarter', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Objective in quarter 3')
.selectQuarter('3')
Expand All @@ -272,7 +272,7 @@ describe('OKR Objective e2e tests', () => {
cy.contains('Objective in quarter 3');
});

it(`Edit Objective and move to other quarter`, () => {
it('Edit Objective and move to other quarter', () => {
overviewPage.addObjective()
.fillObjectiveTitle('Move to another quarter on edit')
.submit();
Expand All @@ -296,7 +296,7 @@ describe('OKR Objective e2e tests', () => {
});

describe('tests via keyboard', () => {
it(`Open objective aside via enter`, () => {
it('Open objective aside via enter', () => {
cy.getByTestId('objective')
.first()
.find('[tabindex]')
Expand Down
6 changes: 3 additions & 3 deletions frontend/cypress/e2e/teammanagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ describe('Team management tests', () => {
return true;
})
.then(() => {
expect(foundEsha).to.be.true;
expect(foundEsha).to.equal(true);
});
});

Expand Down Expand Up @@ -461,7 +461,7 @@ describe('Team management tests', () => {
.trim() !== 'Findus Peterson') {
return;
}
$row.find(`[data-testId='edit-role']`)
$row.find('[data-testId=\'edit-role\']')
.click();
cy.wait(500); // wait for dialog to open
})
Expand Down Expand Up @@ -495,7 +495,7 @@ describe('Team management tests', () => {

ConfirmDialog.do()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du Findus Peterson wirklich aus dem Team '/BBT' entfernen?`)
.checkDescription('Möchtest du Findus Peterson wirklich aus dem Team \'/BBT\' entfernen?')
.submit();

cy.get('app-member-detail')
Expand Down
34 changes: 18 additions & 16 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { validateScoring } from './helper/scoringSupport';
import { keyCodeDefinitions } from 'cypress-real-events/keyCodeDefinitions';
import { pressUntilContains, doUntilSelector } from './helper/utils';
import { doUntilSelector, pressUntilContains } from './helper/utils';
import Chainable = Cypress.Chainable;

Cypress.Commands.add('loginAsUser', (user: any) => {
Expand All @@ -19,19 +19,17 @@ Cypress.Commands.add('getByTestId', (testId: string, text?: string): Chainable =
}
});

Cypress.Commands.add('findByTestId',
{ prevSubject: true },
(subject: JQuery<HTMLElement>, testId: string, text?: string): Chainable => {
const selector = `[data-testId=${testId}]`;
if (text) {
return cy.wrap(subject)
.find(selector)
.contains(text);
} else {
return cy.wrap(subject)
.find(selector);
}
});
Cypress.Commands.add('findByTestId', { prevSubject: true }, (subject: JQuery<HTMLElement>, testId: string, text?: string): Chainable => {
const selector = `[data-testId=${testId}]`;
if (text) {
return cy.wrap(subject)
.find(selector)
.contains(text);
} else {
return cy.wrap(subject)
.find(selector);
}
});

Cypress.Commands.add('pressUntilContains', (text: string, key: keyof typeof keyCodeDefinitions) => {
pressUntilContains(text, key);
Expand Down Expand Up @@ -66,8 +64,12 @@ function loginWithCredentials(username: string, password: string) {
cy.visit('/');
cy.intercept('GET', '**/users/current')
.as('getCurrentUser');
cy.origin(Cypress.env('login_url'), { args: { username,
password } }, ({ username, password }) => {
cy.origin(Cypress.env('login_url'), {
args: {
username,
password
}
}, ({ username, password }) => {
cy.get('input[name="username"]')
.type(username);
cy.get('input[name="password"]')
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './commands';
import { keyCodeDefinitions } from 'cypress-real-events/keyCodeDefinitions';

declare global {
namespace Cypress {
export namespace Cypress {
interface Chainable {
loginAsUser(user: any): Chainable;
getByTestId(testsId: string, text?: string): Chainable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class ObjectiveDialog extends Dialog {

toggleCreateKeyResults() {
cy.getByTestId('keyResult-checkbox')
.find("[type='checkbox']")
.find('[type=\'checkbox\']')
.check();
return this;
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/cypress/support/helper/dom-helper/filterHelper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { PageObjectMapperBase } from './pageObjectMapperBase';

export default class FilterHelper extends PageObjectMapperBase {
validatePage(): void {}
validatePage(): void {
// Does not need to be implemented this comment is for making linter happy
}

optionShouldBeSelected(text: string, onOverview = true): this {
if (onOverview) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ export default class CyOverviewPage extends Page {
return '';
}

validatePage(): void {}
validatePage(): void {
// Does not need to be implemented this comment is for making linter happy
}

protected doVisit(): void {
this.elements.logo()
Expand Down
Loading

0 comments on commit 08e3d38

Please sign in to comment.