2024-04-19 17:37:38 +07:00
|
|
|
import type { Page } from '@playwright/test';
|
|
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
|
|
|
|
|
export const checkDocumentTabCount = async (page: Page, tabName: string, count: number) => {
|
|
|
|
|
await page.getByRole('tab', { name: tabName }).click();
|
|
|
|
|
|
|
|
|
|
if (tabName !== 'All') {
|
|
|
|
|
await expect(page.getByRole('tab', { name: tabName })).toContainText(count.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count === 0) {
|
|
|
|
|
await expect(page.getByTestId('empty-document-state')).toBeVisible();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-02 15:49:09 +10:00
|
|
|
await expect(page.getByTestId('data-table-count')).toContainText(`Showing ${count}`);
|
2024-04-19 17:37:38 +07:00
|
|
|
};
|