Skip to content

Commit

Permalink
use improved syntax for gen new object
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 8, 2024
1 parent a5214d2 commit f236152
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
35 changes: 15 additions & 20 deletions frontend/cypress/e2e/objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ describe('OKR Objective e2e tests', () => {
});

it(`Release Objective from Draft to Ongoing`, () => {
op.addObjective();
const ofp = new CyObjectiveFormPage();
const ofp: CyObjectiveFormPage = op.addObjective();
ofp.fillObjectiveTitle('A objective in state draft');
ofp.submitDraftObjective();

Expand All @@ -30,8 +29,8 @@ describe('OKR Objective e2e tests', () => {
});

it(`Complete Objective with Successful`, () => {
op.addObjective();
const ofp = new CyObjectiveFormPage();
const ofp: CyObjectiveFormPage = op.addObjective();

ofp.fillObjectiveTitle('We want to complete this successful');
ofp.submitObjective();

Expand All @@ -54,9 +53,8 @@ describe('OKR Objective e2e tests', () => {
});

it(`Complete Objective with Not-Successful`, () => {
op.addObjective();
const ofp: CyObjectiveFormPage = op.addObjective();

const ofp = new CyObjectiveFormPage();
ofp.fillObjectiveTitle('A not successful objective');
ofp.submitObjective();

Expand All @@ -77,8 +75,8 @@ describe('OKR Objective e2e tests', () => {
});

it(`Reopen Successful Objective`, () => {
op.addObjective();
const ofp = new CyObjectiveFormPage();
const ofp: CyObjectiveFormPage = op.addObjective();

ofp.fillObjectiveTitle('This objective will be reopened after');
ofp.submitObjective();

Expand All @@ -104,8 +102,8 @@ describe('OKR Objective e2e tests', () => {

it('Ongoing objective back to draft state', () => {
onlyOn('chrome');
op.addObjective();
const ofp = new CyObjectiveFormPage();
const ofp: CyObjectiveFormPage = op.addObjective();

ofp.fillObjectiveTitle('This objective will be returned to draft state');
ofp.submitObjective();

Expand All @@ -122,15 +120,14 @@ describe('OKR Objective e2e tests', () => {
});

it(`Search for Objective`, () => {
op.addObjective();
const ofp = new CyObjectiveFormPage();
let ofp: CyObjectiveFormPage = op.addObjective();

ofp.fillObjectiveTitle('Search after this objective');
ofp.submitObjective();

op.addObjective();
const ofp2 = new CyObjectiveFormPage();
ofp2.fillObjectiveTitle('We dont want to search for this');
ofp2.submitObjective();
ofp = op.addObjective();
ofp.fillObjectiveTitle('We dont want to search for this');
ofp.submitObjective();

cy.contains('Search after this objective');
cy.contains('We dont want to search for this');
Expand Down Expand Up @@ -161,8 +158,7 @@ describe('OKR Objective e2e tests', () => {
});

it(`Create Objective in other quarter`, () => {
op.addObjective();
const ofp = new CyObjectiveFormPage();
const ofp: CyObjectiveFormPage = op.addObjective();
ofp.fillObjectiveTitle('Objective in quarter 3');
ofp.selectQuarter('3');
ofp.submitObjective();
Expand All @@ -175,8 +171,7 @@ describe('OKR Objective e2e tests', () => {
});

it(`Edit Objective and move to other quarter`, () => {
op.addObjective();
const ofp = new CyObjectiveFormPage();
const ofp: CyObjectiveFormPage = op.addObjective();
ofp.fillObjectiveTitle('Move to another quarter on edit');
ofp.submitObjective();

Expand Down
4 changes: 3 additions & 1 deletion frontend/cypress/support/OverviewPage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getObjectivesByNameAndState } from './objective-helper';
import CyObjectiveFormPage from './objectiveFormPage';

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

getTeamByName(teamName: string) {
Expand Down

0 comments on commit f236152

Please sign in to comment.