Skip to content

Commit

Permalink
spsh 633 schule creation test (#29)
Browse files Browse the repository at this point in the history
* added schule creation test and page

* fixed menu item locator

* fixed schule tests
  • Loading branch information
jaggarnaut authored May 14, 2024
1 parent b3d3764 commit 393edef
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 9 deletions.
2 changes: 2 additions & 0 deletions pages/MenuBar.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class MenuPage{
readonly menueItem_RolleAnlegen: Locator;
readonly label_Schulverwaltung: Locator;
readonly menueItem_AlleSchulenAnzeigen: Locator;
readonly menueItem_SchuleAnlegen: Locator;
readonly label_Schultraegerverwaltung: Locator;

constructor(page){
Expand All @@ -28,6 +29,7 @@ export class MenuPage{
this.menueItem_RolleAnlegen = page.getByTestId('rolle-creation-menu-item');
this.label_Schulverwaltung = page.locator('[data-testid="schule-management-title"] .v-list-item-title');
this.menueItem_AlleSchulenAnzeigen = page.locator('[data-testid="schule-management-menu-item"] .v-list-item-title');
this.menueItem_SchuleAnlegen = page.getByTestId('schule-creation-menu-item');
this.label_Schultraegerverwaltung = page.locator('[data-testid="schultraeger-management-title"] .v-list-item-title');
}
}
2 changes: 1 addition & 1 deletion pages/admin/RolleCreationView.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RolleCreationViewPage{
readonly text_success: Locator;

constructor(page){
this.page = page;
this.page = page;
this.text_h2_RolleAnlegen = page.getByTestId('layout-card-headline');
this.combobox_Schulstrukturknoten = page.getByTestId('administrationsebene-select').locator('.v-input__control');
this.combobox_Rollenart = page.getByTestId('rollenart-select').locator('.v-input__control');
Expand Down
25 changes: 25 additions & 0 deletions pages/admin/SchuleCreationView.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { type Locator, Page } from '@playwright/test';

export class SchuleCreationViewPage{
readonly page: Page;
readonly text_h2_SchuleAnlegen: Locator;
readonly radio_button_Public_Schule: Locator;
readonly radio_button_Ersatzschule: Locator;
readonly input_Dienststellennummer: Locator;
readonly input_Schulname: Locator;
readonly button_SchuleAnlegen: Locator;
readonly button_WeitereSchuleAnlegen: Locator;
readonly text_success: Locator;

constructor(page){
this.page = page;
this.text_h2_SchuleAnlegen = page.getByTestId('layout-card-headline');
this.radio_button_Public_Schule = page.getByTestId('public-schule-radio-button');
this.radio_button_Ersatzschule = page.getByTestId('ersatzschule-radio-button');
this.input_Dienststellennummer = page.getByTestId('dienststellennummer-input').locator('input');
this.input_Schulname = page.getByTestId('schulname-input').locator('input');
this.button_SchuleAnlegen = page.getByTestId('schule-creation-form-create-button');
this.button_WeitereSchuleAnlegen = page.getByTestId('create-another-schule-button');
this.text_success = page.getByTestId('schule-success-text');
}
}
2 changes: 1 addition & 1 deletion tests/MenuBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MenuPage } from '../pages/MenuBar.page';

const PW = process.env.PW;
const USER = process.env.USER;
const FRONTEND_URL = process.env.FRONTEND_URL;
const FRONTEND_URL = process.env.FRONTEND_URL || '';

test.describe(`Testfälle für die Hauptmenue-Leiste: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('Test der Hauptmenue-Leiste und Untermenues auf Vollständigkeit', async ({ page }) => {
Expand Down
6 changes: 3 additions & 3 deletions tests/Rolle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { RolleManagementViewPage } from '../pages/admin/RolleManagementView.page

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

test.describe(`Testfälle für die Administration von Rollen: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('2 Rollen nacheinander anlegen', async ({ page }) => {
Expand All @@ -18,7 +18,7 @@ test.describe(`Testfälle für die Administration von Rollen: Umgebung: ${proces
const Login = new LoginPage(page);
const Menue = new MenuPage(page);
const RolleCreationView = new RolleCreationViewPage(page);
const RolleManagementeView = new RolleManagementViewPage(page);
const RolleManagementView = new RolleManagementViewPage(page);

const ROLLENNAME1 = 'TAutoR1' + faker.word.noun() + '-' + faker.word.noun(); // Wahrscheinlichkeit doppelter Namen verringern
const ROLLENNAME2 = 'TAutoR2' + faker.word.noun() + '-' + faker.word.noun();
Expand Down Expand Up @@ -69,7 +69,7 @@ test.describe(`Testfälle für die Administration von Rollen: Umgebung: ${proces

await test.step(`In der Ergebnisliste prüfen dass die beiden neuen Rollen angezeigt sind`, async () => {
await Menue.menueItem_AlleRollenAnzeigen.click();
await expect(RolleManagementeView.text_h2_Rollenverwaltung).toHaveText('Rollenverwaltung');
await expect(RolleManagementView.text_h2_Rollenverwaltung).toHaveText('Rollenverwaltung');
await expect(page.getByRole('cell', { name: `${ROLLENNAME1}` })).toBeVisible();
await expect(page.getByRole('cell', { name: `${ROLLENNAME2}` })).toBeVisible();
})
Expand Down
63 changes: 62 additions & 1 deletion tests/Schule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,76 @@
import { faker } from '@faker-js/faker/locale/de';
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 { SchuleCreationViewPage } from '../pages/admin/SchuleCreationView.page';
import { SchuleManagementViewPage } from '../pages/admin/SchuleManagementView.page';

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

test.describe(`Testfälle für die Administration von Schulen: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('2 Schulen nacheinander anlegen', async ({ page }) => {
const Landing = new LandingPage(page);
const Startseite = new StartPage(page);
const Login = new LoginPage(page);
const Menue = new MenuPage(page);
const SchuleCreationView = new SchuleCreationViewPage(page);
const SchuleManagementView = new SchuleManagementViewPage(page);

const SCHULNAME1 = 'TAutoS1' + faker.word.noun() + '-' + faker.word.noun(); // Wahrscheinlichkeit doppelter Namen verringern
const SCHULNAME2 = 'TAutoS2' + faker.word.noun() + '-' + faker.word.noun();
const DIENSTSTELLENNUMMER1 = '3310176111';
const DIENSTSTELLENNUMMER2 = '0481165563';

await test.step(`Annmelden mit Benutzer ${ADMIN}`, async () => {
await page.goto(FRONTEND_URL);
await Landing.button_Anmelden.click();
await Login.login(ADMIN, PW);
await expect(Startseite.text_h2_Ueberschrift).toBeVisible();
})

await test.step(`Dialog Schule anlegen öffnen`, async () => {
await Startseite.card_item_schulportal_administration.click();
await Menue.menueItem_SchuleAnlegen.click();
await expect(SchuleCreationView.text_h2_SchuleAnlegen).toHaveText('Neue Schule hinzufügen');
})

await test.step(`Erste Schule anlegen`, async () => {
await SchuleCreationView.radio_button_Public_Schule.click();

await SchuleCreationView.input_Dienststellennummer.click();
await SchuleCreationView.input_Dienststellennummer.fill(DIENSTSTELLENNUMMER1);

await SchuleCreationView.input_Schulname.click();
await SchuleCreationView.input_Schulname.fill(SCHULNAME1);
await SchuleCreationView.button_SchuleAnlegen.click();
await expect(SchuleCreationView.text_success).toBeVisible();
})

await test.step(`Zweite Schule anlegen`, async () => {
await SchuleCreationView.button_WeitereSchuleAnlegen.click();
await SchuleCreationView.radio_button_Public_Schule.click();

await SchuleCreationView.input_Dienststellennummer.click();
await SchuleCreationView.input_Dienststellennummer.fill(DIENSTSTELLENNUMMER2);

await SchuleCreationView.input_Schulname.click();
await SchuleCreationView.input_Schulname.fill(SCHULNAME2);
await SchuleCreationView.button_SchuleAnlegen.click();
await expect(SchuleCreationView.text_success).toBeVisible();
})

await test.step(`In der Ergebnisliste prüfen, dass die beiden neuen Schulen angezeigt werden`, async () => {
await Menue.menueItem_AlleSchulenAnzeigen.click();
await expect(SchuleManagementView.text_h2_Schulverwaltung).toHaveText('Schulverwaltung');
await expect(page.getByRole('cell', { name: `${SCHULNAME1}` })).toBeVisible();
await expect(page.getByRole('cell', { name: `${SCHULNAME2}` })).toBeVisible();
})
})

test('Ergebnisliste Schulen auf Vollständigkeit prüfen', async ({ page }) => {
const Landing = new LandingPage(page);
const Startseite = new StartPage(page);
Expand Down
2 changes: 1 addition & 1 deletion tests/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StartPage } from '../pages/StartView.page';

const PW = process.env.PW;
const USER = process.env.USER;
const FRONTEND_URL = process.env.FRONTEND_URL;
const FRONTEND_URL = process.env.FRONTEND_URL || '';

test.describe(`Testfälle für die Authentifizierung: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('Erfolgreicher Standard Login', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/logoff.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HeaderPage } from '../pages/Header.page';

const PW = process.env.PW;
const USER = process.env.USER;
const FRONTEND_URL = process.env.FRONTEND_URL;
const FRONTEND_URL = process.env.FRONTEND_URL || '';

test.describe(`Testfälle für die Authentifizierung: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('Erfolgreicher Standard Logoff', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { HeaderPage } from '../pages/Header.page';

const PW = process.env.PW;
const USER = process.env.USER;
const FRONTEND_URL = process.env.FRONTEND_URL;
const FRONTEND_URL = process.env.FRONTEND_URL || '';

test.describe(`Testfälle für den Test von workflows: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('Angebote per Link öffnen', async ({ page}) => {
Expand Down

0 comments on commit 393edef

Please sign in to comment.