Skip to content

Commit 41eeccd

Browse files
committed
test(cockpit): e2e for structured refund approval card
1 parent 4dbc913 commit 41eeccd

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
// SPDX-License-Identifier: MIT
22
import { test, expect } from '@playwright/test';
3-
import { submitAndWaitForResponse } from '@threadplane-internal/e2e-harness';
43

5-
test('interrupts: hello prompt produces assistant turn', async ({ page }) => {
6-
const bubble = await submitAndWaitForResponse(page, 'Hello');
7-
// Smoke: backend booted, aimock replayed fixture, assistant bubble
8-
// finalized (data-streaming="false") and is present in the DOM.
9-
await expect(bubble).toBeVisible();
4+
test.describe('cockpit interrupts: refund approval', () => {
5+
test('approval card displays structured payload fields', async ({ page }) => {
6+
await page.goto('/');
7+
await page.getByText('Refund a duplicate charge').click();
8+
const dialog = page.locator('dialog.chat-approval-card');
9+
await expect(dialog).toBeVisible({ timeout: 20_000 });
10+
await expect(dialog).toContainText('Refund approval required');
11+
});
12+
13+
test('Approve issues the refund and the run finishes', async ({ page }) => {
14+
await page.goto('/');
15+
await page.getByText('Refund a duplicate charge').click();
16+
const dialog = page.locator('dialog.chat-approval-card');
17+
await expect(dialog).toBeVisible({ timeout: 20_000 });
18+
await dialog.getByRole('button', { name: 'Approve' }).click();
19+
await expect(page.getByText(/Refund of \$/i)).toBeVisible({ timeout: 20_000 });
20+
});
21+
22+
test('Cancel skips the refund and confirms cancellation', async ({ page }) => {
23+
await page.goto('/');
24+
await page.getByText('Refund a duplicate charge').click();
25+
const dialog = page.locator('dialog.chat-approval-card');
26+
await expect(dialog).toBeVisible({ timeout: 20_000 });
27+
await dialog.getByRole('button', { name: 'Cancel' }).click();
28+
await expect(page.getByText(/Refund cancelled by operator/i)).toBeVisible({ timeout: 20_000 });
29+
});
1030
});

0 commit comments

Comments
 (0)