The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import { expect } from "e2e"; |
| 2 | import * as Schema from "effect/Schema"; |
| 3 | |
| 4 | import { SECOND_HOME, startSecondServer } from "./second-server.ts"; |
| 5 | import { makeState, runPromise, test, WEB } from "./t3.ts"; |
| 6 | |
| 7 | const decodePairing = Schema.decodeEffect( |
| 8 | Schema.fromJsonString(Schema.Struct({ credential: Schema.String })), |
| 9 | ); |
| 10 | |
| 11 | test( |
| 12 | "Removing a connection clears its permission update notice", |
| 13 | WEB, |
| 14 | async ({ t3, app, screen }) => { |
| 15 | await t3.project("demo"); |
| 16 | const server = startSecondServer(app.baseUrl ?? ""); |
| 17 | try { |
| 18 | const { host } = await server.ready; |
| 19 | const { cli } = makeState(SECOND_HOME); |
| 20 | const issued = await runPromise( |
| 21 | cli(["auth", "pairing", "create", "--scope", "orchestration:read", "--json"]), |
| 22 | ); |
| 23 | const { credential } = await runPromise(decodePairing(issued.stdout)); |
| 24 | |
| 25 | await t3.open("/settings/connections"); |
| 26 | await screen.getByRole("button", "Add environment").tap(); |
| 27 | const dialog = screen.getByRole("dialog"); |
| 28 | await dialog.getByPlaceholder("backend.example.com").fill(host); |
| 29 | await dialog.getByPlaceholder("PAIRCODE").fill(credential); |
| 30 | await dialog.getByRole("button", "Add environment").tap(); |
| 31 | |
| 32 | const notice = screen.getByText("Permissions have changed for Scenario", { exact: true }); |
| 33 | await notice.waitFor({ timeout: 60_000 }); |
| 34 | const actions = screen.getByRole("button", "More actions for Scenario"); |
| 35 | await actions.press("Enter"); |
| 36 | await screen.getByRole("menuitem", "Remove from this device…").press("Enter"); |
| 37 | await screen.getByRole("button", "Confirm").press("Enter"); |
| 38 | await actions.waitFor({ state: "hidden" }); |
| 39 | |
| 40 | await app.screenshot("after-removing-connection"); |
| 41 | await expect(notice).toBeHidden(); |
| 42 | } finally { |
| 43 | await server.stop(); |
| 44 | } |
| 45 | }, |
| 46 | ); |