|
1 | 1 | // SPDX-License-Identifier: MIT |
2 | 2 | import { test, expect } from '@playwright/test'; |
3 | | -import { submitAndWaitForResponse } from '@threadplane-internal/e2e-harness'; |
4 | 3 |
|
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 | + }); |
10 | 30 | }); |
0 commit comments