Skip to content

Commit

Permalink
PR Review 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussefBouch committed Nov 19, 2024
1 parent 1a351bd commit 7eaa634
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
16 changes: 15 additions & 1 deletion pages/admin/KlasseManagementView.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Locator, Page } from '@playwright/test';
import { expect, type Locator, Page } from '@playwright/test';
import { FooterDataTablePage } from '../FooterDataTable.page';

export class KlasseManagementViewPage{
Expand Down Expand Up @@ -29,4 +29,18 @@ export class KlasseManagementViewPage{
this.tableRows = page.locator('table >> tbody >> tr');
this.footerDataTable = new FooterDataTablePage(page);
}

// Loops through the Data in the table and checks if the Dienstellennummer and Klassenname are not empty
public async checkTableData() {
const tableRowsCount = await this.tableRows.count();
for (let i = 0; i < tableRowsCount; i++) {
const dienststellennummerCell = this.tableRows.nth(i).locator('td').nth(0);
const klassennameCell = this.tableRows.nth(i).locator('td').nth(1);

await expect(dienststellennummerCell).toBeVisible();
await expect(dienststellennummerCell).not.toHaveText('---');
await expect(klassennameCell).toBeVisible();
await expect(klassennameCell).not.toBeEmpty();
}
}
}
25 changes: 2 additions & 23 deletions tests/Klasse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,31 +151,10 @@ test.describe(`Testfälle für die Administration von Klassen: Umgebung: ${proce
await klasseManagementView.footerDataTable.combobox_AnzahlEintraege.click();
await page.getByRole('option', { name: '100' }).click();

// Check the first 100 entries
const rows = klasseManagementView.tableRows;
const rowCount = await rows.count();

for (let i = 0; i < rowCount; i++) {
const dienststellennummerCell = rows.nth(i).locator('td').nth(0);
const klassennameCell = rows.nth(i).locator('td').nth(1);

await expect(dienststellennummerCell).toBeVisible();
await expect(dienststellennummerCell).not.toHaveText('---');
await expect(klassennameCell).toBeVisible();
await expect(klassennameCell).not.toBeEmpty();
}

await klasseManagementView.checkTableData();
// Go to the last page
await klasseManagementView.footerDataTable.text_LetzteSeite.click();
for (let i = 0; i < rowCount; i++) {
const dienststellennummerCell = rows.nth(i).locator('td').nth(0);
const klassennameCell = rows.nth(i).locator('td').nth(1);

await expect(dienststellennummerCell).toBeVisible();
await expect(dienststellennummerCell).not.toHaveText('---');
await expect(klassennameCell).toBeVisible();
await expect(klassennameCell).not.toBeEmpty();
}
await klasseManagementView.checkTableData();
});
});
});

0 comments on commit 7eaa634

Please sign in to comment.