- Added integration tests (Preseem, Gaiia, Slack, webhooks) - Added SNMP configuration and discovery tests - Added form validation and error handling tests - Added detailed alert workflow tests (lifecycle, actions, filtering, history) - Added agent token management tests (creation, assignment, deletion) Covers: - Third-party integration UI - SNMP credential hierarchy (org/site/device) - Form validation and error states - Alert bulk actions and filtering - Agent token lifecycle and device assignment
167 lines
5.4 KiB
TypeScript
167 lines
5.4 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Third-Party Integrations', () => {
|
|
test.describe('Preseem Integration', () => {
|
|
test('can access Preseem devices page', async ({ page }) => {
|
|
await page.goto('/settings/integrations/preseem/devices');
|
|
|
|
// Skip if redirected to sudo verification or login
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
await expect(page).toHaveURL(/\/settings\/integrations\/preseem\/devices/);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
});
|
|
|
|
test('shows Preseem device mapping', async ({ page }) => {
|
|
await page.goto('/settings/integrations/preseem/devices');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
// Look for device mapping interface
|
|
const mappingInterface = page.locator(
|
|
':has-text("Preseem"), table, [data-device]'
|
|
).first();
|
|
|
|
if (await mappingInterface.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await expect(mappingInterface).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('can access Preseem insights page', async ({ page }) => {
|
|
await page.goto('/settings/integrations/preseem/insights');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
await expect(page).toHaveURL(/\/settings\/integrations\/preseem\/insights/);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
});
|
|
|
|
test('shows Preseem insights data', async ({ page }) => {
|
|
await page.goto('/settings/integrations/preseem/insights');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
// Look for insights data
|
|
const insightsData = page.locator(
|
|
'table, [data-insight], :has-text("Preseem")'
|
|
).first();
|
|
|
|
if (await insightsData.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await expect(insightsData).toBeVisible();
|
|
}
|
|
});
|
|
});
|
|
|
|
test.describe('Gaiia Integration', () => {
|
|
test('can access Gaiia mapping page', async ({ page }) => {
|
|
await page.goto('/settings/integrations/gaiia/mapping');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
await expect(page).toHaveURL(/\/settings\/integrations\/gaiia\/mapping/);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
});
|
|
|
|
test('shows Gaiia device mapping interface', async ({ page }) => {
|
|
await page.goto('/settings/integrations/gaiia/mapping');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
// Look for mapping controls
|
|
const mappingControls = page.locator(
|
|
'select, button:has-text("Map"), table'
|
|
).first();
|
|
|
|
if (await mappingControls.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await expect(mappingControls).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('can access Gaiia reconciliation page', async ({ page }) => {
|
|
await page.goto('/settings/integrations/gaiia/reconciliation');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
await expect(page).toHaveURL(/\/settings\/integrations\/gaiia\/reconciliation/);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
});
|
|
|
|
test('shows reconciliation status', async ({ page }) => {
|
|
await page.goto('/settings/integrations/gaiia/reconciliation');
|
|
|
|
if ((await page.url()).includes('sudo-verify') || (await page.url()).includes('log-in')) {
|
|
return;
|
|
}
|
|
|
|
// Look for reconciliation status
|
|
const status = page.locator(
|
|
':has-text("synced"), :has-text("pending"), table'
|
|
).first();
|
|
|
|
if (await status.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await expect(status).toBeVisible();
|
|
}
|
|
});
|
|
});
|
|
|
|
test.describe('Integration Settings', () => {
|
|
test('can view all integrations', async ({ page }) => {
|
|
await page.goto('/settings/integrations');
|
|
|
|
if ((await page.url()).includes('sudo-verify')) {
|
|
return;
|
|
}
|
|
|
|
await expect(page).toHaveURL(/\/settings\/integrations/);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
});
|
|
|
|
test('shows available integrations', async ({ page }) => {
|
|
await page.goto('/settings/integrations');
|
|
|
|
if ((await page.url()).includes('sudo-verify')) {
|
|
return;
|
|
}
|
|
|
|
// Look for integration cards or list
|
|
const integrationCard = page.locator(
|
|
':has-text("Slack"), :has-text("Webhook"), :has-text("Preseem"), :has-text("Gaiia")'
|
|
).first();
|
|
|
|
if (await integrationCard.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await expect(integrationCard).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test('can test integration connection', async ({ page }) => {
|
|
await page.goto('/settings/integrations');
|
|
|
|
if ((await page.url()).includes('sudo-verify')) {
|
|
return;
|
|
}
|
|
|
|
// Look for test connection button
|
|
const testButton = page.locator(
|
|
'button:has-text("Test"), button:has-text("Test Connection")'
|
|
).first();
|
|
|
|
if (await testButton.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await expect(testButton).toBeVisible();
|
|
}
|
|
});
|
|
});
|
|
});
|