From 298f92ee7ef683ebe21296321206c1388aa93d07 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 10 Feb 2025 15:16:40 +0100 Subject: [PATCH] add test --- tests/playwright-test/ui-mode-trace.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.ts index 8001623721..701a0f51bb 100644 --- a/tests/playwright-test/ui-mode-trace.spec.ts +++ b/tests/playwright-test/ui-mode-trace.spec.ts @@ -499,3 +499,22 @@ test('skipped steps should have an indicator', async ({ runUITest }) => { await expect(skippedMarker).toBeVisible(); await expect(skippedMarker).toHaveAccessibleName('skipped'); }); + +test('should show copy prompt button in errors tab', async ({ runUITest }) => { + const { page } = await runUITest({ + 'a.spec.ts': ` + import { test, expect } from '@playwright/test'; + test('fails', async () => { + expect(1).toBe(2); + }); + `, + }); + + await page.getByText('fails').dblclick(); + + await page.context().grantPermissions(['clipboard-read', 'clipboard-write']); + await page.getByText('Errors', { exact: true }).click(); + await page.locator('.tab-errors').getByRole('button', { name: 'Fix with AI' }).click(); + const prompt = await page.evaluate(() => navigator.clipboard.readText()); + expect(prompt, 'contains error').toContain('expect(received).toBe(expected)'); +}); \ No newline at end of file