Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPSH-1176 2: #132

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 56 additions & 45 deletions pages/admin/PersonManagementView.page.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,70 @@
import { type Locator, Page, expect } from '@playwright/test';
import { PersonDetailsViewPage } from "./PersonDetailsView.page";

export class PersonManagementViewPage{
readonly page: Page;
readonly text_h1_Administrationsbereich: Locator;
readonly text_h2_Benutzerverwaltung: Locator;
readonly input_Suchfeld: Locator;
readonly button_Suchen: Locator;
readonly table_header_Nachname: Locator;
readonly table_header_Vorname: Locator;
readonly table_header_Benutzername: Locator;
readonly table_header_KopersNr: Locator;
readonly table_header_Rolle: Locator;
readonly table_header_Zuordnungen: Locator;
readonly table_header_Klasse: Locator;
readonly comboboxMenuIcon_Schule: Locator;
readonly comboboxMenuIcon_Rolle: Locator;
readonly comboboxMenuIcon_Klasse: Locator;
readonly comboboxMenuIcon_Status: Locator;
readonly comboboxMenuIcon_Schule_input: Locator;

constructor(page: Page){
this.page = page;
this.text_h1_Administrationsbereich = page.getByTestId('admin-headline');
this.text_h2_Benutzerverwaltung = page.getByTestId('layout-card-headline');
this.input_Suchfeld = page.locator('[data-testid="search-filter-input"] input');
this.button_Suchen = page.getByTestId('apply-search-filter-button');
this.table_header_Nachname = page.getByTestId('person-table').getByText('Nachname', { exact: true });
this.table_header_Vorname = page.getByTestId('person-table').getByText('Vorname', { exact: true });
this.table_header_Benutzername = page.getByText('Benutzername', { exact: true });
this.table_header_KopersNr = page.getByText('KoPers.-Nr.');
this.table_header_Rolle = page.getByTestId('person-table').getByText('Rolle', { exact: true });
this.table_header_Zuordnungen = page.getByText('Zuordnung(en)');
this.table_header_Klasse = page.getByTestId('person-table').getByText('Klasse', { exact: true });
this.comboboxMenuIcon_Schule = page.locator('[data-testid="schule-select"] .mdi-menu-down');
this.comboboxMenuIcon_Schule_input = page.locator('[data-testid="schule-select"] input');
this.comboboxMenuIcon_Rolle = page.locator('[data-testid="rolle-select"] .mdi-menu-down');
this.comboboxMenuIcon_Klasse = page.locator('[data-testid="klasse-select"] .mdi-menu-down');
this.comboboxMenuIcon_Status = page.locator('[data-testid="status-select"] .mdi-menu-down');
}
import { PersonDetailsViewPage } from './PersonDetailsView.page';

export class PersonManagementViewPage {
readonly page: Page;
readonly text_h1_Administrationsbereich: Locator;
readonly text_h2_Benutzerverwaltung: Locator;
readonly input_Suchfeld: Locator;
readonly button_Suchen: Locator;
readonly table_header_Nachname: Locator;
readonly table_header_Vorname: Locator;
readonly table_header_Benutzername: Locator;
readonly table_header_KopersNr: Locator;
readonly table_header_Rolle: Locator;
readonly table_header_Zuordnungen: Locator;
readonly table_header_Klasse: Locator;
readonly table_wrapper: Locator;
readonly comboboxMenuIcon_Schule: Locator;
readonly comboboxMenuIcon_Rolle: Locator;
readonly comboboxMenuIcon_Klasse: Locator;
readonly comboboxMenuIcon_Status: Locator;
readonly comboboxMenuIcon_Schule_input: Locator;

constructor(page: Page) {
this.page = page;
this.text_h1_Administrationsbereich = page.getByTestId('admin-headline');
this.text_h2_Benutzerverwaltung = page.getByTestId('layout-card-headline');
this.input_Suchfeld = page.locator('[data-testid="search-filter-input"] input');
this.button_Suchen = page.getByTestId('apply-search-filter-button');
this.table_header_Nachname = page.getByTestId('person-table').getByText('Nachname', { exact: true });
this.table_header_Vorname = page.getByTestId('person-table').getByText('Vorname', { exact: true });
this.table_header_Benutzername = page.getByText('Benutzername', { exact: true });
this.table_header_KopersNr = page.getByText('KoPers.-Nr.');
this.table_header_Rolle = page.getByTestId('person-table').getByText('Rolle', { exact: true });
this.table_header_Zuordnungen = page.getByText('Zuordnung(en)');
this.table_header_Klasse = page.getByTestId('person-table').getByText('Klasse', { exact: true });
this.table_wrapper = page.getByTestId('person-table');
this.comboboxMenuIcon_Schule = page.locator('[data-testid="schule-select"] .mdi-menu-down');
this.comboboxMenuIcon_Schule_input = page.locator('[data-testid="schule-select"] input');
this.comboboxMenuIcon_Rolle = page.locator('[data-testid="rolle-select"] .mdi-menu-down');
this.comboboxMenuIcon_Klasse = page.locator('[data-testid="klasse-select"] .mdi-menu-down');
this.comboboxMenuIcon_Status = page.locator('[data-testid="status-select"] .mdi-menu-down');
}

public async navigateToPersonDetailsViewByNachname(nachname: string): Promise<PersonDetailsViewPage> {
await this.page.getByRole("cell", { name: nachname, exact: true }).click();
await this.page.getByRole('cell', { name: nachname, exact: true }).click();

return new PersonDetailsViewPage(this.page);
}

public async searchBySuchfeld(name: string) {
public async searchBySuchfeld(name: string): Promise<void> {
await this.page.waitForTimeout(1000); // Im ticket SPSH-1738 muss dieser workaroundt durch einen waitForResponse oder Ähnlichem ersetzt werden
await this.input_Suchfeld.fill(name);
await this.button_Suchen.click();
await expect(this.comboboxMenuIcon_Status).toBeVisible();
}

public async openGesamtuebersichtPerson(page: Page, name: string): Promise<PersonDetailsViewPage> {
await page.getByRole("cell", { name: name, exact: true }).click();
await page.getByRole('cell', { name: name, exact: true }).click();
return new PersonDetailsViewPage(page);
}
}
}

public async waitForData(): Promise<void> {
return expect(this.table_wrapper).not.toContainText('Keine Daten');
}

public getRows(): Locator {
return this.table_wrapper.locator('.v-data-table__tr');
}
}
11 changes: 7 additions & 4 deletions tests/Person.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test';
import { expect, PlaywrightTestArgs, test } from '@playwright/test';
import { UserInfo } from '../base/api/testHelper.page';
import { createRolleAndPersonWithUserContext } from '../base/api/testHelperPerson.page';
import { addSystemrechtToRolle } from '../base/api/testHelperRolle.page';
Expand Down Expand Up @@ -485,12 +485,13 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro
test(
'In der Ergebnisliste die Filterfunktion der Schulen benutzen als Landesadmin',
{ tag: [LONG, SHORT, STAGE] },
async ({ page }) => {
const personManagementView = new PersonManagementViewPage(page);
async ({ page }: PlaywrightTestArgs) => {
const personManagementView: PersonManagementViewPage = new PersonManagementViewPage(page);

await test.step(`Filter öffnen und Schule selektieren`, async () => {
await gotoTargetURL(page, 'admin/personen');
await expect(personManagementView.text_h2_Benutzerverwaltung).toHaveText('Benutzerverwaltung');
await personManagementView.waitForData();

// Fill the input with the name of the Schule and let the autocomplete find it
await personManagementView.comboboxMenuIcon_Schule_input.fill(testschule665);
Expand All @@ -505,6 +506,8 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro
await personManagementView.button_Suchen.click();

await expect(page.getByTestId('schule-select')).toHaveText('1111165 (Testschule-PW665)');

await expect(personManagementView.getRows().first()).toContainText('1111165');
});
}
);
Expand Down
Loading