Skip to content

Commit

Permalink
SPSH 509 Testfall Ergebnisliste Benutzer auf Vollstaendigkeit prüfen …
Browse files Browse the repository at this point in the history
…fertig (#28)

* Testfall Ergebnisliste Benutzer auf Vollstaendigkeit prüfen fertig

* Findings aus review behoben

* Update pages/admin/PersonManagementView.page.ts

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

---------

Co-authored-by: Julian Aggarwal <[email protected]>
  • Loading branch information
jakobmadp and jaggarnaut authored May 7, 2024
1 parent a33ed9a commit b846123
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/schedule_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Scheduled Playwright Alle Tests(main)
on:
schedule:
- cron: '10 5 * * *'
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Remove Microsoft APT and Update Packages
run: |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update || true
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: FRONTEND_URL='https://main.dev.spsh.dbildungsplattform.de/' npx playwright test
env:
USER: '${{ secrets.USER }}'
PW: '${{ secrets.PW }}'
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30npm login
20 changes: 20 additions & 0 deletions pages/admin/PersonManagementView.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@ import { type Locator, Page } from '@playwright/test';

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;

constructor(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 });
}
}
34 changes: 33 additions & 1 deletion tests/Person.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 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 Personen: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.FRONTEND_URL}:`, () => {
test('Einen Benutzer mit der Rolle Lehrkraft anlegen', async ({ page }) => {
Expand Down Expand Up @@ -77,4 +77,36 @@ test.describe(`Testfälle für die Administration von Personen: Umgebung: ${proc
await expect(Startseite.text_h2_Ueberschrift).toBeVisible();
})
})

test('Ergebnisliste Benutzer auf Vollständigkeit prüfen', async ({ page }) => {
const Landing = new LandingPage(page);
const Startseite = new StartPage(page);
const Login = new LoginPage(page);
const Menue = new MenuPage(page);
const PersonManagementView = new PersonManagementViewPage(page);

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

await test.step(`Alle Elemente in der Ergebnisliste auf Existenz prüfen`, async () => {
await expect(PersonManagementView.text_h1_Administrationsbereich).toBeVisible();
await expect(PersonManagementView.text_h2_Benutzerverwaltung).toBeVisible();
await expect(PersonManagementView.text_h2_Benutzerverwaltung).toHaveText('Benutzerverwaltung');
await expect(PersonManagementView.input_Suchfeld).toBeVisible();
await expect(PersonManagementView.button_Suchen).toBeVisible();
await expect(PersonManagementView.table_header_Nachname).toBeVisible();
await expect(PersonManagementView.table_header_Vorname).toBeVisible();
await expect(PersonManagementView.table_header_Benutzername).toBeVisible();
await expect(PersonManagementView.table_header_KopersNr).toBeVisible();
await expect(PersonManagementView.table_header_Rolle).toBeVisible();
await expect(PersonManagementView.table_header_Zuordnungen).toBeVisible();
await expect(PersonManagementView.table_header_Klasse).toBeVisible();
})
})
})

0 comments on commit b846123

Please sign in to comment.