diff --git a/frontend/cypress/e2e/teammanagement.cy.ts b/frontend/cypress/e2e/teammanagement.cy.ts index d6a74aee5e..b84fdb1d9e 100644 --- a/frontend/cypress/e2e/teammanagement.cy.ts +++ b/frontend/cypress/e2e/teammanagement.cy.ts @@ -35,6 +35,7 @@ describe('Team management tests', () => { }); describe('As GL', () => { + let teammanagementPage: TeammanagementPage; before(() => { // login as bl to ensure this user exists in database cy.loginAsUser(users.bl); @@ -44,16 +45,13 @@ describe('Team management tests', () => { beforeEach(() => { cy.loginAsUser(users.gl); - TeammanagementPage.do().visitViaURL(); + teammanagementPage = TeammanagementPage.do().visitViaURL(); }); it('Create team', () => { cy.intercept('POST', '**/teams').as('addTeam'); - cy.contains('Teamverwaltung'); - cy.getByTestId('add-team').click(); - cy.getByTestId('add-team-name').click().clear().type(teamName); - cy.getByTestId('add-team-save').click(); + teammanagementPage.addTeam().fillName(teamName).submit(); cy.wait('@addTeam'); cy.contains(teamName); }); @@ -147,7 +145,7 @@ describe('Team management tests', () => { describe('Search', () => { it('Search user', () => { - cy.get('app-team-management-banner').findByTestId('teamManagementSearch').click().type('pa'); + teammanagementPage.searchTeam('pa'); cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Paco Eggimann (peggimann@puzzle.ch)'); cy.contains('.mat-mdc-autocomplete-panel mat-option', 'Paco Egiman (egiman@puzzle.ch)'); @@ -157,7 +155,7 @@ describe('Team management tests', () => { }); it('Search team', () => { - cy.get('app-team-management-banner').findByTestId('teamManagementSearch').click().type('we are'); + teammanagementPage.searchTeam('we are'); cy.contains('.mat-mdc-autocomplete-panel mat-option', 'we are cube.³').click(); @@ -165,7 +163,7 @@ describe('Team management tests', () => { }); it('Search mixed', () => { - cy.get('app-team-management-banner').findByTestId('teamManagementSearch').click().type('puz'); + 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'); @@ -224,7 +222,6 @@ describe('Team management tests', () => { }); }); - //Currentyl it('Navigate to Bobs profile and add him to BBT and LoremIpsum', () => { cy.intercept('PUT', '**/updateaddteammembership/*').as('updateEsha'); @@ -450,7 +447,7 @@ function editTeamNameAndTest(teamName: string) { cy.intercept('PUT', '**/teams/*').as('saveTeam'); cy.getByTestId('editTeamButton').click(); cy.getByTestId('add-team-name').click().clear().type(teamName); - cy.getByTestId('add-team-save').click(); + cy.getByTestId('safe').click(); cy.wait('@saveTeam'); cy.contains(teamName); } diff --git a/frontend/cypress/support/helper/pom-helper/dialogs/teamDialog.ts b/frontend/cypress/support/helper/pom-helper/dialogs/teamDialog.ts new file mode 100644 index 0000000000..5cb3d7ec72 --- /dev/null +++ b/frontend/cypress/support/helper/pom-helper/dialogs/teamDialog.ts @@ -0,0 +1,17 @@ +import Dialog from './dialog'; + +export default class TeamDialog extends Dialog { + override validatePage() { + super.validatePage(); + this.getPage().contains('Team erfassen'); + } + + fillName(name: string) { + this.fillInput('add-team-name', name); + return this; + } + + getPage(): Cypress.Chainable> { + return cy.get('app-add-edit-team-dialog'); + } +} diff --git a/frontend/cypress/support/helper/pom-helper/pageObjectMapperBase.ts b/frontend/cypress/support/helper/pom-helper/pageObjectMapperBase.ts index c4bca4e175..bfaba39114 100644 --- a/frontend/cypress/support/helper/pom-helper/pageObjectMapperBase.ts +++ b/frontend/cypress/support/helper/pom-helper/pageObjectMapperBase.ts @@ -8,4 +8,8 @@ export abstract class PageObjectMapperBase { check(arg: any) { return this; } + + checkForToaster(content: any) { + return this; + } } diff --git a/frontend/cypress/support/helper/pom-helper/pages/teammanagementPage.ts b/frontend/cypress/support/helper/pom-helper/pages/teammanagementPage.ts index f92c745975..c4b70d2372 100644 --- a/frontend/cypress/support/helper/pom-helper/pages/teammanagementPage.ts +++ b/frontend/cypress/support/helper/pom-helper/pages/teammanagementPage.ts @@ -1,4 +1,5 @@ import { Page } from './page'; +import TeamDialog from '../dialogs/teamDialog'; export default class TeammanagementPage extends Page { elements = { @@ -36,6 +37,15 @@ export default class TeammanagementPage extends Page { this.elements.logo().click(); } + addTeam(): TeamDialog { + this.elements.addTeam().click(); + return new TeamDialog(); + } + + searchTeam(teamName: string): void { + this.elements.teamSearch().type(teamName); + } + getURL(): string { return 'team-management'; } diff --git a/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.html b/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.html index a74ff3dbd5..4b73af8bea 100644 --- a/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.html +++ b/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.html @@ -22,7 +22,7 @@
- + +