The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { expect } from "e2e"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as FileSystem from "effect/FileSystem"; |
| 4 | |
| 5 | import { run } from "./shell.ts"; |
| 6 | import { runPromise, test, WEB } from "./t3.ts"; |
| 7 | |
| 8 | const utf16 = (text: string) => Buffer.from(`\ufeff${text}`, "utf16le"); |
| 9 | |
| 10 | test( |
| 11 | "The commit dialog refuses a merge whose UTF-16 file still has conflict markers", |
| 12 | WEB, |
| 13 | async ({ t3, app, screen }) => { |
| 14 | const project = await t3.project("demo", { |
| 15 | ".gitattributes": "README.md text working-tree-encoding=UTF-16\n", |
| 16 | "README.md": utf16("base\n"), |
| 17 | }); |
| 18 | const git = (args: ReadonlyArray<string>, allowExit: ReadonlyArray<number> = [0]) => |
| 19 | runPromise( |
| 20 | run( |
| 21 | "git", |
| 22 | ["-c", "user.name=Scenario", "-c", "user.email=scenario@example.invalid", ...args], |
| 23 | { cwd: project, allowExit }, |
| 24 | ), |
| 25 | ); |
| 26 | const commitReadme = async (text: string) => { |
| 27 | await runPromise( |
| 28 | Effect.flatMap(FileSystem.FileSystem, (fs) => |
| 29 | fs.writeFile(`${project}/README.md`, utf16(text)), |
| 30 | ), |
| 31 | ); |
| 32 | await git(["commit", "--quiet", "--all", "--message", text.trim()]); |
| 33 | }; |
| 34 | await git(["checkout", "--quiet", "-b", "feature"]); |
| 35 | await commitReadme("feature version\n"); |
| 36 | await git(["checkout", "--quiet", "main"]); |
| 37 | await commitReadme("main version\n"); |
| 38 | await git(["merge", "--quiet", "feature"], [1]); |
| 39 | const thread = await t3.thread({ project, title: "Merge", messages: ["merge"] }); |
| 40 | |
| 41 | await t3.open(thread); |
| 42 | await screen.getByRole("button", "Git action options").tap(); |
| 43 | await screen.getByRole("menuitem", "Commit").tap(); |
| 44 | await screen.getByPlaceholder("Leave empty to auto-generate").fill("Finish merge"); |
| 45 | await screen.getByRole("button", "Commit", { exact: true }).tap(); |
| 46 | // On a failed assertion e2e captures the committed merge itself. |
| 47 | await expect( |
| 48 | screen.getByText("unresolved merge conflicts in README.md", { exact: false }), |
| 49 | ).toBeVisible(); |
| 50 | await app.screenshot("refused"); |
| 51 | }, |
| 52 | ); |