mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(feedback): route failed-run Report issue through the offline handoff (#429)
Apply the always-on handoff to the failed-run Report issue button too. Un-gate the two buttons in tool-page.tsx from the analytics toggle, and extend the dialog offline handoff to source=failed_job, prefilling the GitHub issue with the tool id and error category so it is actionable even with an empty message. Follows #428. Claude-Session: https://claude.ai/code/session_01XVrHKXwzZDWBWgkGQdPZ3A
This commit is contained in:
@@ -22,7 +22,7 @@ afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe("FeedbackDialog global off-state handoff", () => {
|
||||
describe("FeedbackDialog off-state handoff", () => {
|
||||
it("reveals GitHub and email handoff when the server does not record the feedback", async () => {
|
||||
submitFeedback.mockResolvedValue({ ok: true, accepted: false });
|
||||
render(<FeedbackDialog open source="global" onClose={vi.fn()} />);
|
||||
@@ -50,6 +50,33 @@ describe("FeedbackDialog global off-state handoff", () => {
|
||||
expect(screen.queryByText("Thanks for the feedback.")).toBeNull();
|
||||
});
|
||||
|
||||
it("threads tool and error into the handoff for a failed run", async () => {
|
||||
submitFeedback.mockResolvedValue({ ok: true, accepted: false });
|
||||
render(
|
||||
<FeedbackDialog
|
||||
open
|
||||
source="failed_job"
|
||||
toolId="pdf-compress"
|
||||
jobStatus="failed"
|
||||
errorCategory="timeout"
|
||||
onClose={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText(MESSAGE_PLACEHOLDER), {
|
||||
target: { value: "It hung on a 50MB file" },
|
||||
});
|
||||
fireEvent.click(screen.getByRole("button", { name: "Send feedback" }));
|
||||
|
||||
const githubLink = await screen.findByRole("link", { name: "Open a GitHub issue" });
|
||||
const details =
|
||||
new URL(githubLink.getAttribute("href") ?? "").searchParams.get("details") ?? "";
|
||||
expect(details).toContain("pdf-compress");
|
||||
expect(details).toContain("timeout");
|
||||
expect(details).toContain("It hung on a 50MB file");
|
||||
expect(screen.queryByText("Thanks for the feedback.")).toBeNull();
|
||||
});
|
||||
|
||||
it("shows the normal thanks when the feedback is recorded", async () => {
|
||||
submitFeedback.mockResolvedValue({ ok: true, accepted: true });
|
||||
render(<FeedbackDialog open source="global" onClose={vi.fn()} />);
|
||||
|
||||
Reference in New Issue
Block a user