From 662339316ea8a416a726523954c0e70da58f7dda Mon Sep 17 00:00:00 2001 From: Manfred <141728305+jakobmadp@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:58:57 +0100 Subject: [PATCH] Spsh 959 config browsers (#93) * added browser in playwright.config * new action for browsertests firefox * minor changes * minor changes * minor changes * minor changes * minor changes * minor changes --- .github/workflows/manuell_staging.yml | 4 +- .github/workflows/playwright.yml | 2 +- .github/workflows/schedule_dev.yml | 4 +- .../schedule_dev_crossBrowser_Firefox.yml | 41 +++++++++++++++++++ .github/workflows/schedule_staging.yml | 4 +- base/tags.ts | 3 +- playwright.config.ts | 26 ++++++------ tests/Klasse.spec.ts | 4 +- tests/MenuBar.spec.ts | 4 +- tests/Person.spec.ts | 4 +- tests/Profile.spec.ts | 4 +- tests/Schule.spec.ts | 4 +- tests/login.spec.ts | 4 +- tests/workflow.spec.ts | 6 +-- 14 files changed, 79 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/schedule_dev_crossBrowser_Firefox.yml diff --git a/.github/workflows/manuell_staging.yml b/.github/workflows/manuell_staging.yml index 8b70631..91ca6de 100644 --- a/.github/workflows/manuell_staging.yml +++ b/.github/workflows/manuell_staging.yml @@ -1,4 +1,4 @@ -name: Manuell alle Tests(staging) +name: Manuell stage long on: workflow_dispatch: jobs: @@ -19,7 +19,7 @@ jobs: - name: Install Playwright Browsers run: npx playwright install --with-deps - name: Run Playwright tests - run: ENV='stage' FRONTEND_URL='https://spsh.staging.spsh.dbildungsplattform.de/' npx playwright test -g "@stage" + run: ENV='stage' FRONTEND_URL='https://spsh.staging.spsh.dbildungsplattform.de/' npx playwright test -g "@stage" --project "chromium" env: USER: '${{ secrets.USER }}' PW: '${{ secrets.PW }}' diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 0c3ff3e..6ef5f79 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -55,7 +55,7 @@ jobs: - name: List Playwright tests run: npx playwright test --list --grep "@short" - name: Run Playwright tests - run: npx playwright test --config=playwright.config.ts --grep "@short" + run: npx playwright test --config=playwright.config.ts --grep "@short" --project "chromium" env: USER: '${{ secrets.USER }}' diff --git a/.github/workflows/schedule_dev.yml b/.github/workflows/schedule_dev.yml index 2554223..af048a1 100644 --- a/.github/workflows/schedule_dev.yml +++ b/.github/workflows/schedule_dev.yml @@ -1,4 +1,4 @@ -name: Scheduled Playwright Alle Tests(main) +name: Scheduled main long on: workflow_dispatch: schedule: @@ -21,7 +21,7 @@ jobs: - name: Install Playwright Browsers run: npx playwright install --with-deps - name: Run Playwright tests - run: ENV='dev' FRONTEND_URL='https://main.dev.spsh.dbildungsplattform.de/' npx playwright test -g "@long" + run: ENV='dev' FRONTEND_URL='https://main.dev.spsh.dbildungsplattform.de/' npx playwright test -g "@long" --project "chromium" env: USER: '${{ secrets.USER }}' PW: '${{ secrets.PW }}' diff --git a/.github/workflows/schedule_dev_crossBrowser_Firefox.yml b/.github/workflows/schedule_dev_crossBrowser_Firefox.yml new file mode 100644 index 0000000..d92fc5e --- /dev/null +++ b/.github/workflows/schedule_dev_crossBrowser_Firefox.yml @@ -0,0 +1,41 @@ +name: Scheduled main crossBrowser Firefox +on: + workflow_dispatch: + schedule: + - cron: '10 6 * * *' +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: ENV='dev' FRONTEND_URL='https://main.dev.spsh.dbildungsplattform.de/' npx playwright test -g "@crossBrowser" --project "firefox" + 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 + - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@1.1.1 + if: failure() + with: + type: ${{ job.status }} + job_name: 'Playwright Job Status: ' + url: ${{ secrets.RC_WEBHOOK }} + channel: '#SPSH-Test-Automation' + username: Playwright Notificator diff --git a/.github/workflows/schedule_staging.yml b/.github/workflows/schedule_staging.yml index 781eb3a..f9c69f9 100644 --- a/.github/workflows/schedule_staging.yml +++ b/.github/workflows/schedule_staging.yml @@ -1,4 +1,4 @@ -name: Scheduled Playwright Smoketest(staging) +name: Scheduled stage smoke on: workflow_dispatch: schedule: @@ -21,7 +21,7 @@ jobs: - name: Install Playwright Browsers run: npx playwright install --with-deps - name: Run Playwright tests - run: ENV='stage' FRONTEND_URL='https://spsh.staging.spsh.dbildungsplattform.de/' npx playwright test -g "@smoke" + run: ENV='stage' FRONTEND_URL='https://spsh.staging.spsh.dbildungsplattform.de/' npx playwright test -g "@smoke" --project "chromium" env: USER: '${{ secrets.USER }}' PW: '${{ secrets.PW }}' diff --git a/base/tags.ts b/base/tags.ts index 16f39d4..eb91c91 100644 --- a/base/tags.ts +++ b/base/tags.ts @@ -1,4 +1,5 @@ export const LONG = '@long'; export const SHORT = '@short'; export const STAGE = '@stage'; -export const SMOKE = '@smoke'; \ No newline at end of file +export const SMOKE = '@smoke'; +export const BROWSER = '@crossBrowser'; \ No newline at end of file diff --git a/playwright.config.ts b/playwright.config.ts index 9147f47..67f568b 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -34,20 +34,22 @@ export default defineConfig({ use: { ...devices["Desktop Chrome"], viewport: { width: 1280, height: 720 }, - ignoreHTTPSErrors: true, - }, + ignoreHTTPSErrors: true + } }, - + { + name: "firefox", + use: { + ...devices["Desktop Firefox"], + ignoreHTTPSErrors: true + } + } + // { - // name: 'firefox', - // use: { ...devices['Desktop Firefox'] }, - // }, - /* - { - name: 'webkit', - use: { ...devices['Desktop Safari'] }, - }, - */ + // name: 'webkit', + // use: { ...devices['Desktop Safari'] }, + // } + /* Test against mobile viewports. */ // { // name: 'Mobile Chrome', diff --git a/tests/Klasse.spec.ts b/tests/Klasse.spec.ts index 6a03bb6..33c8e3b 100644 --- a/tests/Klasse.spec.ts +++ b/tests/Klasse.spec.ts @@ -7,7 +7,7 @@ import { KlasseCreationViewPage } from "../pages/admin/KlasseCreationView.page"; import { KlasseManagementViewPage } from "../pages/admin/KlasseManagementView.page"; import { faker } from "@faker-js/faker/locale/de"; import { HeaderPage } from "../pages/Header.page"; -import { LONG, SHORT, STAGE } from "../base/tags"; +import { LONG, SHORT, STAGE, BROWSER } from "../base/tags"; import { deleteClassByName } from "../base/testHelperDeleteTestdata.ts"; const PW = process.env.PW; @@ -100,7 +100,7 @@ test.describe(`Testfälle für die Administration von Klassen: Umgebung: ${proce }); }); - test("Eine Klasse als Landesadmin anlegen und die Bestätigungsseite vollständig prüfen", {tag: [LONG, STAGE]}, async ({ page }) => { + test("Eine Klasse als Landesadmin anlegen und die Bestätigungsseite vollständig prüfen", {tag: [LONG, STAGE, BROWSER]}, async ({ page }) => { const klasseCreationView = new KlasseCreationViewPage(page); const dienststellennummer = '1111111'; const nameSchule = "Testschule Schulportal"; diff --git a/tests/MenuBar.spec.ts b/tests/MenuBar.spec.ts index c5b8f4c..71c8f9a 100644 --- a/tests/MenuBar.spec.ts +++ b/tests/MenuBar.spec.ts @@ -4,7 +4,7 @@ import { StartPage } from '../pages/StartView.page'; import { LoginPage } from '../pages/LoginView.page'; import { MenuPage } from '../pages/MenuBar.page'; import { HeaderPage } from "../pages/Header.page"; -import { LONG, SHORT, STAGE } from '../base/tags'; +import { LONG, SHORT, STAGE, BROWSER } from '../base/tags'; const PW = process.env.PW; const ADMIN = process.env.USER; @@ -31,7 +31,7 @@ test.describe(`Testfälle für die Hauptmenue-Leiste: Umgebung: ${process.env.UM }); }); - test('Test der Hauptmenue-Leiste und Untermenues auf Vollständigkeit', {tag: [LONG, SHORT, STAGE]}, async ({ page }) => { + test('Test der Hauptmenue-Leiste und Untermenues auf Vollständigkeit', {tag: [LONG, SHORT, STAGE, BROWSER]}, async ({ page }) => { const startseite = new StartPage(page) const menuBar = new MenuPage(page); diff --git a/tests/Person.spec.ts b/tests/Person.spec.ts index da40bfb..5a369c3 100644 --- a/tests/Person.spec.ts +++ b/tests/Person.spec.ts @@ -12,7 +12,7 @@ import { createRolleAndPersonWithUserContext } from "../base/api/testHelperPerso import { getSPId } from "../base/api/testHelperServiceprovider.page"; import { UserInfo } from "../base/api/testHelper.page"; import { addSystemrechtToRolle } from "../base/api/testHelperRolle.page"; -import { LONG, SHORT, STAGE } from "../base/tags"; +import { LONG, SHORT, STAGE, BROWSER } from "../base/tags"; import { deletePersonByUsername, deleteRolleById, deleteRolleByName } from "../base/testHelperDeleteTestdata.ts"; import { landesadminRolle, schuelerRolle, schuladminOeffentlichRolle } from "../base/roles.ts"; @@ -304,7 +304,7 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro }); }); - test("Ergebnisliste Benutzer auf Vollständigkeit prüfen als Landesadmin", {tag: [LONG, SHORT, STAGE]}, async ({page }) => { + test("Ergebnisliste Benutzer auf Vollständigkeit prüfen als Landesadmin", {tag: [LONG, SHORT, STAGE, BROWSER]}, async ({page }) => { const startseite = new StartPage(page); const menue = new MenuPage(page); const personManagementView = new PersonManagementViewPage(page); diff --git a/tests/Profile.spec.ts b/tests/Profile.spec.ts index 97fd8d0..b45def3 100644 --- a/tests/Profile.spec.ts +++ b/tests/Profile.spec.ts @@ -10,7 +10,7 @@ import { createRolleAndPersonWithUserContext, addSecondOrganisationToPerson } fr import { getOrganisationId } from "../base/api/testHelperOrganisation.page"; import { UserInfo } from "../base/api/testHelper.page"; import { addSystemrechtToRolle } from "../base/api/testHelperRolle.page"; -import { LONG, SHORT, STAGE } from "../base/tags"; +import { LONG, SHORT, STAGE, BROWSER } from "../base/tags"; import { deleteRolleById, deletePersonByUsername} from "../base/testHelperDeleteTestdata"; const PW = process.env.PW; @@ -64,7 +64,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e }); }); - test("Das eigene Profil öffnen und auf Vollständigkeit prüfen als Landesadmin", {tag: [LONG, STAGE]}, async ({ page }) => { + test("Das eigene Profil öffnen und auf Vollständigkeit prüfen als Landesadmin", {tag: [LONG, STAGE, BROWSER]}, async ({ page }) => { const profileView = new ProfilePage(page); const header = new HeaderPage(page); const login = new LoginPage(page); diff --git a/tests/Schule.spec.ts b/tests/Schule.spec.ts index 3890459..7a617b5 100644 --- a/tests/Schule.spec.ts +++ b/tests/Schule.spec.ts @@ -12,7 +12,7 @@ import { getSPId } from "../base/api/testHelperServiceprovider.page"; import { UserInfo } from "../base/api/testHelper.page"; import { addSystemrechtToRolle } from "../base/api/testHelperRolle.page"; import { FooterDataTablePage } from "../pages/FooterDataTable.page"; -import { LONG, SHORT, STAGE } from "../base/tags"; +import { LONG, SHORT, STAGE, BROWSER } from "../base/tags"; import { deletePersonById, deleteRolleById } from "../base/testHelperDeleteTestdata"; const PW = process.env.PW; @@ -123,7 +123,7 @@ test.describe(`Testfälle für die Administration von Schulen: Umgebung: ${proce }); }); - test("Ergebnisliste Schulen auf Vollständigkeit prüfen als Landesadmin", {tag: [LONG, SHORT, STAGE]}, async ({ page }) => { + test("Ergebnisliste Schulen auf Vollständigkeit prüfen als Landesadmin", {tag: [LONG, SHORT, STAGE, BROWSER]}, async ({ page }) => { const startseite = new StartPage(page); await test.step(`Schulverwaltung öffnen und Alle Elemente in der Ergebnisliste auf Existenz prüfen`, async () => { diff --git a/tests/login.spec.ts b/tests/login.spec.ts index 8b21dd0..5f59c6d 100644 --- a/tests/login.spec.ts +++ b/tests/login.spec.ts @@ -3,7 +3,7 @@ import { LoginPage } from '../pages/LoginView.page'; import { LandingPage } from '../pages/LandingView.page'; import { StartPage } from '../pages/StartView.page'; import { HeaderPage } from "../pages/Header.page"; -import { LONG, SHORT, SMOKE, STAGE } from '../base/tags'; +import { LONG, SHORT, SMOKE, STAGE, BROWSER } from '../base/tags'; import { createRolleAndPersonWithUserContext, lockPerson } from "../base/api/testHelperPerson.page.ts"; import { getSPId } from "../base/api/testHelperServiceprovider.page.ts"; import { faker } from "@faker-js/faker/locale/de"; @@ -70,7 +70,7 @@ test.describe(`Testfälle für die Authentifizierung: Umgebung: ${process.env.UM } }); - test('Erfolgreicher Standard Login Landesadmin', {tag: [LONG, SMOKE, STAGE]}, async ({ page }) => { + test('Erfolgreicher Standard Login Landesadmin', {tag: [LONG, SMOKE, STAGE, BROWSER]}, async ({ page }) => { const login = new LoginPage(page); const landing = new LandingPage(page); const start = new StartPage(page); diff --git a/tests/workflow.spec.ts b/tests/workflow.spec.ts index ba62547..9cbd9ee 100644 --- a/tests/workflow.spec.ts +++ b/tests/workflow.spec.ts @@ -7,7 +7,7 @@ import { ItsLearningPage } from "../pages/Cards/ItsLearning.page"; import { PersonManagementViewPage } from "../pages/admin/PersonManagementView.page"; import { PersonDetailsViewPage } from "../pages/admin/PersonDetailsView.page"; import { HeaderPage } from "../pages/Header.page"; -import { LONG, SHORT, STAGE } from "../base/tags"; +import { LONG, SHORT, STAGE, BROWSER } from "../base/tags"; import { CalendarPage } from "../pages/Cards/Calendar.page"; import { DirectoryPage } from "../pages/Cards/Directory.page"; import { createTeacherAndLogin } from "../base/api/testHelperPerson.page"; @@ -84,7 +84,7 @@ test.describe(`Testfälle für den Test von workflows: Umgebung: ${process.env.E }); }); - test("Passwort Reset für einen Lehrer als Landesadmin", {tag: [LONG, SHORT, STAGE]}, async ({ page }) => { + test("Passwort Reset für einen Lehrer als Landesadmin", {tag: [LONG, SHORT, STAGE, BROWSER]}, async ({ page }) => { const landing = new LandingPage(page); const login = new LoginPage(page); const startseite = new StartPage(page); @@ -103,7 +103,7 @@ test.describe(`Testfälle für den Test von workflows: Umgebung: ${process.env.E await expect(personManagement.text_h2_Benutzerverwaltung).toBeVisible(); await personManagement.input_Suchfeld.fill(username); await personManagement.button_Suchen.click(); - await page.getByRole("cell", { name: lastname, exact: true }).click(); + await page.getByRole("cell", { name: lastname, exact: true }).click({delay:500}); }); await test.step(`In den User-Details PW-Reset Dialog starten`, async () => {