Skip to content

Commit

Permalink
Spsh-1359: Made the method generateRolleName async (#100)
Browse files Browse the repository at this point in the history
* SPSH-1359: Fixed the issue with the rollenName when the test once failed.

* SPSH-1359: Made the method generateRolleName() async

* SPSH-1359: Cleaned up file

* SPSH-1359: Added async to the method generateRolleName
  • Loading branch information
phaelcg authored Nov 20, 2024
1 parent 0625c84 commit 0a6d4c1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 20 deletions.
6 changes: 2 additions & 4 deletions base/testHelperGenerateTestdataNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export async function generateLehrerNachname(){
return "TAuto-PW-N-" + faker.person.lastName();
}

export function generateRolleName(){
export async function generateRolleName(){
return "TAuto-PW-R-" + faker.lorem.word({ length: { min: 8, max: 12 }});
}


}
6 changes: 3 additions & 3 deletions tests/Person.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro
// Step 1: Create a Schuladmin as Landesadmin and login as the newly created Schuladmin user
await test.step(`Schuladmin anlegen und mit diesem anmelden`, async () => {
const idSP = await getSPId(page, 'Schulportal-Administration');
userInfo = await createRolleAndPersonWithUserContext(page, schulstrukturknoten, 'LEIT', nachname, vorname, idSP, generateRolleName());
userInfo = await createRolleAndPersonWithUserContext(page, schulstrukturknoten, 'LEIT', nachname, vorname, idSP, await generateRolleName());
await addSystemrechtToRolle(page, userInfo.rolleId, 'PERSONEN_VERWALTEN');
await addSystemrechtToRolle(page, userInfo.rolleId, 'PERSONEN_ANLEGEN');

Expand Down Expand Up @@ -519,7 +519,7 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro

await test.step(`Testdaten: Landesadmin anlegen und mit diesem anmelden`, async () => {
const idSP = await getSPId(page, 'Schulportal-Administration');
userInfo = await createRolleAndPersonWithUserContext(page, 'Land Schleswig-Holstein', 'SYSADMIN', 'TAuto-PW-B-Master', 'TAuto-PW-B-Hans', idSP, generateRolleName());
userInfo = await createRolleAndPersonWithUserContext(page, 'Land Schleswig-Holstein', 'SYSADMIN', 'TAuto-PW-B-Master', 'TAuto-PW-B-Hans', idSP, await generateRolleName());
await addSystemrechtToRolle(page, userInfo.rolleId, 'ROLLEN_VERWALTEN');
await addSystemrechtToRolle(page, userInfo.rolleId, 'PERSONEN_SOFORT_LOESCHEN');
await addSystemrechtToRolle(page, userInfo.rolleId, 'PERSONEN_VERWALTEN');
Expand Down Expand Up @@ -681,7 +681,7 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro

const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const rolle = generateRolleName();
const rolle = await generateRolleName();
const berechtigung = 'SYSADMIN';
const idSP = await getSPId(page, 'Schulportal-Administration');

Expand Down
4 changes: 2 additions & 2 deletions tests/PersonBearbeiten.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro

const addminVorname = "TAuto-PW-V-" + faker.person.firstName();
const adminNachname = "TAuto-PW-N-" + faker.person.lastName();
const adminRolle = generateRolleName();
const adminRolle = await generateRolleName();
const adminRollenart = 'LEIT';
const adminOrganisation = 'Testschule-PW665';
const adminIdSP = await getSPId(page, 'Schulportal-Administration');
let userInfoAdmin: UserInfo;

const lehrerVorname = "TAuto-PW-V-" + faker.person.firstName();
const lehrerNachname = "TAuto-PW-N-" + faker.person.lastName();
const lehrerRolle = generateRolleName();
const lehrerRolle = await generateRolleName();
const lehrerRollenart = 'LEHR';
const lehrerOrganisation = 'Testschule-PW665';
const lehrerIdSP = await getSPId(page, 'E-Mail');
Expand Down
12 changes: 6 additions & 6 deletions tests/Profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Land Schleswig-Holstein';
const rollenname = generateRolleName();
const rollenname = await generateRolleName();
const rollenart = 'SYSADMIN'

await test.step(`Landesadmin via api anlegen und mit diesem anmelden`, async () => {
Expand Down Expand Up @@ -141,7 +141,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const dienststellenNr = '1111111';
const rollenname = generateRolleName();
const rollenname = await generateRolleName();
const rollenart = 'LEHR';

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
Expand Down Expand Up @@ -199,7 +199,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const dienststellenNr = '1111111';
const rollenname = generateRolleName();
const rollenname = await generateRolleName();
const rollenart = 'LERN';

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
Expand Down Expand Up @@ -256,7 +256,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const dienststellenNr = '1111111';
const rollenname = generateRolleName();
const rollenname = await generateRolleName();
const rollenart = 'LEIT'

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
Expand Down Expand Up @@ -317,7 +317,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const organisation2 = 'Carl-Orff-Schule';
const dienststellenNr1 = '1111111';
const dienststellenNr2 = '0702948';
const rollenname = generateRolleName();
const rollenname = await generateRolleName();
const rollenart = 'LEHR';

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
Expand Down Expand Up @@ -384,7 +384,7 @@ test.describe(`Testfälle für das eigene Profil anzeigen: Umgebung: ${process.e
const vorname = "TAuto-PW-V-" + faker.person.firstName();
const nachname = "TAuto-PW-N-" + faker.person.lastName();
const organisation = 'Testschule Schulportal';
const rollenname = generateRolleName();
const rollenname = await generateRolleName();
const rollenart = 'LERN';

await test.step(`Lehrer via api anlegen und mit diesem anmelden`, async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/Schule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ test.describe(`Testfälle für die Administration von Schulen: Umgebung: ${proce

const startseite: StartPage = await test.step(`Testdaten: Schuladmin anlegen und mit diesem anmelden`, async () => {
const idSP = await getSPId(page, 'Schulportal-Administration');
userInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LEIT', 'TAuto-PW-B-MeierLEIT', 'TAuto-PW-B-Hans', idSP, generateRolleName());
userInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LEIT', 'TAuto-PW-B-MeierLEIT', 'TAuto-PW-B-Hans', idSP, await generateRolleName());
personId.push(userInfo.personId);
roleId.push(userInfo.rolleId);
await addSystemrechtToRolle(page, userInfo.rolleId, 'SCHULEN_VERWALTEN');
Expand Down
6 changes: 3 additions & 3 deletions tests/SchulportalAdministration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test.describe(`Testfälle für Schulportal Administration": Umgebung: ${process.
await login.login(ADMIN, PW);

const idSP = await getSPId(page, 'E-Mail');
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LEHR', 'TAuto-PW-B-MeierLehrer', 'TAuto-PW-B-Hans', idSP, generateRolleName());
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LEHR', 'TAuto-PW-B-MeierLehrer', 'TAuto-PW-B-Hans', idSP, await generateRolleName());
personId.push(userInfo.personId);
rolleId.push(userInfo.rolleId);
await header.logout();
Expand All @@ -88,7 +88,7 @@ test.describe(`Testfälle für Schulportal Administration": Umgebung: ${process.
await login.login(ADMIN, PW);

const idSP = await getSPId(page, 'itslearning');
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LERN', 'TAuto-PW-B-JansenSchüler', 'TAuto-PW-B-Helga', idSP, generateRolleName());
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LERN', 'TAuto-PW-B-JansenSchüler', 'TAuto-PW-B-Helga', idSP, await generateRolleName());
personId.push(userInfo.personId);
rolleId.push(userInfo.rolleId);
await header.logout();
Expand All @@ -115,7 +115,7 @@ test.describe(`Testfälle für Schulportal Administration": Umgebung: ${process.
await login.login(ADMIN, PW);

const idSP = await getSPId(page, 'Schulportal-Administration');
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LEIT', 'TAuto-PW-B-MeierAdmin', 'TAuto-PW-B-Peter', idSP, generateRolleName());
const userInfo: UserInfo = await createRolleAndPersonWithUserContext(page, 'Testschule Schulportal', 'LEIT', 'TAuto-PW-B-MeierAdmin', 'TAuto-PW-B-Peter', idSP, await generateRolleName());
personId.push(userInfo.personId);
rolleId.push(userInfo.rolleId);

Expand Down
2 changes: 1 addition & 1 deletion tests/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test.describe(`Testfälle für die Authentifizierung: Umgebung: ${process.env.UM

const lehrerVorname = "TAuto-PW-V-" + faker.person.firstName();
const lehrerNachname = "TAuto-PW-N-" + faker.person.lastName();
const lehrerRolle = generateRolleName();
const lehrerRolle = await generateRolleName();
const lehrerRollenart = 'LEHR';
const lehrerOrganisation = 'Testschule Schulportal';
let userInfoLehrer: UserInfo;
Expand Down

0 comments on commit 0a6d4c1

Please sign in to comment.