Bundles the prior autonomous-session output that was sitting unstaged: - Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances) - country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk after the per-subpath dynamic-import approach silently failed in webpack) - Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index, redirects (ocr to ai, reports to dashboard, invitations to users), docs/admin-ia-proposal.md - Per-template email tester (registry + endpoint + UI on Email admin page) - Cancel-document mode picker (delete-from-Documenso vs keep-for-audit) - Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers - Customize-widgets per-region sortables at xl+ (charts/rails/feed); single flat sortable below xl when the layout stacks; per-viewport saved orders - Audit doc updates capturing each shipped item - Lint fixes: react-compiler immutability in DonutChart (reduce instead of let-reassign), set-state-in-effect disables in CountryFlag and UploadForSigning preview-bytes effect, unused 'confirm' destructures in interest contract + reservation tabs, unescaped apostrophe in test-template card copy
104 lines
3.9 KiB
TypeScript
104 lines
3.9 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { login, navigateTo } from './helpers';
|
|
|
|
test.describe('Webhooks', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await login(page, 'super_admin');
|
|
});
|
|
|
|
// Test 20: Navigate to webhook management
|
|
test('webhook management page loads', async ({ page }) => {
|
|
await navigateTo(page, '/admin/webhooks');
|
|
await page.waitForTimeout(2_000);
|
|
|
|
const heading = page.getByText(/webhook/i).first();
|
|
await expect(heading).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
// Test 21: Create a webhook with auto-generated secret
|
|
test('create webhook shows auto-generated secret', async ({ page }) => {
|
|
await navigateTo(page, '/admin/webhooks');
|
|
await page.waitForTimeout(2_000);
|
|
|
|
// Click create button
|
|
const createBtn = page.getByRole('button', { name: 'Add Webhook' }).first();
|
|
await expect(createBtn).toBeVisible({ timeout: 5_000 });
|
|
await createBtn.click();
|
|
await page.waitForTimeout(1_000);
|
|
|
|
// Fill the form in the dialog/sheet
|
|
const dialog = page.getByRole('dialog').last();
|
|
await expect(dialog).toBeVisible({ timeout: 3_000 });
|
|
|
|
// Name
|
|
const nameInput = dialog.locator('input').first();
|
|
await nameInput.fill('Test Webhook');
|
|
|
|
// URL
|
|
const urlInput = dialog
|
|
.locator('input[type="url"], input[placeholder*="url" i], input[placeholder*="https" i]')
|
|
.first()
|
|
.or(dialog.locator('input').nth(1));
|
|
await urlInput.fill('https://webhook.example.com/test');
|
|
|
|
// Select at least one event
|
|
const firstCheckbox = dialog.locator('input[type="checkbox"], [role="checkbox"]').first();
|
|
if (await firstCheckbox.isVisible({ timeout: 2_000 }).catch(() => false)) {
|
|
await firstCheckbox.click();
|
|
}
|
|
|
|
// Submit
|
|
const saveBtn = dialog.getByRole('button', { name: /save|create|submit/i }).first();
|
|
if (await saveBtn.isVisible({ timeout: 2_000 }).catch(() => false)) {
|
|
await saveBtn.click();
|
|
await page.waitForTimeout(3_000);
|
|
|
|
// Secret may be shown in a toast, dialog, or inline - non-strict smoke assertion
|
|
expect(true).toBeTruthy();
|
|
}
|
|
});
|
|
|
|
// Test 22: Event list uses dot-style names
|
|
test('webhook events use dot-style names', async ({ page }) => {
|
|
await navigateTo(page, '/admin/webhooks');
|
|
await page.waitForTimeout(2_000);
|
|
|
|
// Click create to see event checkboxes
|
|
const createBtn = page.getByRole('button', { name: 'Add Webhook' }).first();
|
|
if (await createBtn.isVisible({ timeout: 3_000 }).catch(() => false)) {
|
|
await createBtn.click();
|
|
await page.waitForTimeout(1_000);
|
|
|
|
// Look for dot-style event names in the form
|
|
const dotStyleEvent = page.getByText(
|
|
/interest\.stage_changed|client\.created|document\.signed/,
|
|
);
|
|
await expect(dotStyleEvent.first()).toBeVisible({ timeout: 5_000 });
|
|
}
|
|
});
|
|
|
|
// Test 23: Webhook delivery log shows entries after events
|
|
test('webhook delivery log shows entries', async ({ page }) => {
|
|
await navigateTo(page, '/admin/webhooks');
|
|
await page.waitForTimeout(2_000);
|
|
|
|
// Click into the first webhook (if any exist)
|
|
const webhookRow = page.locator('table tbody tr, [data-testid*="webhook"]').first();
|
|
if (await webhookRow.isVisible({ timeout: 5_000 }).catch(() => false)) {
|
|
await webhookRow.click();
|
|
await page.waitForTimeout(2_000);
|
|
|
|
// Look for delivery log section
|
|
const deliverySection = page.getByText(/deliver/i).first();
|
|
await expect(deliverySection).toBeVisible({ timeout: 5_000 });
|
|
|
|
// Delivery log may have entries or be empty
|
|
const logTable = page.locator('table').last();
|
|
const hasEntries = (await logTable.locator('tbody tr').count()) > 0;
|
|
const emptyState = page.getByText(/no deliveries/i);
|
|
const hasEmpty = await emptyState.isVisible({ timeout: 2_000 }).catch(() => false);
|
|
expect(hasEntries || hasEmpty).toBeTruthy();
|
|
}
|
|
});
|
|
});
|