-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor page base and introduce new base class for dialog and page
- Loading branch information
1 parent
908d384
commit 3390e66
Showing
10 changed files
with
190 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as users from '../fixtures/users.json'; | ||
import CyOverviewPage from '../support/helper/pom-helper/pages/overviewPage'; | ||
import TeammanagementPage from '../support/helper/pom-helper/pages/teammanagementPage'; | ||
|
||
describe('Routing', () => { | ||
beforeEach(() => { | ||
cy.loginAsUser(users.gl); | ||
cy.visit(''); | ||
}); | ||
|
||
describe('Route via url', () => { | ||
it('should route to overview', () => { | ||
// Visit autocalls the validatePage method | ||
CyOverviewPage.do().visitViaURL(); | ||
}); | ||
|
||
it('should route to teammanagement', () => { | ||
// Visit autocalls the validatePage method | ||
TeammanagementPage.do().visitViaURL(); | ||
}); | ||
|
||
it('should route from overview to team management ', () => { | ||
CyOverviewPage.do().visitViaURL().visitTeammanagement(); | ||
}); | ||
|
||
it('should route from team management to Overview via back button', () => { | ||
TeammanagementPage.do().visitViaURL().backToOverview(); | ||
}); | ||
|
||
it('should route from team management to Overview via logo', () => { | ||
TeammanagementPage.do().visitViaURL().visitOverview(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { state } from '@angular/animations'; | ||
|
||
export class ObjectivePO { | ||
title: string; | ||
state: string; | ||
|
||
constructor(title: string, state: string) { | ||
this.title = title; | ||
this.state = state; | ||
} | ||
|
||
selectFromMenu(option: string) { | ||
this.openMenu(); | ||
cy.get('.objective-three-dot-menu').contains(option).click(); | ||
} | ||
|
||
private openMenu() { | ||
cy.get('.objective-three-dot-menu').click(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
frontend/cypress/support/helper/pom-helper/pageObjectMapperBase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export abstract class PageObjectMapperBase { | ||
abstract validatePage(): void; | ||
|
||
static do<T extends PageObjectMapperBase>(this: new () => T): T { | ||
return new this(); | ||
} | ||
|
||
check(arg: any) { | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { PageObjectMapperBase } from '../pageObjectMapperBase'; | ||
|
||
export abstract class Page extends PageObjectMapperBase { | ||
visit(): this { | ||
this.doVisit(); | ||
return this.afterVisit(); | ||
} | ||
|
||
visitViaURL(): this { | ||
cy.visit(this.getURL()); | ||
return this.afterVisit(); | ||
} | ||
|
||
protected abstract doVisit(): void; | ||
|
||
private afterVisit(): this { | ||
cy.url().should('include', this.getURL()); | ||
this.validatePage(); | ||
return this; | ||
} | ||
|
||
abstract getURL(): string; | ||
} |
Oops, something went wrong.