Skip to content

Commit

Permalink
run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Dec 19, 2024
1 parent 20945aa commit cf7e75d
Show file tree
Hide file tree
Showing 214 changed files with 3,552 additions and 4,196 deletions.
16 changes: 8 additions & 8 deletions frontend/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { defineConfig } from "cypress";

export default defineConfig({
"e2e": {
"baseUrl": "http://pitc.okr.localhost:4200",
"experimentalMemoryManagement": true,
"testIsolation": true,
"viewportWidth": 1920,
"viewportHeight": 1080
e2e: {
baseUrl: "http://pitc.okr.localhost:4200",
experimentalMemoryManagement: true,
testIsolation: true,
viewportWidth: 1920,
viewportHeight: 1080
},
"env": {
"login_url": "http://localhost:8544"
env: {
login_url: "http://localhost:8544"
}
});
6 changes: 2 additions & 4 deletions frontend/cypress/e2e/duplicate-objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ describe("Functionality of duplicating objectives and their belonging keyResults
overviewPage
.duplicateObjective("Build a company culture that kills the competition.")
.fillObjectiveTitle(duplicatedTitle)
.excludeKeyResults([
secondKeyResultName,
thirdKeyResultName
])
.excludeKeyResults([secondKeyResultName,
thirdKeyResultName])
.submit();

overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName);
Expand Down
22 changes: 7 additions & 15 deletions frontend/cypress/e2e/objective-crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,14 @@ describe("CRUD operations", () => {
cy.loginAsUser(users.gl);
});

[
[
"ongoing objective title",
"save",
"ongoing-icon.svg"
],
[
"draft objective title",
"save-draft",
"draft-icon.svg"
]
].forEach(([
objectiveTitle,
[["ongoing objective title",
"save",
"ongoing-icon.svg"],
["draft objective title",
"save-draft",
"draft-icon.svg"]].forEach(([objectiveTitle,
buttonTestId,
icon
]) => {
icon]) => {
it("Create objective, no keyresults", () => {
overviewPage.addObjective()
.fillObjectiveTitle(objectiveTitle)
Expand Down
64 changes: 26 additions & 38 deletions frontend/cypress/e2e/scoring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,25 @@ describe("Scoring component e2e tests", () => {
});

[
[
0,
[0,
100,
10
],
[
0,
10],
[0,
100,
31
],
[
0,
31],
[0,
100,
71
],
[
0,
71],
[0,
100,
100
]
].forEach(([
baseline,
100]
].forEach(([baseline,
stretchgoal,
value
]) => {
value]) => {
it("Create metric checkin and validate value of scoring component", () => {
setupMetricKR(`Metric kr with check-in value ${value}`, baseline, stretchgoal, value);
setupMetricKR(
`Metric kr with check-in value ${value}`, baseline, stretchgoal, value
);
const percentage = getPercentageMetric(baseline, stretchgoal, value);
cy.validateScoring(false, percentage);
cy.get(".keyResult-detail-attribute-show")
Expand All @@ -60,24 +52,18 @@ describe("Scoring component e2e tests", () => {
});
});

[
[
0,
100,
-1
],
[
200,
100,
250
]
].forEach(([
baseline,
[[0,
100,
-1],
[200,
100,
250]].forEach(([baseline,
stretchgoal,
value
]) => {
value]) => {
it("show indicator that value is negative", () => {
setupMetricKR(`Check indicator with value ${value}`, baseline, stretchgoal, value);
setupMetricKR(
`Check indicator with value ${value}`, baseline, stretchgoal, value
);
cy.validateScoring(false, 0);
cy.get(".keyResult-detail-attribute-show")
.contains("Aktuell")
Expand Down Expand Up @@ -125,7 +111,9 @@ describe("Scoring component e2e tests", () => {
});
});

function setupMetricKR (name: string, baseline: number, stretchgoal: number, value: number) {
function setupMetricKR (
name: string, baseline: number, stretchgoal: number, value: number
) {
CyOverviewPage.do()
.addKeyResult()
.fillKeyResultTitle(name)
Expand Down
12 changes: 4 additions & 8 deletions frontend/cypress/e2e/team.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,13 @@ describe("OKR team e2e tests", () => {
.optionShouldNotBeSelected("/BBT")
.optionShouldNotBeSelected("we are cube");

filterHelper.validateUrlParameter("teams", [
"5",
"6"
]);
filterHelper.validateUrlParameter("teams", ["5",
"6"]);

filterHelper.toggleOption("/BBT")
.validateUrlParameter("teams", [
"4",
.validateUrlParameter("teams", ["4",
"5",
"6"
]);
"6"]);
filterHelper.toggleOption("Puzzle ITC")
.toggleOption("LoremIpsum")
.toggleOption("/BBT");
Expand Down
8 changes: 3 additions & 5 deletions frontend/cypress/e2e/teammanagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ describe("Team management tests", () => {
editTeamNameAndTest("IpsumLorem");
cy.visit("team-management");

cy.wait([
"@getUsers",
"@getTeams"
]);
cy.wait(["@getUsers",
"@getTeams"]);

cy.contains("LoremIpsum")
.should("not.exist");
Expand Down Expand Up @@ -547,7 +545,7 @@ describe("Team management tests", () => {

function closeOverlay () {
cy.get(".cdk-overlay-backdrop")
.click(-50, -50, { "force": true });
.click(-50, -50, { force: true });
}

function checkRolesForEsha () {
Expand Down
12 changes: 5 additions & 7 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Cypress.Commands.add("getByTestId", (testId: string, text?: string): Chainable =
}
});

Cypress.Commands.add("findByTestId", { "prevSubject": true }, (subject: JQuery<HTMLElement>, 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)
Expand All @@ -40,10 +40,8 @@ Cypress.Commands.add("tabForward", () => {
});

Cypress.Commands.add("tabBackward", () => {
cy.realPress([
"Shift",
"Tab"
]);
cy.realPress(["Shift",
"Tab"]);
});

Cypress.Commands.add("tabForwardUntil", (selector: string, limit?: number) => {
Expand All @@ -66,15 +64,15 @@ function loginWithCredentials (username: string, password: string) {
cy.visit("/");
cy.intercept("GET", "**/users/current")
.as("getCurrentUser");
cy.origin(Cypress.env("login_url"), { "args": { username,
cy.origin(Cypress.env("login_url"), { args: { username,
password } }, ({ username, password }) => {
cy.get("input[name=\"username\"]")
.type(username);
cy.get("input[name=\"password\"]")
.type(password);
cy.get("button[type=\"submit\"]")
.click();
cy.wait("@getCurrentUser", { "responseTimeout": 10000 });
cy.wait("@getCurrentUser", { responseTimeout: 10000 });
});
cy.url()
.then((url) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "cypress-real-events";
import { onlyOn } from "@cypress/skip-test";

Cypress.Keyboard.defaults({
"keystrokeDelay": 0
keystrokeDelay: 0
});

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import CheckInHistoryDialog from "../dialogs/checkInHistoryDialog";

export default class KeyResultDetailPage extends Page {
elements = {
"logo": () => cy.getByTestId("logo"),
"closeDrawer": () => cy.getByTestId("close-drawer"),
"addCheckin": () => cy.getByTestId("add-check-in"),
"showAllCheckins": () => cy.getByTestId("show-all-checkins"),
"editKeyResult": () => cy.getByTestId("edit-keyResult")
logo: () => cy.getByTestId("logo"),
closeDrawer: () => cy.getByTestId("close-drawer"),
addCheckin: () => cy.getByTestId("add-check-in"),
showAllCheckins: () => cy.getByTestId("show-all-checkins"),
editKeyResult: () => cy.getByTestId("edit-keyResult")
};

override validatePage () {
Expand Down Expand Up @@ -52,7 +52,7 @@ export default class KeyResultDetailPage extends Page {

close (): void {
this.elements.closeDrawer()
.click({ "force": true });
.click({ force: true });
}

visitOverview (): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { filterByKeyResultName, getKeyResults } from "../../keyResultHelper";

export default class CyOverviewPage extends Page {
elements = {
"logo": () => cy.getByTestId("logo"),
"teammanagement": () => cy.getByTestId("team-management")
logo: () => cy.getByTestId("logo"),
teammanagement: () => cy.getByTestId("team-management")
};

visitGJForTests () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import ConfirmDialog from "../dialogs/confirmDialog";

export default class TeammanagementPage extends Page {
elements = {
"logo": () => cy.getByTestId("logo"),
"teammanagement": () => cy.getByTestId("team-management"),
"backToOverview": () => cy.getByTestId("routerLink-to-overview"),
"teamMenu": () => cy.get("app-team-list"),
"memberHeader": () => cy.get("#member-header"),
"registerMember": () => cy.getByTestId("invite-member"),
"addTeam": () => cy.getByTestId("add-team"),
"teamSearch": () => AngularSearchBox.from("app-team-management-banner [data-testId=\"teamManagementSearch\"]")
logo: () => cy.getByTestId("logo"),
teammanagement: () => cy.getByTestId("team-management"),
backToOverview: () => cy.getByTestId("routerLink-to-overview"),
teamMenu: () => cy.get("app-team-list"),
memberHeader: () => cy.get("#member-header"),
registerMember: () => cy.getByTestId("invite-member"),
addTeam: () => cy.getByTestId("add-team"),
teamSearch: () => AngularSearchBox.from("app-team-management-banner [data-testId=\"teamManagementSearch\"]")
};

override validatePage () {
Expand Down
30 changes: 15 additions & 15 deletions frontend/cypress/support/helper/scoringSupport.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { isLastCheckInNegative } from "../../../src/app/shared/common";

interface ScoringValue {
"failPercent": number;
"commitPercent": number;
"targetPercent": number;
failPercent: number;
commitPercent: number;
targetPercent: number;
}

export function validateScoring (isOverview: boolean, percentage: number) {
Expand Down Expand Up @@ -85,22 +85,22 @@ function colorFromPercentage (percentage: number) {

function scoringValueFromPercentage (percentage: number): ScoringValue {
if (percentage >= 100) {
return { "failPercent": 0,
"commitPercent": 0,
"targetPercent": 0 };
return { failPercent: 0,
commitPercent: 0,
targetPercent: 0 };
} else if (percentage > 70) {
const targetPercent = (percentage - 70) * (100 / 30);
return { "failPercent": 100,
"commitPercent": 100,
"targetPercent": targetPercent };
return { failPercent: 100,
commitPercent: 100,
targetPercent: targetPercent };
} else if (percentage > 30) {
const commitPercent = (percentage - 30) * (100 / 40);
return { "failPercent": 100,
"commitPercent": commitPercent,
"targetPercent": -1 };
return { failPercent: 100,
commitPercent: commitPercent,
targetPercent: -1 };
}
const failPercent = percentage * (100 / 30);
return { "failPercent": failPercent,
"commitPercent": -1,
"targetPercent": -1 };
return { failPercent: failPercent,
commitPercent: -1,
targetPercent: -1 };
}
12 changes: 9 additions & 3 deletions frontend/cypress/support/helper/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ export function pressUntilContains (text: string, key: keyof typeof keyCodeDefin
pressUntil(key, condition);
}

export function doUntilSelector (selector: string, tab: () => void, limit = 100, count = 0) {
export function doUntilSelector (
selector: string, tab: () => void, limit = 100, count = 0
) {
const condition = (element: HTMLElement) => Cypress.$(element)
.is(selector);
doUntil(condition, tab, limit, count);
doUntil(
condition, tab, limit, count
);
}

function pressUntil (key: keyof typeof keyCodeDefinitions, condition: (elem: HTMLElement) => boolean) {
Expand All @@ -34,7 +38,9 @@ function doUntil (
return;
} else {
tab();
doUntil(condition, tab, limit, count + 1);
doUntil(
condition, tab, limit, count + 1
);
}
});
}
Loading

0 comments on commit cf7e75d

Please sign in to comment.