Skip to content

Commit

Permalink
spsh 686 Neue Testfälle Klassen fertig (#36)
Browse files Browse the repository at this point in the history
* Neue Testfälle Klassen fertig

* Update pages/admin/KlasseCreationView.page.ts

Co-authored-by: Julian Aggarwal <[email protected]>

* Update pages/admin/KlasseCreationView.page.ts

Co-authored-by: Julian Aggarwal <[email protected]>

* Update pages/admin/KlasseManagementView.page.ts

Co-authored-by: Julian Aggarwal <[email protected]>

* Update pages/admin/KlasseManagementView.page.ts

Co-authored-by: Julian Aggarwal <[email protected]>

* Update tests/Klasse.spec.ts

Co-authored-by: Julian Aggarwal <[email protected]>

* Update tests/Klasse.spec.ts

Co-authored-by: Julian Aggarwal <[email protected]>

* Update tests/Klasse.spec.ts

Co-authored-by: Julian Aggarwal <[email protected]>

---------

Co-authored-by: Julian Aggarwal <[email protected]>
  • Loading branch information
jakobmadp and jaggarnaut authored Jun 28, 2024
1 parent 8566db7 commit c4679e3
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pages/MenuBar.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export class MenuPage{
readonly menueItem_AlleBenutzerAnzeigen: Locator;
readonly menueItem_BenutzerAnlegen: Locator;
readonly label_Klassenverwaltung: Locator;
readonly menueItem_AlleKlassenAnzeigen: Locator;
readonly menueItem_KlasseAnlegen: Locator;
readonly label_Rollenverwaltung: Locator;
readonly menueItem_AlleRollenAnzeigen: Locator;
readonly menueItem_RolleAnlegen: Locator;
Expand All @@ -24,6 +26,8 @@ export class MenuPage{
this.menueItem_AlleBenutzerAnzeigen = page.getByTestId('person-management-menu-item');
this.menueItem_BenutzerAnlegen = page.getByTestId('person-creation-menu-item');
this.label_Klassenverwaltung = page.locator('[data-testid="klasse-management-title"] .v-list-item-title');
this.menueItem_AlleKlassenAnzeigen = page.getByTestId('klassen-management-menu-item');
this.menueItem_KlasseAnlegen = page.getByTestId('klasse-creation-menu-item');
this.label_Rollenverwaltung = page.locator('[data-testid="rolle-management-title"] .v-list-item-title');
this.menueItem_AlleRollenAnzeigen = page.locator('[data-testid="rolle-management-menu-item"] .v-list-item-title');
this.menueItem_RolleAnlegen = page.getByTestId('rolle-creation-menu-item');
Expand Down
19 changes: 19 additions & 0 deletions pages/admin/KlasseCreationView.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { type Locator, Page } from '@playwright/test';

export class KlasseCreationViewPage{
readonly page: Page;
readonly text_h2_KlasseAnlegen: Locator;
readonly combobox_Schulstrukturknoten: Locator;
readonly input_Klassenname: Locator;
readonly button_KlasseAnlegen: Locator;
readonly text_success: Locator;

constructor(page){
this.page = page;
this.text_h2_KlasseAnlegen = page.getByTestId('layout-card-headline');
this.combobox_Schulstrukturknoten = page.getByTestId('schule-select').locator('.v-input__control');
this.input_Klassenname = page.getByTestId('klassenname-input').locator('input');
this.button_KlasseAnlegen = page.getByTestId('klasse-creation-form-create-button');
this.text_success = page.getByTestId('klasse-success-text');
}
}
21 changes: 21 additions & 0 deletions pages/admin/KlasseManagementView.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { type Locator, Page } from '@playwright/test';

export class KlasseManagementViewPage{
readonly page: Page;
readonly text_h1_Administrationsbereich: Locator;
readonly text_h2_Klassenverwaltung: Locator;
readonly combobox_Filter_Schule: Locator;
readonly combobox_Filter_Klasse: Locator;
readonly table_header_Dienststellennummer: Locator;
readonly table_header_Klassenname: Locator;

constructor(page){
this.page = page;
this.text_h1_Administrationsbereich = page.getByTestId('admin-headline');
this.text_h2_Klassenverwaltung = page.getByTestId('layout-card-headline');
this.combobox_Filter_Schule = page.getByPlaceholder('Schule');
this.combobox_Filter_Klasse = page.getByPlaceholder('Klasse');
this.table_header_Dienststellennummer = page.getByText('Dienststellennummer');
this.table_header_Klassenname = page.getByTestId('klasse-table').getByText('Klasse');
}
}
79 changes: 79 additions & 0 deletions tests/Klasse.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { test, expect } from "@playwright/test";
import { LandingPage } from "../pages/LandingView.page";
import { LoginPage } from "../pages/LoginView.page";
import { StartPage } from "../pages/StartView.page";
import { MenuPage } from "../pages/MenuBar.page";
import { KlasseCreationViewPage } from "../pages/admin/KlasseCreationView.page";
import { KlasseManagementViewPage } from "../pages/admin/KlasseManagementView.page";
import { faker } from "@faker-js/faker/locale/de";

const PW = process.env.PW;
const ADMIN = process.env.USER;
const FRONTEND_URL = process.env.FRONTEND_URL || "";

test.describe(`Testfälle für die Administration von Klassen: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test.beforeEach(async ({ page }) => {
await test.step(`Login`, async () => {
const Landing = new LandingPage(page);
const Startseite = new StartPage(page);
const Login = new LoginPage(page);

await page.goto(FRONTEND_URL);
await Landing.button_Anmelden.click();
await Login.login(ADMIN, PW);
await expect(Startseite.text_h2_Ueberschrift).toBeVisible();
});
});

test("Eine Klasse anlegen und die Klasse anschließend in der Ergebnisliste suchen", async ({ page }) => {
const Startseite = new StartPage(page);
const Menue = new MenuPage(page);
const KlasseCreationView = new KlasseCreationViewPage(page);
const KlasseManagementView = new KlasseManagementViewPage(page);
const SCHULNAME = "Testschule Schulportal";
const KLASSENNAME = "TAuto-PW-K-12 " + faker.lorem.word({ length: { min: 4, max: 8 }});

await test.step(`Dialog Schule anlegen öffnen`, async () => {
await Startseite.card_item_schulportal_administration.click();
await Menue.menueItem_KlasseAnlegen.click();
await expect(KlasseCreationView.text_h2_KlasseAnlegen).toHaveText("Neue Klasse hinzufügen");
});

await test.step(`Klasse anlegen`, async () => {
await KlasseCreationView.combobox_Schulstrukturknoten.click();
await page.getByText(SCHULNAME).click();
await KlasseCreationView.input_Klassenname.fill(KLASSENNAME);
await KlasseCreationView.button_KlasseAnlegen.click();
await expect(KlasseCreationView.text_success).toBeVisible();
});

await test.step(`In der Ergebnisliste prüfen, dass die neue Klasse angezeigt wird`, async () => {
await Menue.menueItem_AlleKlassenAnzeigen.click();
await KlasseManagementView.combobox_Filter_Schule.fill(SCHULNAME);
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Enter');
await KlasseManagementView.combobox_Filter_Klasse.fill(KLASSENNAME);
await page.keyboard.press('ArrowDown');
await page.keyboard.press('Enter');
await expect(KlasseManagementView.text_h2_Klassenverwaltung).toHaveText("Klassenverwaltung");
await expect(page.getByRole("cell", { name: KLASSENNAME })).toBeVisible();
});
});

test("Ergebnisliste Klassen auf Vollständigkeit prüfen", async ({ page }) => {
const Startseite = new StartPage(page);
const Menue = new MenuPage(page);
const KlasseManagementView = new KlasseManagementViewPage(page);

await test.step(`Klassenverwaltung öffnen und Alle Elemente in der Ergebnisliste auf Existenz prüfen`, async () => {
await Startseite.card_item_schulportal_administration.click();
await Menue.menueItem_AlleKlassenAnzeigen.click();
await expect(KlasseManagementView.text_h1_Administrationsbereich).toBeVisible();
await expect(KlasseManagementView.text_h2_Klassenverwaltung).toHaveText("Klassenverwaltung");
await expect(KlasseManagementView.combobox_Filter_Schule).toBeVisible();
await expect(KlasseManagementView.combobox_Filter_Klasse).toBeVisible();
await expect(KlasseManagementView.table_header_Dienststellennummer).toBeVisible();
await expect(KlasseManagementView.table_header_Klassenname).toBeVisible();
});
});
});

0 comments on commit c4679e3

Please sign in to comment.