- Set up Playwright in dedicated e2e directory - Multi-environment support (local, staging) - TOTP authentication handling with otplib - Test coverage for organizations, devices, alerts, status indicators - Helper utilities for common test operations - Comprehensive README with setup and usage instructions - Setup script for quick initialization
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Organizations', () => {
|
|
test('can view organizations list', async ({ page }) => {
|
|
await page.goto('/orgs');
|
|
|
|
// Check for page heading
|
|
await expect(page.getByRole('heading', { name: 'Organizations' })).toBeVisible();
|
|
|
|
// Should show at least one organization
|
|
await expect(page.locator('[data-test="organization-card"]').first()).toBeVisible();
|
|
});
|
|
|
|
test('can switch between organizations', async ({ page }) => {
|
|
await page.goto('/orgs');
|
|
|
|
// Get first organization name
|
|
const firstOrg = page.locator('[data-test="organization-card"]').first();
|
|
await firstOrg.waitFor();
|
|
const orgName = await firstOrg.textContent();
|
|
|
|
// Click to view organization
|
|
await firstOrg.click();
|
|
|
|
// Should navigate to organization dashboard
|
|
await expect(page).toHaveURL(/\/orgs\/[^\/]+/);
|
|
|
|
// Organization name should appear in navigation or header
|
|
if (orgName) {
|
|
await expect(page.locator('text=' + orgName.trim())).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('organization dashboard shows key sections', async ({ page }) => {
|
|
// Navigate to organizations and select first one
|
|
await page.goto('/orgs');
|
|
await page.locator('[data-test="organization-card"]').first().click();
|
|
|
|
// Wait for dashboard to load
|
|
await expect(page).toHaveURL(/\/orgs\/[^\/]+/);
|
|
|
|
// Check for key navigation items or sections
|
|
// Adjust these based on your actual dashboard layout
|
|
const navigationItems = [
|
|
'Devices',
|
|
'Sites',
|
|
'Alerts',
|
|
];
|
|
|
|
for (const item of navigationItems) {
|
|
await expect(
|
|
page.getByRole('link', { name: new RegExp(item, 'i') })
|
|
).toBeVisible();
|
|
}
|
|
});
|
|
});
|