diff --git a/.github/workflows/schedule_dev.yml b/.github/workflows/schedule_dev.yml new file mode 100644 index 0000000..7c10c13 --- /dev/null +++ b/.github/workflows/schedule_dev.yml @@ -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 \ No newline at end of file diff --git a/pages/admin/PersonManagementView.page.ts b/pages/admin/PersonManagementView.page.ts index 94fd539..8c02cdc 100644 --- a/pages/admin/PersonManagementView.page.ts +++ b/pages/admin/PersonManagementView.page.ts @@ -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 }); } } \ No newline at end of file diff --git a/tests/Person.spec.ts b/tests/Person.spec.ts index d30990b..27f950a 100644 --- a/tests/Person.spec.ts +++ b/tests/Person.spec.ts @@ -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 }) => { @@ -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(); + }) + }) }) \ No newline at end of file