Files
dev-desktop/scripts/scenarios/edit-from-here-keeps-thread-mention.e2e.ts

33 lines
1.3 KiB
TypeScript

import { expect } from "e2e";
import { test, WEB } from "./hanzo.ts";
test(
"Edit from here puts a sent message back with its thread mention",
WEB,
async ({ hanzo, app, screen, browser }) => {
const project = await hanzo.project("demo");
await hanzo.thread({ project, title: "Release notes", messages: ["Draft the notes"] });
const thread = await hanzo.thread({ project, title: "Review work", messages: ["Start"] });
await hanzo.open(thread);
const composer = screen.getByRole("textbox");
await composer.pressSequentially("Review @Release");
await screen.getByRole("option", "Release notes", { exact: false }).tap();
await expect(composer).toContainText("Release notes");
await browser.keyboard.press("Enter");
// The seeded message came from the CLI, which the timeline attributes to an agent: only the
// message sent here offers Edit from here.
const editFromHere = screen.getByRole("button", "Edit from here");
await expect(editFromHere).toHaveCount(1, { timeout: 60_000 });
await expect(editFromHere).toBeEnabled({ timeout: 60_000 });
await editFromHere.tap();
await screen.getByRole("button", "Revert and keep changes").tap();
await expect(composer).toContainText("Review");
await app.screenshot("restored-draft");
await expect(composer).toContainText("Release notes");
},
);