Files
pulse/tests/ui/pages.ui.js
T

45 lines
1.8 KiB
JavaScript
Raw Normal View History

'use strict';
const { test, expect } = require('./fixtures');
const PAGES = [
{ path: '/', title: 'Dashboard', heading: 'Dashboard' },
{ path: '/workers', title: 'Workers', heading: 'Workers' },
{ path: '/workflows', title: 'Workflows', heading: 'Workflows' },
{ path: '/executions', title: 'Executions', heading: 'Executions' },
{ path: '/quick', title: 'Quick Command', heading: 'Quick Command' },
{ path: '/scheduler', title: 'Scheduler', heading: 'Scheduler' },
];
for (const p of PAGES) {
test(`${p.path} loads without errors`, async ({ page }) => {
await page.goto(p.path);
await expect(page).toHaveTitle(`${p.title} | PULSE`);
await expect(page.getByRole('heading', { level: 1, name: p.heading })).toBeVisible();
await page.waitForLoadState('networkidle');
});
}
test('dashboard counts the three online workers', async ({ page }) => {
await page.goto('/');
await expect(page.locator('#dash-stat-total-val')).toHaveText('3');
await expect(page.locator('#dash-stat-online-val')).toHaveText('3');
await expect(page.locator('#dash-stat-offline-val')).toHaveText('0');
for (const n of ['node-01', 'node-02', 'node-03']) {
await expect(page.locator('#dash-workers-wrap').getByText(n, { exact: true })).toBeVisible();
}
});
test('workers page lists each worker as online', async ({ page }) => {
await page.goto('/workers');
const grid = page.locator('#wk-grid');
for (const n of ['node-01', 'node-02', 'node-03']) {
await expect(grid.getByText(n, { exact: true })).toBeVisible();
}
await expect(grid.getByText(/^online$/i)).toHaveCount(3);
});
test('quick command offers every online worker', async ({ page }) => {
await page.goto('/quick');
await expect(page.locator('#qc-worker option', { hasText: 'online' })).toHaveCount(3);
});