Adding a button for copying error messages (#1882)
close #1870 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a “Copy” button to error banners and chat error output so users can quickly copy error messages with clear feedback. Addresses Linear #1870. - **New Features** - Introduced CopyErrorMessage component that writes to clipboard and shows “Copied” for 2s. - Added the copy button to the Preview error banner and DyadOutput; actions grouped at the bottom beside “Fix with AI”. - Added Playwright e2e test and helpers to verify copy behavior and clipboard content. <sup>Written for commit 12e9bf1437ded36dc022e1d795025580d2ffd111. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
committed by
GitHub
parent
4b17870049
commit
c174778d5f
@@ -1,4 +1,5 @@
|
||||
import { testSkipIfWindows, test } from "./helpers/test_helper";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
testSkipIfWindows("fix error with AI", async ({ po }) => {
|
||||
await po.setUp({ autoApprove: true });
|
||||
@@ -20,6 +21,26 @@ testSkipIfWindows("fix error with AI", async ({ po }) => {
|
||||
await po.snapshotPreview();
|
||||
});
|
||||
|
||||
testSkipIfWindows("copy error message from banner", async ({ po }) => {
|
||||
await po.setUp({ autoApprove: true });
|
||||
await po.sendPrompt("tc=create-error");
|
||||
|
||||
await po.page.getByText("Error Line 6 error", { exact: true }).waitFor({
|
||||
state: "visible",
|
||||
});
|
||||
|
||||
await po.clickCopyErrorMessage();
|
||||
|
||||
const clipboardText = await po.getClipboardText();
|
||||
expect(clipboardText).toContain("Error Line 6 error");
|
||||
expect(clipboardText.length).toBeGreaterThan(0);
|
||||
|
||||
await expect(po.page.getByRole("button", { name: "Copied" })).toBeVisible();
|
||||
|
||||
await expect(po.page.getByRole("button", { name: "Copied" })).toBeHidden({
|
||||
timeout: 3000,
|
||||
});
|
||||
});
|
||||
test("fix all errors button", async ({ po }) => {
|
||||
await po.setUp({ autoApprove: true });
|
||||
await po.sendPrompt("tc=create-multiple-errors");
|
||||
|
||||
@@ -575,6 +575,13 @@ export class PageObject {
|
||||
await this.page.getByRole("button", { name: "Fix error with AI" }).click();
|
||||
}
|
||||
|
||||
async clickCopyErrorMessage() {
|
||||
await this.page.getByRole("button", { name: /Copy/ }).click();
|
||||
}
|
||||
|
||||
async getClipboardText(): Promise<string> {
|
||||
return await this.page.evaluate(() => navigator.clipboard.readText());
|
||||
}
|
||||
async clickFixAllErrors() {
|
||||
await this.page.getByRole("button", { name: /Fix All Errors/ }).click();
|
||||
}
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
- img
|
||||
- text: "src/pages/Index.tsx Summary: intentionally add first error"
|
||||
- img
|
||||
- text: Error
|
||||
- text: Error First error in Index...
|
||||
- img
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Fix with AI":
|
||||
- img
|
||||
- text: First error in Index...
|
||||
- img
|
||||
- img
|
||||
- text: ErrorComponent.tsx
|
||||
- button "Edit":
|
||||
@@ -19,11 +20,12 @@
|
||||
- img
|
||||
- text: "src/components/ErrorComponent.tsx Summary: intentionally add second error"
|
||||
- img
|
||||
- text: Error
|
||||
- text: Error Second error in ErrorComponent...
|
||||
- img
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Fix with AI":
|
||||
- img
|
||||
- text: Second error in ErrorComponent...
|
||||
- img
|
||||
- img
|
||||
- text: helper.ts
|
||||
- button "Edit":
|
||||
@@ -31,11 +33,12 @@
|
||||
- img
|
||||
- text: "src/utils/helper.ts Summary: intentionally add third error"
|
||||
- img
|
||||
- text: Error
|
||||
- text: Error Third error in helper...
|
||||
- img
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Fix with AI":
|
||||
- img
|
||||
- text: Third error in helper...
|
||||
- img
|
||||
- button "Fix All Errors (3)":
|
||||
- img
|
||||
- button:
|
||||
|
||||
Reference in New Issue
Block a user