Skip to content

Commit

Permalink
Merge branch 'main' into SPSH-1059-config-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobmadp committed Nov 19, 2024
2 parents a2cfe89 + 6623393 commit c7108ce
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/manuell_staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Manuell alle Tests(staging)
name: Manuell stage long
on:
workflow_dispatch:
jobs:
Expand All @@ -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 }}'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/schedule_dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Scheduled Playwright Alle Tests(main)
name: Scheduled main long
on:
workflow_dispatch:
schedule:
Expand All @@ -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 }}'
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/schedule_dev_crossBrowser_Firefox.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
if: failure()
with:
type: ${{ job.status }}
job_name: 'Playwright Job Status: '
url: ${{ secrets.RC_WEBHOOK }}
channel: '#SPSH-Test-Automation'
username: Playwright Notificator
4 changes: 2 additions & 2 deletions .github/workflows/schedule_staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Scheduled Playwright Smoketest(staging)
name: Scheduled stage smoke
on:
workflow_dispatch:
schedule:
Expand All @@ -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 }}'
Expand Down
3 changes: 2 additions & 1 deletion base/tags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const LONG = '@long';
export const SHORT = '@short';
export const STAGE = '@stage';
export const SMOKE = '@smoke';
export const SMOKE = '@smoke';
export const BROWSER = '@crossBrowser';
10 changes: 10 additions & 0 deletions pages/ProfileView.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export class ProfilePage{
readonly cardHeadline_Passwort: Locator;
readonly icon_Schluessel_Passwort: Locator;
readonly button_NeuesPasswortSetzen: Locator;
readonly button_PasswortAendern: Locator;
readonly label_username: Locator;
readonly text_p_LoginPrompt: Locator;
readonly input_password: Locator;
// 2FA
readonly cardHeadline_2FA: Locator;
readonly icon_Schild2FA: Locator;
Expand Down Expand Up @@ -72,9 +76,15 @@ export class ProfilePage{
// Passwort
this.cardHeadline_Passwort = page.getByTestId('new-password-card');
this.button_NeuesPasswortSetzen = page.getByTestId('open-change-password-dialog');
this.button_PasswortAendern = page.getByTestId('change-password-button');
this.label_username = page.locator('#kc-attempted-username');
this.text_p_LoginPrompt = page.getByTestId('login-prompt-text');
this.input_password = page.getByTestId('password-input');

// 2FA
this.cardHeadline_2FA = page.getByTestId('two-factor-card');
this.text_no2FA = page.getByText('Es wurde noch kein zweiter Faktor für Sie eingerichtet.');
this.button_2FAEinrichten = page.getByTestId('open-2FA-self-service-dialog-icon');

}
}
26 changes: 14 additions & 12 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,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',
Expand Down
4 changes: 2 additions & 2 deletions tests/Klasse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: string | undefined = process.env.PW;
Expand Down Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions tests/MenuBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: string | undefined = process.env.PW;
const ADMIN: string | undefined = process.env.USER;
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions tests/Person.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -304,8 +304,8 @@ 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 }) => {
const startseite: StartPage = new StartPage(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);

Expand Down
50 changes: 48 additions & 2 deletions tests/Profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: string | undefined = process.env.PW;
Expand Down Expand Up @@ -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: LoginPage = new LoginPage(page);
Expand Down Expand Up @@ -374,4 +374,50 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
// await expect(profileView.button_2FAEinrichten).toBeEnabled();
});
});

test("Das eigene Profil öffnen, Passwort Ändern öffnen, und Status des Benutzernamenfelds prüfen", {tag: [LONG, STAGE]}, async ({ page }) => {
const profileView = new ProfilePage(page);
const header = new HeaderPage(page);
const login = new LoginPage(page);

const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const rollenname = 'TAuto-PW-R-RolleSchüler';
const rollenart = 'LERN';

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
const idSP = await getSPId(page, 'itslearning');
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, organisation, rollenart, nachname, vorname, idSP, rollenname);
roleId.push(userInfo.rolleId);
username.push(userInfo.username);

await header.logout();
await header.button_login.click();
await login.login(userInfo.username, userInfo.password);
await login.UpdatePW();
});

await test.step(`Profil öffnen`, async () => {
await header.button_profil.click();
});

await test.step(`Passwort Ändern öffnen`, async () => {
await expect(profileView.button_ZurueckVorherigeSeite).toBeVisible();
await expect(profileView.text_h2_Ueberschrift).toHaveText('Mein Profil');
// Passwort
await expect(profileView.cardHeadline_Passwort).toHaveText('Passwort');
await expect(profileView.button_NeuesPasswortSetzen).toBeEnabled();

profileView.button_NeuesPasswortSetzen.click();
profileView.button_PasswortAendern.click();
});

await test.step(`Status des Benutzernamenfelds prüfen`, async () => {
await expect(profileView.label_username).toHaveText(username[0]); // Benutzername ist nicht änderbar weil es nur Text ist
await expect(profileView.text_p_LoginPrompt).toHaveText('Bitte geben Sie Ihr aktuelles Passwort ein.');
await expect(profileView.input_password).toBeEnabled();
await page.goBack();
});
});
});
6 changes: 3 additions & 3 deletions tests/Schule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: string | undefined = process.env.PW;
Expand Down Expand Up @@ -123,8 +123,8 @@ 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 }) => {
const startseite: StartPage = new StartPage(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 () => {
const menue: MenuPage = await startseite.administration();
Expand Down
31 changes: 27 additions & 4 deletions tests/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -70,9 +70,9 @@ test.describe(`Testfälle für die Authentifizierung: Umgebung: ${process.env.UM
}
});

test('Erfolgreicher Standard Login Landesadmin', {tag: [LONG, SMOKE, STAGE]}, async ({ page }) => {
const login: LoginPage = new LoginPage(page);
const landing: LandingPage = new LandingPage(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);

await test.step(`Anmelden mit Benutzer ${ADMIN}`, async () => {
Expand Down Expand Up @@ -135,4 +135,27 @@ test.describe(`Testfälle für die Authentifizierung: Umgebung: ${process.env.UM
loggedIn = false;
})
})

test('Erfolgloser Login mit falschem Benutzernamen und gültigem Passwort in der Rolle Landesadmin', {tag: [LONG, STAGE]}, async ({ page }) => {
const login = new LoginPage(page);
const landing = new LandingPage(page);
const start = new StartPage(page);

await test.step('Anmelden mit falschem Benutzernamen fake-username, Inputfeld für Benutzernamen bleibt änderbar', async () => {
await page.goto(FRONTEND_URL);
await expect(landing.text_Willkommen).toBeVisible();
await landing.button_Anmelden.click();
await login.login('fake-username', PW);
await expect(login.text_span_inputerror).toBeVisible();
await expect(login.text_h1).toBeVisible();
await expect(login.input_username).toBeEditable();
loggedIn = false;
})

await test.step(`Anmelden mit Benutzer ${ADMIN}`, async () => {
await login.login(ADMIN, PW);
await expect(start.text_h2_Ueberschrift).toBeVisible();
loggedIn = true;
})
})
})
12 changes: 6 additions & 6 deletions tests/workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -84,10 +84,10 @@ 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 }) => {
const landing: LandingPage = new LandingPage(page);
const login: LoginPage = new LoginPage(page);
const startseite: StartPage = new StartPage(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);
const personManagement = new PersonManagementViewPage(page);
const personManagementDetail = new PersonDetailsViewPage(page);
const header = new HeaderPage(page);
Expand All @@ -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 () => {
Expand Down

0 comments on commit c7108ce

Please sign in to comment.