towerops/e2e/tests/agents.spec.ts
Graham McIntire 0832abf33a
feat: comprehensive e2e test coverage for all user-facing features
- Added e2e tests for agents, insights, maintenance windows, maps, help pages
- Added e2e tests for organization settings, config timeline, MikroTik backups
- Added comprehensive search functionality tests
- Added dashboard and sites navigation tests
- Updated existing tests to handle sudo verification redirects
- Fixed navigation tests to be more defensive about missing data
- All 301 tests passing across chromium, firefox, and webkit
2026-03-06 16:58:06 -06:00

73 lines
2.1 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Agents', () => {
test('can view agents list', async ({ page }) => {
await page.goto('/agents');
await expect(page).toHaveURL(/\/agents/);
await expect(page.locator('body')).toBeVisible();
});
test('can view agent details', async ({ page }) => {
await page.goto('/agents');
// Find first agent link
const firstAgent = page.locator('a[href*="/agents/"]').first();
if (await firstAgent.isVisible()) {
await firstAgent.click();
await expect(page).toHaveURL(/\/agents\/[^\/]+/);
}
});
test('can edit agent settings', async ({ page }) => {
await page.goto('/agents');
// Navigate to first agent
const firstAgent = page.locator('a[href*="/agents/"]').first();
if (await firstAgent.isVisible()) {
await firstAgent.click();
// Look for edit button
const editButton = page.locator(
'a[href*="/edit"], button:has-text("Edit"), a:has-text("Edit")'
).first();
if (await editButton.isVisible()) {
await editButton.click();
await expect(page).toHaveURL(/\/agents\/[^\/]+\/edit/);
}
}
});
test('can view agent assignments', async ({ page }) => {
await page.goto('/agents');
// Navigate to first agent details
const firstAgent = page.locator('a[href*="/agents/"]').first();
if (await firstAgent.isVisible()) {
await firstAgent.click();
// Look for assigned devices section
const assignmentsSection = page.locator(
':has-text("Assigned"), :has-text("Devices")'
).first();
if (await assignmentsSection.isVisible({ timeout: 2000 }).catch(() => false)) {
await expect(assignmentsSection).toBeVisible();
}
}
});
test('shows agent status', async ({ page }) => {
await page.goto('/agents');
// Look for status indicators (Online, Offline, etc.)
const statusIndicator = page.locator(
':has-text("Online"), :has-text("Offline"), [data-status]'
).first();
if (await statusIndicator.isVisible({ timeout: 2000 }).catch(() => false)) {
await expect(statusIndicator).toBeVisible();
}
});
});