web-remote-unread-scenario.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. import { mkdir, writeFile } from "node:fs/promises";
  2. import { join } from "node:path";
  3. import { chromium, type Browser, type BrowserContext, type Page } from "playwright-core";
  4. import { ServiceChannels, parseRemoteWorkspaceIdentity } from "@zcode/shared";
  5. import {
  6. TID_TASK_ITEM,
  7. TID_TASK_NEW_BUTTON,
  8. TID_V4_COMPOSER_INPUT,
  9. TID_V4_COMPOSER_SEND,
  10. TID_V4_STOP,
  11. testId,
  12. } from "@zcode/shared/test-ids";
  13. import type { ProjectTask, ProjectTree } from "@zcode/services";
  14. import { clearAppData } from "#e2e/helpers/desktop-app";
  15. import { releaseControlledReplay } from "#e2e/helpers/controlled-replay";
  16. import { openMobilePairingPage, redactMobileDiagnosticText } from "#e2e/helpers/mobile-pairing";
  17. import {
  18. callHandoffHost,
  19. installHandoffRpcProbe,
  20. restoreHandoffProbes,
  21. } from "#e2e/helpers/remote-project-handoff-probe";
  22. import {
  23. connectSSHWorkspaceAndSendFirstTurn,
  24. createSSHLifecycleProvider,
  25. type SSHLifecycleProvider,
  26. } from "#e2e/helpers/ssh-remote-lifecycle";
  27. import {
  28. prepareSSHConnectionPage,
  29. readRemoteTabSnapshot,
  30. readSSHRuntimeConfig,
  31. } from "#e2e/helpers/ssh-remote-p0";
  32. import {
  33. ensureUpstreamProviderForE2E,
  34. selectUpstreamModel,
  35. selectUpstreamThoughtLevelValue,
  36. } from "#e2e/helpers/upstream-provider";
  37. import {
  38. getV4ConversationState,
  39. selectV4TaskById,
  40. sendV4Prompt,
  41. startNewV4Draft,
  42. waitForV4AssistantMessageContaining,
  43. waitForV4ConversationState,
  44. } from "#e2e/helpers/v4-conversation";
  45. import { WEB_REMOTE_CONTROL_FIXTURE_CREDENTIALS } from "#e2e/helpers/web-remote-control-session-events-fixture";
  46. import {
  47. obtainUnreadPairingUrl,
  48. readMobileTaskView,
  49. replayStaleBootstrapAfterReconnect,
  50. showMobileTaskHome,
  51. waitMobileTaskView,
  52. type UnreadTaskAddress,
  53. } from "#e2e/helpers/web-remote-unread";
  54. import { createWebRemoteVisibilityBrowser } from "#e2e/helpers/web-remote-visibility-browser";
  55. // 共用原有操作和断言;每个 spec 独立持有测试状态,本地入口不申请 SSH 环境。
  56. export function createMobileUnreadScenario() {
  57. const CASE = "E2E_MRO03";
  58. const artifacts = process.env.ZCODE_E2E_ARTIFACT_DIR;
  59. const evidence: Record<string, unknown> = {};
  60. async function readTask(address: UnreadTaskAddress): Promise<ProjectTask> {
  61. const identity = address.workspaceIdentity
  62. ? parseRemoteWorkspaceIdentity(address.workspaceIdentity)
  63. : null;
  64. const tree = await callHandoffHost<ProjectTree>(ServiceChannels.Project, "readTree", [
  65. identity?.kind === "server" ? { hostId: `remote:server:${identity.sourceServerId}` } : {},
  66. ]);
  67. const task = tree.tasks.find(
  68. (item) =>
  69. item.taskId === address.taskId &&
  70. (item.workspaceIdentity || item.workspacePath) ===
  71. (address.workspaceIdentity || address.workspacePath),
  72. );
  73. if (!task) throw new Error(`MRO03 task not in persisted project tree: ${address.taskId}`);
  74. return task;
  75. }
  76. async function waitMarker(address: UnreadTaskAddress, unread: boolean) {
  77. let task: ProjectTask | undefined;
  78. await browser.waitUntil(
  79. async () => {
  80. task = await readTask(address);
  81. return (typeof task.unreadAt === "number") === unread;
  82. },
  83. {
  84. timeout: 30_000,
  85. interval: 100,
  86. timeoutMsg: `MRO03 persisted unread must be ${unread}: ${address.taskId}`,
  87. },
  88. );
  89. const row = $(`[data-testid=${JSON.stringify(testId(TID_TASK_ITEM, address.taskId))}]`);
  90. await row.waitForExist({ timeout: 30_000 });
  91. await browser.waitUntil(
  92. async () => (await row.$('[data-unread-indicator="true"]').isExisting()) === unread,
  93. { timeout: 30_000, interval: 100, timeoutMsg: "MRO03 sidebar marker differs from Host" },
  94. );
  95. return task?.unreadAt ?? null;
  96. }
  97. async function openWebTask(page: Page, address: UnreadTaskAddress) {
  98. await showMobileTaskHome(page);
  99. const toggles = page.getByTestId("virtual-project-toggle");
  100. for (const toggle of await toggles.all()) {
  101. if ((await toggle.getAttribute("aria-expanded")) !== "true") await toggle.click();
  102. }
  103. await page.getByTestId(testId(TID_TASK_ITEM, address.taskId)).first().click();
  104. await page.locator(`[data-session-id=${JSON.stringify(address.taskId)}]`).waitFor();
  105. await waitMobileTaskView(address);
  106. }
  107. async function sendWeb(page: Page, marker: string) {
  108. const input = page.getByTestId(TID_V4_COMPOSER_INPUT).first();
  109. await input.click();
  110. await page.keyboard.type(`${marker}: 只回复受控回放内容。`);
  111. const send = page.getByTestId(TID_V4_COMPOSER_SEND).first();
  112. await send.click();
  113. await page
  114. .getByText(marker.replace("E2E_", "") + "_STREAMING", { exact: false })
  115. .first()
  116. .waitFor({ timeout: 90_000 });
  117. }
  118. async function beginDesktopTurn(address: UnreadTaskAddress, marker: string) {
  119. await selectV4TaskById(address.taskId, 30_000);
  120. await sendV4Prompt(`${marker}: 只回复受控回放内容。`);
  121. await waitForV4AssistantMessageContaining(marker.replace("E2E_", "") + "_STREAMING", 90_000);
  122. await startNewV4Draft();
  123. expect((await getV4ConversationState()).taskId).not.toBe(address.taskId);
  124. }
  125. async function completeViewed(
  126. page: Page,
  127. address: UnreadTaskAddress,
  128. gate: string,
  129. response: string,
  130. ) {
  131. await waitMobileTaskView(address);
  132. await releaseControlledReplay(gate);
  133. await page.getByText(response, { exact: false }).first().waitFor({ timeout: 90_000 });
  134. await page.getByTestId(TID_V4_STOP).waitFor({ state: "hidden", timeout: 60_000 });
  135. const row = $(`[data-testid=${JSON.stringify(testId(TID_TASK_ITEM, address.taskId))}]`);
  136. await browser.waitUntil(async () => !(await row.$(".animate-spin").isExisting()), {
  137. timeout: 60_000,
  138. interval: 100,
  139. });
  140. expect((await readTask(address)).unreadAt).toBeUndefined();
  141. await waitMarker(address, false);
  142. }
  143. let webBrowser: Browser | undefined;
  144. let context: BrowserContext | undefined;
  145. let page: Page | undefined;
  146. let pairingUrl = "";
  147. let provider: SSHLifecycleProvider | undefined;
  148. let backgroundAddress: UnreadTaskAddress | undefined;
  149. let bootstrapReplay: Awaited<ReturnType<typeof replayStaleBootstrapAfterReconnect>> | undefined;
  150. const newPage = async (phase: string) => {
  151. if (!context || !artifacts) throw new Error("MRO03 isolated browser context required");
  152. page = await context.newPage();
  153. await openMobilePairingPage(page, pairingUrl, {
  154. artifactDir: artifacts,
  155. caseMarker: CASE,
  156. phase,
  157. readySelector: '[data-testid="sidebar"], [data-mobile-page="chat"]',
  158. });
  159. return page;
  160. };
  161. const newContext = async (width: number, phase: string, staleBootstrap = false) => {
  162. await context?.close();
  163. context = await webBrowser!.newContext({
  164. viewport: { width, height: 900 },
  165. isMobile: width < 768,
  166. hasTouch: width < 768,
  167. locale: "zh-CN",
  168. });
  169. if (staleBootstrap) {
  170. bootstrapReplay = await replayStaleBootstrapAfterReconnect(context);
  171. evidence[`${width}-bootstrap`] = bootstrapReplay;
  172. }
  173. await context.addInitScript((credentials) => {
  174. if (sessionStorage.getItem("mro03-seeded")) return;
  175. sessionStorage.setItem("mro03-seeded", "1");
  176. for (const [key, value] of Object.entries(credentials)) localStorage.setItem(key, value);
  177. }, WEB_REMOTE_CONTROL_FIXTURE_CREDENTIALS);
  178. return newPage(phase);
  179. };
  180. const cleanup = async () => {
  181. if (artifacts) {
  182. await mkdir(artifacts, { recursive: true });
  183. await page
  184. ?.screenshot({ path: join(artifacts, "MRO03-last-page.png") })
  185. .catch(() => undefined);
  186. evidence.finalView = await readMobileTaskView().catch(() => null);
  187. await writeFile(join(artifacts, "MRO03-unread.json"), JSON.stringify(evidence, null, 2));
  188. }
  189. await context?.close();
  190. await webBrowser?.close();
  191. await provider?.tunnel.close();
  192. await restoreHandoffProbes();
  193. await clearAppData();
  194. };
  195. const local = async function (this: Mocha.Context) {
  196. this.timeout(15 * 60_000);
  197. if (!artifacts || !process.env.ZCODE_E2E_HOME_DIR)
  198. throw new Error("MRO03 isolated runner required");
  199. await prepareSSHConnectionPage(CASE);
  200. await ensureUpstreamProviderForE2E({ skipToolbarSelection: true });
  201. await startNewV4Draft();
  202. // 回放种子声明 high/max;未读断言不依赖档位,显式选目录中的 high。
  203. await selectUpstreamModel();
  204. await selectUpstreamThoughtLevelValue("high");
  205. await installHandoffRpcProbe();
  206. webBrowser = await chromium.launch({
  207. ...(process.env.ZCODE_E2E_MOBILE_BROWSER_EXECUTABLE || process.env.R3_MOBILE_CHROME
  208. ? {
  209. executablePath:
  210. process.env.ZCODE_E2E_MOBILE_BROWSER_EXECUTABLE || process.env.R3_MOBILE_CHROME,
  211. }
  212. : { channel: "chrome" }),
  213. headless: true,
  214. });
  215. for (const width of [1440, 390]) {
  216. if (width === 390) {
  217. await startNewV4Draft();
  218. await selectUpstreamModel();
  219. await selectUpstreamThoughtLevelValue("high");
  220. }
  221. await sendV4Prompt(`${CASE}_SEED: 只回复 MRO03_SEED_DONE`);
  222. await waitForV4AssistantMessageContaining("MRO03_SEED_DONE", 90_000);
  223. await waitForV4ConversationState(
  224. (state) => state.state === "idle" && Boolean(state.taskId),
  225. "MRO03 seed incomplete",
  226. 90_000,
  227. );
  228. const state = await getV4ConversationState();
  229. const tab = await readRemoteTabSnapshot();
  230. const address: UnreadTaskAddress = {
  231. taskId: state.taskId!,
  232. workspacePath: tab.activeWorkspacePath!,
  233. ...(tab.activeWorkspaceIdentity ? { workspaceIdentity: tab.activeWorkspaceIdentity } : {}),
  234. };
  235. backgroundAddress = address;
  236. if (!pairingUrl) pairingUrl = await obtainUnreadPairingUrl();
  237. page = await newContext(width, `local-${width}`, true);
  238. await openWebTask(page, address);
  239. expect(bootstrapReplay).toMatchObject({
  240. replayed: true,
  241. epochChanged: true,
  242. staleReports: 0,
  243. });
  244. expect(bootstrapReplay!.droppedRequests).toBeGreaterThan(0);
  245. await beginDesktopTurn(address, `${CASE}_VISIBLE`);
  246. await completeViewed(page, address, "mro03-visible", "MRO03_VISIBLE_DONE");
  247. evidence[`${width}-visible`] = {
  248. address,
  249. marker: await waitMarker(address, false),
  250. view: await readMobileTaskView(),
  251. };
  252. if (width === 390) {
  253. // 桌面手动未读是用户提醒;Web 持续查看同一任务时,断点变化不能伪造离开和返回。
  254. const row = $(`[data-testid=${JSON.stringify(testId(TID_TASK_ITEM, address.taskId))}]`);
  255. await row.click({ button: "right" });
  256. let marked = false;
  257. for (const item of await $$('[role="menuitem"]')) {
  258. if (!/^(标记为未读|Mark as unread)$/u.test((await item.getText()).trim())) continue;
  259. await item.click();
  260. marked = true;
  261. break;
  262. }
  263. if (!marked) throw new Error("MRO03 mark-unread menu missing");
  264. const manualMarker = await waitMarker(address, true);
  265. for (const nextWidth of [1024, 390]) {
  266. await page.setViewportSize({ width: nextWidth, height: 900 });
  267. await page.locator(`[data-session-id=${JSON.stringify(address.taskId)}]`).waitFor();
  268. await page.waitForFunction(
  269. (narrow) => Boolean(document.querySelector('[data-mobile-page="chat"]')) === narrow,
  270. nextWidth < 768,
  271. );
  272. // 对持久 marker 做有界稳定性断言,捕获 resize 后异步到达的错误已读命令。
  273. const start = Date.now();
  274. await browser.waitUntil(
  275. async () => {
  276. expect((await readTask(address)).unreadAt).toBe(manualMarker);
  277. expect((await readMobileTaskView()).view?.taskId).toBe(address.taskId);
  278. return Date.now() - start >= 1_000;
  279. },
  280. { timeout: 5_000, interval: 100, timeoutMsg: "MRO03 resize cleared manual unread" },
  281. );
  282. await waitMarker(address, true);
  283. }
  284. await showMobileTaskHome(page);
  285. await waitMobileTaskView(null);
  286. await openWebTask(page, address);
  287. await waitMarker(address, false);
  288. evidence.resize = { manualMarker, retainedAcrossBreakpoint: true, clearedAfterHome: true };
  289. }
  290. await beginDesktopTurn(address, `${CASE}_HOME`);
  291. // 远控已隐藏插件市场;宽屏以空草稿离开原任务,仍以实际查看上报而非聊天 DOM 判定。
  292. if (width < 768) await showMobileTaskHome(page);
  293. else {
  294. await page.getByTestId(TID_TASK_NEW_BUTTON).first().click();
  295. await page.locator('[data-session-id="draft"]').waitFor();
  296. }
  297. await waitMobileTaskView(null);
  298. await releaseControlledReplay("mro03-home");
  299. const homeMarker = await waitMarker(address, true);
  300. await openWebTask(page, address);
  301. await waitMarker(address, false);
  302. evidence[`${width}-home`] = { marker: homeMarker, cleared: true };
  303. await beginDesktopTurn(address, `${CASE}_RECONNECT`);
  304. // 离开原页会真正关闭relay;返回保留该条浏览器history,不点击任务来代替自动已读。
  305. await page.goto("about:blank");
  306. await waitMobileTaskView(null);
  307. await releaseControlledReplay("mro03-reconnect");
  308. const disconnectedMarker = await waitMarker(address, true);
  309. await page.goBack({ waitUntil: "domcontentloaded" });
  310. await page
  311. .locator(`[data-session-id=${JSON.stringify(address.taskId)}]`)
  312. .waitFor({ timeout: 60_000 });
  313. await waitMobileTaskView(address);
  314. await waitMarker(address, false);
  315. evidence[`${width}-reconnect`] = { marker: disconnectedMarker, cleared: true };
  316. await showMobileTaskHome(page);
  317. await page.getByTestId(TID_TASK_NEW_BUTTON).first().click();
  318. await page.locator('[data-session-id="draft"]').waitFor();
  319. await waitMobileTaskView(null);
  320. await sendWeb(page, `${CASE}_PROMOTION`);
  321. const promotedId = await page
  322. .locator('[data-session-id]:not([data-session-id="draft"])')
  323. .first()
  324. .getAttribute("data-session-id");
  325. if (!promotedId) throw new Error("MRO03 Web draft did not become a task");
  326. // 新未归类草稿可由Host分配新目录,不能复用上一个任务的cwd冒充完整身份。
  327. const promoted: UnreadTaskAddress = await page.evaluate((taskId) => {
  328. const tabs = (
  329. window as Window & {
  330. __zcodeTabStoreE2E?: {
  331. getState(): {
  332. activeWorkspacePath: string | null;
  333. activeWorkspaceIdentity?: string | null;
  334. };
  335. };
  336. }
  337. ).__zcodeTabStoreE2E?.getState();
  338. if (!tabs?.activeWorkspacePath) throw new Error("MRO03 promoted workspace missing");
  339. return {
  340. taskId,
  341. workspacePath: tabs.activeWorkspacePath,
  342. ...(tabs.activeWorkspaceIdentity
  343. ? { workspaceIdentity: tabs.activeWorkspaceIdentity }
  344. : {}),
  345. };
  346. }, promotedId);
  347. await completeViewed(page, promoted, "mro03-promotion", "MRO03_PROMOTION_DONE");
  348. evidence[`${width}-promotion`] = {
  349. address: promoted,
  350. marker: await waitMarker(promoted, false),
  351. };
  352. await page.screenshot({ path: join(artifacts, `MRO03-local-${width}.png`) });
  353. await context!.close();
  354. context = undefined;
  355. page = undefined;
  356. }
  357. };
  358. const background = async function (this: Mocha.Context) {
  359. this.timeout(5 * 60_000);
  360. if (!artifacts) throw new Error("MRO03 isolated artifacts required");
  361. if (!backgroundAddress) {
  362. // 允许用现有mocha grep单独定位真实可见性场景,仍通过UI建立自己的任务前置。
  363. await prepareSSHConnectionPage(CASE);
  364. await ensureUpstreamProviderForE2E({ skipToolbarSelection: true });
  365. await startNewV4Draft();
  366. await selectUpstreamModel();
  367. await selectUpstreamThoughtLevelValue("high");
  368. await installHandoffRpcProbe();
  369. await sendV4Prompt(`${CASE}_SEED: 只回复 MRO03_SEED_DONE`);
  370. await waitForV4AssistantMessageContaining("MRO03_SEED_DONE", 90_000);
  371. await waitForV4ConversationState(
  372. (state) => state.state === "idle" && Boolean(state.taskId),
  373. "MRO03 background seed incomplete",
  374. 90_000,
  375. );
  376. const state = await getV4ConversationState();
  377. const tab = await readRemoteTabSnapshot();
  378. backgroundAddress = { taskId: state.taskId!, workspacePath: tab.activeWorkspacePath! };
  379. pairingUrl = await obtainUnreadPairingUrl();
  380. }
  381. await context?.close();
  382. context = undefined;
  383. page = undefined;
  384. const address = backgroundAddress;
  385. const native = await createWebRemoteVisibilityBrowser(artifacts);
  386. try {
  387. await native.navigate(pairingUrl, WEB_REMOTE_CONTROL_FIXTURE_CREDENTIALS);
  388. await browser.waitUntil(
  389. () =>
  390. native.evaluate<boolean>(
  391. 'Boolean(document.querySelector(\'[data-testid="sidebar"], [data-testid="onboarding-page"], [data-mobile-page="chat"]\'))',
  392. ),
  393. { timeout: 60_000 },
  394. );
  395. if (
  396. await native.evaluate<boolean>(
  397. "Boolean(document.querySelector('[data-testid=\"onboarding-page\"]'))",
  398. )
  399. )
  400. await native.escape();
  401. const homeButton =
  402. 'button[aria-label="返回任务首页"], button[aria-label="Back to task home"]';
  403. if (
  404. await native.evaluate<boolean>(
  405. `Boolean(document.querySelector(${JSON.stringify(homeButton)}))`,
  406. )
  407. )
  408. await native.click(homeButton);
  409. const row = `[data-testid=${JSON.stringify(testId(TID_TASK_ITEM, address.taskId))}]`;
  410. await browser.waitUntil(
  411. () => native.evaluate<boolean>(`Boolean(document.querySelector(${JSON.stringify(row)}))`),
  412. { timeout: 60_000 },
  413. );
  414. await native.click(row);
  415. await waitMobileTaskView(address);
  416. await beginDesktopTurn(address, `${CASE}_BACKGROUND`);
  417. await native.hide();
  418. await browser.waitUntil(
  419. async () => (await native.evaluate<string>("document.visibilityState")) === "hidden",
  420. { timeout: 15_000 },
  421. );
  422. await waitMobileTaskView(null);
  423. evidence.backgroundHidden = {
  424. visibility: await native.evaluate("document.visibilityState"),
  425. view: await readMobileTaskView(),
  426. };
  427. await releaseControlledReplay("mro03-background");
  428. const marker = await waitMarker(address, true);
  429. await native.show();
  430. await browser.waitUntil(
  431. async () => (await native.evaluate<string>("document.visibilityState")) === "visible",
  432. { timeout: 15_000 },
  433. );
  434. await waitMobileTaskView(address);
  435. await waitMarker(address, false);
  436. evidence.backgroundVisible = {
  437. marker,
  438. cleared: true,
  439. visibility: await native.evaluate("document.visibilityState"),
  440. view: await readMobileTaskView(),
  441. };
  442. await native.screenshot("MRO03-foreground-return.png");
  443. } catch (error) {
  444. const text = await native
  445. .evaluate<string>("document.body?.innerText ?? ''")
  446. .catch(() => "unavailable");
  447. evidence.backgroundFailure = {
  448. text: redactMobileDiagnosticText(text, pairingUrl),
  449. view: await readMobileTaskView(),
  450. };
  451. await native.screenshot("MRO03-background-failure.png").catch(() => undefined);
  452. throw error;
  453. } finally {
  454. await native.close();
  455. }
  456. };
  457. const ssh = async function (this: Mocha.Context) {
  458. if (!artifacts) throw new Error("MRO03 isolated artifacts required");
  459. await prepareSSHConnectionPage(CASE);
  460. await installHandoffRpcProbe();
  461. this.timeout(15 * 60_000);
  462. const config = readSSHRuntimeConfig(`${CASE}_SSH`);
  463. provider = await createSSHLifecycleProvider(config, `${CASE}_SSH`, {
  464. apiType: "anthropic-messages",
  465. });
  466. const task = await connectSSHWorkspaceAndSendFirstTurn({
  467. caseMarker: `${CASE}_SSH`,
  468. config,
  469. provider,
  470. label: "A",
  471. workspacePath: config.workspacePaths[0],
  472. });
  473. const address: UnreadTaskAddress = {
  474. taskId: task.taskId,
  475. workspacePath: task.workspacePath,
  476. workspaceIdentity: task.identity,
  477. remoteSessionId: task.remoteSessionId,
  478. };
  479. webBrowser = await chromium.launch({
  480. ...(process.env.ZCODE_E2E_MOBILE_BROWSER_EXECUTABLE || process.env.R3_MOBILE_CHROME
  481. ? {
  482. executablePath:
  483. process.env.ZCODE_E2E_MOBILE_BROWSER_EXECUTABLE || process.env.R3_MOBILE_CHROME,
  484. }
  485. : { channel: "chrome" }),
  486. headless: true,
  487. });
  488. pairingUrl = await obtainUnreadPairingUrl();
  489. page = await newContext(390, "ssh");
  490. await openWebTask(page, address);
  491. await beginDesktopTurn(address, `${CASE}_SSH_VISIBLE`);
  492. await completeViewed(page, address, "mro03-ssh-visible", "MRO03_SSH_VISIBLE_DONE");
  493. await beginDesktopTurn(address, `${CASE}_SSH_HOME`);
  494. await showMobileTaskHome(page);
  495. await waitMobileTaskView(null);
  496. await releaseControlledReplay("mro03-ssh-home");
  497. const marker = await waitMarker(address, true);
  498. await openWebTask(page, address);
  499. await waitMarker(address, false);
  500. evidence.ssh = { address, marker, cleared: true, view: await readMobileTaskView() };
  501. await page.screenshot({ path: join(artifacts!, "MRO03-ssh.png") });
  502. };
  503. return { cleanup, local, background, ssh };
  504. }