Skip to content

Commit

Permalink
refactor file structurepom helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 11, 2024
1 parent f83bc40 commit 3aa451f
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 45 deletions.
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/checkIn.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as users from '../fixtures/users.json';
import { onlyOn } from '@cypress/skip-test';
import { uniqueSuffix } from '../support/utils';
import { uniqueSuffix } from '../support/helper/utils';
import Chainable = Cypress.Chainable;

describe('OKR Check-in e2e tests', () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/duplicated-scoring.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as users from '../fixtures/users.json';
import { onlyOn } from '@cypress/skip-test';
import { filterByObjectiveName, getObjectiveColumns, selectFromThreeDotMenu } from '../support/objective-helper';
import { filterByObjectiveName, getObjectiveColumns, selectFromThreeDotMenu } from '../support/helper/objective-helper';

describe('e2e test for scoring adjustment on objective duplicate', () => {
beforeEach(() => {
Expand Down
16 changes: 8 additions & 8 deletions frontend/cypress/e2e/objective-backlog.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as users from '../fixtures/users.json';
import CyOverviewPage from '../support/OverviewPage';
import CyObjectiveFormPage from '../support/objectiveFormPage';
import CyOverviewPage from '../support/helper/pom-helper/pages/overviewPage';
import ObjectiveDialog from '../support/helper/pom-helper/dialogs/objectiveDialog';

describe('OKR Objective Backlog e2e tests', () => {
let op = new CyOverviewPage();
Expand Down Expand Up @@ -31,7 +31,7 @@ describe('OKR Objective Backlog e2e tests', () => {
op.getObjectiveByNameAndState('Move to another quarter on edit', 'draft').findByTestId('three-dot-menu').click();
op.selectFromThreeDotMenu('Objective bearbeiten');

CyObjectiveFormPage.with().fillObjectiveTitle('This goes now to backlog').selectQuarter('Backlog').submit();
ObjectiveDialog.with().fillObjectiveTitle('This goes now to backlog').selectQuarter('Backlog').submit();

cy.contains('This goes now to backlog').should('not.exist');

Expand Down Expand Up @@ -79,7 +79,7 @@ describe('OKR Objective Backlog e2e tests', () => {
op.getObjectiveByNameAndState('This is possible for edit', 'draft').findByTestId('three-dot-menu').click();
op.selectFromThreeDotMenu('Objective bearbeiten');

CyObjectiveFormPage.with().fillObjectiveTitle('My new title').submit();
ObjectiveDialog.with().fillObjectiveTitle('My new title').submit();

op.getObjectiveByNameAndState('My new title', 'draft');
});
Expand All @@ -91,7 +91,7 @@ describe('OKR Objective Backlog e2e tests', () => {
op.getObjectiveByNameAndState('This goes to other quarter later', 'draft').findByTestId('three-dot-menu').click();
op.selectFromThreeDotMenu('Objective bearbeiten');

CyObjectiveFormPage.with().selectQuarter('GJ ForTests').submit();
ObjectiveDialog.with().selectQuarter('GJ ForTests').submit();

op.visitGJForTests();
op.getObjectiveByNameAndState('This goes to other quarter later', 'draft');
Expand All @@ -104,7 +104,7 @@ describe('OKR Objective Backlog e2e tests', () => {
op.getObjectiveByNameAndState('Ready for duplicate in backlog', 'draft').findByTestId('three-dot-menu').click();
op.selectFromThreeDotMenu('Objective duplizieren');

CyObjectiveFormPage.with().fillObjectiveTitle('This is a new duplication in backlog').submit();
ObjectiveDialog.with().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');
Expand All @@ -118,7 +118,7 @@ describe('OKR Objective Backlog e2e tests', () => {
.click();
op.selectFromThreeDotMenu('Objective duplizieren');

CyObjectiveFormPage.with().fillObjectiveTitle('New duplication from backlog').selectQuarter('GJ ForTests').submit();
ObjectiveDialog.with().fillObjectiveTitle('New duplication from backlog').selectQuarter('GJ ForTests').submit();

op.getObjectiveByNameAndState('Ready for duplicate to another quarter', 'draft').should('exist');
cy.contains('New duplication from backlog').should('not.exist');
Expand All @@ -134,7 +134,7 @@ describe('OKR Objective Backlog e2e tests', () => {
.click();
op.selectFromThreeDotMenu('Objective duplizieren');

CyObjectiveFormPage.with().selectQuarter('Backlog').submit();
ObjectiveDialog.with().selectQuarter('Backlog').submit();

op.visitBacklogQuarter();
cy.contains('Possible to duplicate into backlog');
Expand Down
14 changes: 7 additions & 7 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as users from '../fixtures/users.json';
import { onlyOn } from '@cypress/skip-test';
import CyOverviewPage from '../support/OverviewPage';
import CyObjectiveFormPage from '../support/objectiveFormPage';
import CyConfirmComponentPage from '../support/confirmComponentPage';
import CyOverviewPage from '../support/helper/pom-helper/pages/overviewPage';
import ObjectiveDialog from '../support/helper/pom-helper/dialogs/objectiveDialog';
import ConfirmDialog from '../support/helper/pom-helper/dialogs/confirmDialog';

describe('OKR Objective e2e tests', () => {
let op = new CyOverviewPage();
Expand All @@ -19,7 +19,7 @@ describe('OKR Objective e2e tests', () => {
op.getObjectiveByNameAndState('A objective in state draft', 'draft').findByTestId('three-dot-menu').click();
op.selectFromThreeDotMenu('Objective veröffentlichen');

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Objective veröffentlichen')
.checkDescription('Soll dieses Objective veröffentlicht werden?')
.submit();
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('OKR Objective e2e tests', () => {

op.selectFromThreeDotMenu('Objective wiedereröffnen');

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Objective wiedereröffnen')
.checkDescription('Soll dieses Objective wiedereröffnet werden?')
.submit();
Expand All @@ -105,7 +105,7 @@ describe('OKR Objective e2e tests', () => {
.click();
op.selectFromThreeDotMenu('Objective als Draft speichern');

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Objective als Draft speichern')
.checkDescription('Soll dieses Objective als Draft gespeichert werden?')
.submit();
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('OKR Objective e2e tests', () => {
.click();

op.selectFromThreeDotMenu('Objective bearbeiten');
CyObjectiveFormPage.with().selectQuarter('3').submit();
ObjectiveDialog.with().selectQuarter('3').submit();

cy.contains('Move to another quarter on edit').should('not.exist');

Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/scoring.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as users from '../fixtures/users.json';
import { getPercentageMetric, getPercentageOrdinal } from 'cypress/support/scoringSupport';
import { getPercentageMetric, getPercentageOrdinal } from 'cypress/support/helper/scoringSupport';
import { onlyOn } from '@cypress/skip-test';

describe('Scoring component e2e tests', () => {
Expand Down
18 changes: 9 additions & 9 deletions frontend/cypress/e2e/teammanagement.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as users from '../fixtures/users.json';
import { uniqueSuffix } from '../support/utils';
import CyConfirmComponentPage from '../support/confirmComponentPage';
import { uniqueSuffix } from '../support/helper/utils';
import ConfirmDialog from '../support/helper/pom-helper/dialogs/confirmDialog';

describe('Team management tests', () => {
const teamName = uniqueSuffix('New Team');
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Team management tests', () => {
cy.getByTestId('remove-from-member-list').click();

// dialog
CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du Jaya Norris wirklich aus dem Team '${teamName}' entfernen?`)
.submit();
Expand All @@ -97,7 +97,7 @@ describe('Team management tests', () => {
cy.getByTestId('remove-from-member-list').click();

// cancel dialog
CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du Jaya Norris wirklich aus dem Team '${teamName}' entfernen?`)
.cancel();
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('Team management tests', () => {

// cancel dialog => cancel

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Team löschen')
.checkDescription(
`Möchtest du das Team '${teamName}' wirklich löschen? Zugehörige Objectives werden dadurch in allen Quartalen ebenfalls gelöscht!`,
Expand All @@ -147,7 +147,7 @@ describe('Team management tests', () => {
cy.getByTestId('teamMoreButton').click();
cy.getByTestId('teamDeleteButton').click();

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Team löschen')
.checkDescription(
`Möchtest du das Team '${teamName}' wirklich löschen? Zugehörige Objectives werden dadurch in allen Quartalen ebenfalls gelöscht!`,
Expand Down Expand Up @@ -412,7 +412,7 @@ describe('Team management tests', () => {
navigateToUser('Findus Peterson');
cy.getByTestId('delete-team-member').click();

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du Findus Peterson wirklich aus dem Team '/BBT' entfernen?`)
.submit();
Expand All @@ -426,7 +426,7 @@ describe('Team management tests', () => {
navigateToUser(nameEsha);
cy.getByTestId('delete-team-member').eq(0).click();

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du ${nameEsha} wirklich aus dem Team '/BBT' entfernen?`)
.submit();
Expand All @@ -435,7 +435,7 @@ describe('Team management tests', () => {

cy.getByTestId('delete-team-member').eq(0).click();

CyConfirmComponentPage.with()
ConfirmDialog.with()
.checkTitle('Mitglied entfernen')
.checkDescription(`Möchtest du ${nameEsha} wirklich aus dem Team 'LoremIpsum' entfernen?`)
.submit();
Expand Down
4 changes: 2 additions & 2 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { validateScoring } from './scoringSupport';
import { validateScoring } from './helper/scoringSupport';
import { keyCodeDefinitions } from 'cypress-real-events/keyCodeDefinitions';
import { pressUntilContains, doUntilSelector } from './utils';
import { pressUntilContains, doUntilSelector } from './helper/utils';

Cypress.Commands.add('loginAsUser', (user: any) => {
cy.viewport(1920, 1080);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BaseFormPage from './baseFormPage';
import Dialog from './dialog';

export default class CyConfirmComponentPage extends BaseFormPage {
export default class ConfirmDialog extends Dialog {
checkTitle(title: string) {
this.getPage().contains(title).should('exist');
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { E } from '@angular/cdk/keycodes';

export default abstract class BaseFormPage {
export default abstract class Dialog {
constructor() {
this.init();
}
Expand Down Expand Up @@ -32,7 +30,7 @@ export default abstract class BaseFormPage {

abstract getPage(): Cypress.Chainable<JQuery<HTMLElement>>;

static with<T extends BaseFormPage>(this: new () => T): T {
static with<T extends Dialog>(this: new () => T): T {
return new this();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseFormPage from './baseFormPage';
import { Unit } from '../../src/app/shared/types/enums/Unit';
import Dialog from './dialog';
import { Unit } from '../../../../../src/app/shared/types/enums/Unit';

export default class CyKeyResultFormPage extends BaseFormPage {
export default class KeyResultDialog extends Dialog {
fillKeyresultTitle(title: string) {
this.fillInput('titleInput', title);
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BaseFormPage from './baseFormPage';
import Dialog from './dialog';

export default class CyObjectiveFormPage extends BaseFormPage {
export default class ObjectiveDialog extends Dialog {
fillObjectiveTitle(title: string) {
this.fillInput('title', title);
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getObjectivesByNameAndState } from './objective-helper';
import CyObjectiveFormPage from './objectiveFormPage';
import { getObjectivesByNameAndState } from '../../objective-helper';
import ObjectiveDialog from '../dialogs/objectiveDialog';

export default class CyOverviewPage {
visit() {
Expand Down Expand Up @@ -29,10 +29,10 @@ export default class CyOverviewPage {
addObjective(teamName?: string) {
if (teamName) {
this.getTeamByName(teamName).find('.add-objective').first().click();
return new CyObjectiveFormPage();
return new ObjectiveDialog();
}
cy.getByTestId('add-objective').first().click();
return new CyObjectiveFormPage();
return new ObjectiveDialog();
}

getTeamByName(teamName: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isLastCheckInNegative } from '../../src/app/shared/common';
import { isLastCheckInNegative } from '../../../src/app/shared/common';

interface ScoringValue {
failPercent: number;
Expand Down
File renamed without changes.

0 comments on commit 3aa451f

Please sign in to comment.