Skip to content

Commit

Permalink
SPSH-1418 fix stage profile test and firefox profile test (#103)
Browse files Browse the repository at this point in the history
* fix stage profile test and firefox profile test

* minor changes
  • Loading branch information
jakobmadp authored Nov 25, 2024
1 parent 676eec7 commit 761e090
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 41 deletions.
3 changes: 2 additions & 1 deletion base/organisation.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const testschule = "Testschule Schulportal";
export const testschule665 = "Testschule-PW665";
export const testschule665 = "Testschule-PW665";
export const landSH = "Land Schleswig-Holstein";
2 changes: 1 addition & 1 deletion pages/LoginView.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class LoginPage {
await this.button_login.click();
// BE requests laufen zeitverzögert zum FE; dieses muss im FE behoben werden; solange dies nicht der Fall ist, brauchen wir diesen workaround
// Wenn auf login/logout geklickt wird, sind teilweise noch requests am laufen
await this.page.waitForTimeout(1000);
await this.page.waitForTimeout(1000);

return new StartPage(this.page);
}
Expand Down
38 changes: 19 additions & 19 deletions tests/PersonBearbeiten.spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {expect, test} from "@playwright/test";
import {LandingPage} from "../pages/LandingView.page.ts";
import {LoginPage} from "../pages/LoginView.page.ts";
import {StartPage} from "../pages/StartView.page.ts";
import {PersonManagementViewPage} from "../pages/admin/PersonManagementView.page.ts";
import {PersonDetailsViewPage} from "../pages/admin/PersonDetailsView.page.ts";
import {HeaderPage} from "../pages/Header.page.ts";
import {faker} from "@faker-js/faker/locale/de";
import {createRolleAndPersonWithUserContext} from "../base/api/testHelperPerson.page.ts";
import {getSPId} from "../base/api/testHelperServiceprovider.page.ts";
import {UserInfo} from "../base/api/testHelper.page.ts";
import {addSystemrechtToRolle} from "../base/api/testHelperRolle.page.ts";
import {LONG, STAGE} from "../base/tags.ts";
import {deletePersonByUsername, deleteRolleById} from "../base/testHelperDeleteTestdata.ts";
import {typelehrer} from "../base/rollentypen.ts";
import {testschule} from "../base/organisation.ts";
import {email} from "../base/sp.ts";
import {generateLehrerNachname, generateLehrerVorname, generateRolleName} from "../base/testHelperGenerateTestdataNames.ts";
import {generateDateFuture, generateDateToday, gotoTargetURL} from "../base/testHelperUtils.ts";
import { expect, test } from "@playwright/test";
import { LandingPage } from "../pages/LandingView.page.ts";
import { LoginPage } from "../pages/LoginView.page.ts";
import { StartPage } from "../pages/StartView.page.ts";
import { PersonManagementViewPage } from "../pages/admin/PersonManagementView.page.ts";
import { PersonDetailsViewPage } from "../pages/admin/PersonDetailsView.page.ts";
import { HeaderPage } from "../pages/Header.page.ts";
import { faker } from "@faker-js/faker/locale/de";
import { createRolleAndPersonWithUserContext } from "../base/api/testHelperPerson.page.ts";
import { getSPId } from "../base/api/testHelperServiceprovider.page.ts";
import { UserInfo } from "../base/api/testHelper.page.ts";
import { addSystemrechtToRolle } from "../base/api/testHelperRolle.page.ts";
import { LONG, STAGE } from "../base/tags.ts";
import { deletePersonByUsername, deleteRolleById } from "../base/testHelperDeleteTestdata.ts";
import { typelehrer } from "../base/rollentypen.ts";
import { testschule } from "../base/organisation.ts";
import { email } from "../base/sp.ts";
import { generateLehrerNachname, generateLehrerVorname, generateRolleName} from "../base/testHelperGenerateTestdataNames.ts";
import { generateDateFuture, generateDateToday, gotoTargetURL } from "../base/testHelperUtils.ts";

const PW = process.env.PW;
const ADMIN = process.env.USER;
Expand Down
40 changes: 20 additions & 20 deletions tests/Profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { addSystemrechtToRolle } from "../base/api/testHelperRolle.page";
import { LONG, SHORT, STAGE, BROWSER } from "../base/tags";
import { deleteRolleById, deletePersonByUsername} from "../base/testHelperDeleteTestdata";
import { generateLehrerNachname, generateLehrerVorname, generateRolleName } from "../base/testHelperGenerateTestdataNames.ts";
import { testschule, testschule665, landSH } from "../base/organisation.ts";

const PW: string | undefined = process.env.PW;
const ADMIN: string | undefined = process.env.USER;
const FRONTEND_URL: string | undefined = process.env.FRONTEND_URL || "";

let username: string[] = []; // Im afterEach Block werden alle Testdaten gelöscht
let roleId: string[] = []; // Im afterEach Block werden alle Testdaten gelöscht
Expand All @@ -28,7 +28,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const startseite: StartPage = new StartPage(page);
const login: LoginPage = new LoginPage(page);

await page.goto(FRONTEND_URL);
await page.goto('/');
await landing.button_Anmelden.click();
await login.login(ADMIN, PW);
await expect(startseite.text_h2_Ueberschrift).toBeVisible();
Expand Down Expand Up @@ -69,17 +69,17 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const profileView = new ProfilePage(page);
const header = new HeaderPage(page);
const login: LoginPage = new LoginPage(page);
const startseite: StartPage = new StartPage(page);

const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Land Schleswig-Holstein';
const vorname = await generateLehrerVorname();
const nachname = await generateLehrerNachname();
const organisation = landSH;
const rollenname = await generateRolleName();
const rollenart = 'SYSADMIN'

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

Expand All @@ -98,6 +98,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
});

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

Expand Down Expand Up @@ -137,9 +138,9 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const header = new HeaderPage(page);
const login: LoginPage = new LoginPage(page);

const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const vorname = await generateLehrerVorname();
const nachname = await generateLehrerNachname();
const organisation = testschule;
const dienststellenNr = '1111111';
const rollenname = await generateRolleName();
const rollenart = 'LEHR';
Expand Down Expand Up @@ -195,9 +196,9 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const header = new HeaderPage(page);
const login: LoginPage = new LoginPage(page);

const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const vorname = await generateLehrerVorname();
const nachname = await generateLehrerNachname();
const organisation = testschule;
const dienststellenNr = '1111111';
const rollenname = await generateRolleName();
const rollenart = 'LERN';
Expand Down Expand Up @@ -252,9 +253,9 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const header = new HeaderPage(page);
const login: LoginPage = new LoginPage(page);

const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const vorname = await generateLehrerVorname();
const nachname = await generateLehrerNachname();
const organisation = testschule;
const dienststellenNr = '1111111';
const rollenname = await generateRolleName();
const rollenart = 'LEIT'
Expand Down Expand Up @@ -313,10 +314,10 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
let personId = '';
const vorname = await generateLehrerVorname();
const nachname = await generateLehrerNachname();
const organisation1 = 'Testschule Schulportal';
const organisation2 = 'Carl-Orff-Schule';
const organisation1 = testschule;
const organisation2 = testschule665;
const dienststellenNr1 = '1111111';
const dienststellenNr2 = '0702948';
const dienststellenNr2 = '1111165';
const rollenname = await generateRolleName();
const rollenart = 'LEHR';

Expand Down Expand Up @@ -414,8 +415,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const header = new HeaderPage(page);
const login = new LoginPage(page);

const organisation = 'Testschule Schulportal';
const rollenname = await generateRolleName();
const organisation = testschule;
const rollenart = 'LERN';

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
Expand Down

0 comments on commit 761e090

Please sign in to comment.