HH/e2e/tests/workflows/champion-dashboard.spec.ts
ismail c5f76b3855
Some checks are pending
Build and Push Docker Image / build (push) Waiting to run
updates
2026-05-11 14:45:30 +03:00

50 lines
1.7 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { RoleAuthHelper } from '../../helpers/helpers';
import { DEPT_ID } from '../../helpers/api-helper';
test.describe('Champion Dashboard Tests', () => {
test.setTimeout(120000);
test('login as champion and view department detail', async ({ page }) => {
const auth = new RoleAuthHelper(page);
await auth.login('champion');
await page.waitForTimeout(800);
await page.waitForURL(/organizations|dashboard/, { timeout: 10000 }).catch(() => {});
await page.waitForLoadState('domcontentloaded');
await page.waitForTimeout(2500);
const url = page.url();
expect(url).toMatch(/organizations|dashboard|px-sources/);
await page.waitForTimeout(800);
});
test('view department detail page', async ({ page }) => {
const auth = new RoleAuthHelper(page);
await auth.login('champion');
await page.waitForTimeout(800);
await page.goto(`/organizations/departments/${DEPT_ID}/`);
await page.waitForLoadState('domcontentloaded');
await page.waitForTimeout(2500);
const pageText = (await page.textContent('body')) || '';
expect(pageText.length).toBeGreaterThan(0);
await page.waitForTimeout(800);
});
test('check pending requests on department page', async ({ page }) => {
const auth = new RoleAuthHelper(page);
await auth.login('champion');
await page.waitForTimeout(800);
await page.goto(`/organizations/departments/${DEPT_ID}/`);
await page.waitForLoadState('domcontentloaded');
await page.waitForTimeout(2500);
const pageText = (await page.textContent('body')) || '';
expect(pageText).toBeTruthy();
await page.waitForTimeout(800);
});
});