-
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.
- Loading branch information
1 parent
69491b0
commit a8cb985
Showing
3 changed files
with
62 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,32 +145,32 @@ describe('Team management tests', () => { | |
|
||
describe('Search', () => { | ||
it('Search user', () => { | ||
teammanagementPage.searchTeam('pa'); | ||
|
||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Paco Eggimann ([email protected])'); | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Paco Egiman ([email protected])'); | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Robin Papierer ([email protected])').click(); | ||
teammanagementPage.elements | ||
.teamSearch() | ||
.fill('pa') | ||
.shouldHaveOption('Paco Eggimann ([email protected])') | ||
.shouldHaveOption('Paco Egiman ([email protected])') | ||
.selectOption('Robin Papierer ([email protected])'); | ||
|
||
cy.contains('app-member-detail h2', 'Robin Papierer'); | ||
}); | ||
|
||
it('Search team', () => { | ||
teammanagementPage.searchTeam('we are'); | ||
|
||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'we are cube.³').click(); | ||
teammanagementPage.elements.teamSearch().fill('we are').selectOption('we are cube.³'); | ||
|
||
cy.contains('app-member-list h2', 'we are cube.³'); | ||
}); | ||
|
||
it('Search mixed', () => { | ||
teammanagementPage.searchTeam('puz'); | ||
|
||
cy.contains('.mat-mdc-autocomplete-panel .mat-mdc-optgroup-label', 'Members'); | ||
cy.contains('.mat-mdc-autocomplete-panel .mat-mdc-optgroup-label', 'Teams'); | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Paco Eggimann ([email protected])'); | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Paco Egiman ([email protected])'); | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Robin Papierer ([email protected])'); | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Puzzle ITC'); | ||
teammanagementPage.elements | ||
.teamSearch() | ||
.fill('puz') | ||
.shouldHaveLabel('Members') | ||
.shouldHaveLabel('Teams') | ||
.shouldHaveOption('Paco Eggimann ([email protected])') | ||
.shouldHaveOption('Paco Egiman ([email protected])') | ||
.shouldHaveOption('Robin Papierer ([email protected])') | ||
.shouldHaveOption('Puzzle ITC'); | ||
}); | ||
}); | ||
|
||
|
44 changes: 44 additions & 0 deletions
44
frontend/cypress/support/helper/pom-helper/angularSearchBox.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,44 @@ | ||
import { PageObjectMapperBase } from './pageObjectMapperBase'; | ||
|
||
export default class AngularSearchBox extends PageObjectMapperBase { | ||
selector: string; | ||
|
||
constructor(selector: string) { | ||
super(); | ||
this.selector = selector; | ||
this.validatePage(); | ||
} | ||
|
||
fill(value: string) { | ||
const input = cy.get('input').first(); | ||
input.clear(); | ||
input.type(value); | ||
return this; | ||
} | ||
|
||
shouldHaveOption(option: string) { | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', option); | ||
return this; | ||
} | ||
|
||
shouldHaveLabel(label: string) { | ||
cy.contains('.mat-mdc-autocomplete-panel .mat-mdc-optgroup-label', label); | ||
return this; | ||
} | ||
|
||
selectOption(option: string) { | ||
cy.contains('.mat-mdc-autocomplete-panel mat-option', option).click(); | ||
} | ||
|
||
getPage() { | ||
return cy.get(this.selector); | ||
} | ||
|
||
static from(selector: string): AngularSearchBox { | ||
return new this(selector); | ||
} | ||
|
||
validatePage(): void { | ||
this.getPage().should('exist'); | ||
} | ||
} |
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