Skip to content

Commit

Permalink
SPSH-1375: Fixed the flaky test by selecting another locator. (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
phaelcg authored Nov 19, 2024
1 parent eca479e commit 5c258d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
2 changes: 2 additions & 0 deletions pages/admin/PersonCreationView.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class PersonCreationViewPage{
readonly data_Organisationsebene: Locator;
readonly label_Klasse: Locator;
readonly data_Klasse: Locator;
readonly listbox_Rolle: Locator;

constructor(page){
// Anlage Person
Expand Down Expand Up @@ -70,5 +71,6 @@ export class PersonCreationViewPage{
this.input_EinstiegsPasswort = page.locator('[data-testid="password-output-field"] input');
this.button_ZurueckErgebnisliste = page.getByTestId('back-to-list-button');
this.button_WeiterenBenutzerAnlegen = page.getByTestId('create-another-person-button');
this.listbox_Rolle = page.locator('.v-list');
}
}
40 changes: 20 additions & 20 deletions tests/Person.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro
await page.getByText(Organisation_Land, { exact: true }).nth(1).click();

await personCreationView.combobox_Rolle.click();
await expect(personCreationView.body).toContainText(landesadminRolle);
await expect(personCreationView.body).not.toContainText(rolleLehr);
await expect(personCreationView.body).not.toContainText(rolleLiV);
await expect(personCreationView.body).not.toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.body).not.toContainText(schuelerRolle);
await expect(personCreationView.listbox_Rolle).toContainText(landesadminRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(rolleLehr);
await expect(personCreationView.listbox_Rolle).not.toContainText(rolleLiV);
await expect(personCreationView.listbox_Rolle).not.toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(schuelerRolle);
});

await test.step(`Organisation 'Öffentliche Schulen Land Schleswig-Holstein' auswählen und Dropdown 'Rolle' prüfen`, async () => {
Expand All @@ -365,11 +365,11 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro
await page.keyboard.type(Organisation_OeffentlicheSchule);
await page.getByText(Organisation_OeffentlicheSchule, { exact: true }).click();
await personCreationView.combobox_Rolle.click();
await expect(personCreationView.body).toContainText(landesadminRolle);
await expect(personCreationView.body).not.toContainText(rolleLehr);
await expect(personCreationView.body).not.toContainText(rolleLiV);
await expect(personCreationView.body).not.toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.body).not.toContainText(schuelerRolle);
await expect(personCreationView.listbox_Rolle).toContainText(landesadminRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(rolleLehr);
await expect(personCreationView.listbox_Rolle).not.toContainText(rolleLiV);
await expect(personCreationView.listbox_Rolle).not.toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(schuelerRolle);
});

await test.step(`Organisation 'Ersatzschulen Land Schleswig-Holstein' auswählen und Dropdown 'Rolle' prüfen`, async () => {
Expand All @@ -378,23 +378,23 @@ test.describe(`Testfälle für die Administration von Personen": Umgebung: ${pro
await page.keyboard.type(Organisation_Ersatzschule);
await page.getByText(Organisation_Ersatzschule, { exact: true }).click();
await personCreationView.combobox_Rolle.click();
await expect(personCreationView.body).toContainText(landesadminRolle);
await expect(personCreationView.body).not.toContainText(rolleLehr);
await expect(personCreationView.body).not.toContainText(rolleLiV);
await expect(personCreationView.body).not.toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.body).not.toContainText(schuelerRolle);
await expect(personCreationView.listbox_Rolle).toContainText(landesadminRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(rolleLehr);
await expect(personCreationView.listbox_Rolle).not.toContainText(rolleLiV);
await expect(personCreationView.listbox_Rolle).not.toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(schuelerRolle);
});

await test.step(`Organisation 'Schule' auswählen und Dropdown 'Rolle' prüfen`, async () => {
await personCreationView.combobox_Schulstrukturknoten_Clear.click();
await personCreationView.combobox_Schulstrukturknoten.click();
await page.getByText(Organisation_Schule).click();
await personCreationView.combobox_Rolle.click();
await expect(personCreationView.body).toContainText(rolleLehr);
await expect(personCreationView.body).toContainText(rolleLiV);
await expect(personCreationView.body).toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.body).toContainText(schuelerRolle);
await expect(personCreationView.body).not.toContainText(landesadminRolle);
await expect(personCreationView.listbox_Rolle).toContainText(rolleLehr);
await expect(personCreationView.listbox_Rolle).toContainText(rolleLiV);
await expect(personCreationView.listbox_Rolle).toContainText(schuladminOeffentlichRolle);
await expect(personCreationView.listbox_Rolle).toContainText(schuelerRolle);
await expect(personCreationView.listbox_Rolle).not.toContainText(landesadminRolle);
});
});

Expand Down

0 comments on commit 5c258d7

Please sign in to comment.