plugin-extension-logs.test.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. // PLM-EXT-P2E:扩展日志控制台(docs/plugins/extension-host.md §16.8、§16.10 第 5 步)。
  2. // 隔离 HOME:两个纯 JS fixture 插件(test/e2e/fixtures/fs/plugins/plugin-extension-logs/)复制到 E2E HOME,
  3. // 经 ~/.zcode/cli/config.json 的 plugins.dirs 加载:
  4. // - e2e-ext-logs:激活时 info / warn / error 各一行、一行超过 4KB 的长日志、console.log 与 console.warn 各一行;
  5. // composer.status 条目执行命令 emit,每次再写三个级别各一行。
  6. // - e2e-ext-logs-peer:激活时写一行,用来验证按插件过滤。
  7. // 运行时证据:日志标签每行的 data-*(seq、level、gen、plugin id)、Main 日志文件、Renderer 的 [extension-slots] 日志。
  8. import { cp, mkdir, readFile, writeFile } from "node:fs/promises";
  9. import { join, resolve } from "node:path";
  10. import {
  11. TID_EXTENSION_LOGS,
  12. TID_EXTENSION_LOGS_CLEAR,
  13. TID_EXTENSION_LOGS_COPY,
  14. TID_EXTENSION_LOGS_LEVEL_FILTER,
  15. TID_EXTENSION_LOGS_ROW,
  16. TID_EXTENSION_LOGS_SOURCE_FILTER,
  17. TID_SIDE_PANE_EXTENSION_LOGS_ITEM,
  18. } from "@zcode/shared/test-ids";
  19. import { DEFAULT_WORKSPACE, clearAppData, getE2EAppDataPaths } from "#e2e/helpers/desktop-app";
  20. import { restartIntoWorkspacePreservingProfile } from "#e2e/helpers/model-provider-restart-runtime";
  21. import {
  22. clickSlot,
  23. createExtensionLog,
  24. openLauncher,
  25. readActiveSidePaneTab,
  26. waitForSlot,
  27. writePluginDirsConfig,
  28. } from "#e2e/helpers/extension-host-views";
  29. import { prepareV4ConversationE2E } from "#e2e/helpers/v4-conversation";
  30. import {
  31. capturePluginManualReview,
  32. requirePluginManualReview,
  33. setPluginPresentation,
  34. } from "#e2e/helpers/plugin-management-lifecycle";
  35. const CASE_ID = "PLM-EXT-P2E";
  36. // WDIO 以 packages/desktop 为 cwd;按 cwd 解析,晋级移动 spec 后路径不变。
  37. const FIXTURE_ROOT = resolve(process.cwd(), "test/e2e/fixtures/fs/plugins/plugin-extension-logs");
  38. const PLUGINS = ["e2e-ext-logs", "e2e-ext-logs-peer"];
  39. const LOGS_PLUGIN = "e2e-ext-logs@inline";
  40. const PEER_PLUGIN = "e2e-ext-logs-peer@inline";
  41. const EMIT_ITEM = `${LOGS_PLUGIN}/emit`;
  42. const LOGS_TAB = "extension-logs";
  43. /** 与协议的 EXTENSION_LOG_MESSAGE_MAX_BYTES、EXTENSION_LOG_TRUNCATED_MARKER 一致。 */
  44. const MESSAGE_MAX_BYTES = 4096;
  45. const TRUNCATED_MARKER = "…[truncated]";
  46. const evidence: Record<string, unknown> = {};
  47. const log = createExtensionLog();
  48. interface LogRow {
  49. seq: number;
  50. level: string;
  51. gen: number;
  52. pluginId: string | null;
  53. message: string;
  54. }
  55. function fixtureHome(): string {
  56. return join(getE2EAppDataPaths().homeDir, "fixtures", "extension-logs");
  57. }
  58. async function seedFixtures(): Promise<void> {
  59. const target = fixtureHome();
  60. await mkdir(target, { recursive: true });
  61. for (const name of PLUGINS) {
  62. await cp(join(FIXTURE_ROOT, name), join(target, name), { recursive: true, force: true });
  63. }
  64. await writePluginDirsConfig(
  65. PLUGINS.map((name) => join(target, name)),
  66. PLUGINS.map((name) => `${name}@inline`),
  67. );
  68. }
  69. async function readExtensionPid(): Promise<number> {
  70. const state = JSON.parse(
  71. await readFile(join(fixtureHome(), "e2e-ext-logs-state.json"), "utf8"),
  72. ) as { pid: number };
  73. return state.pid;
  74. }
  75. /** 日志标签当前显示的行(已按来源与级别过滤)。 */
  76. async function readRows(): Promise<LogRow[]> {
  77. return browser.execute(
  78. (paneTestId, rowTestId) =>
  79. Array.from(
  80. document.querySelectorAll<HTMLElement>(
  81. `[data-testid="${paneTestId}"] [data-testid="${rowTestId}"]`,
  82. ),
  83. ).map((row) => ({
  84. seq: Number(row.dataset.seq),
  85. level: row.dataset.level ?? "",
  86. gen: Number(row.dataset.gen),
  87. pluginId: row.dataset.pluginId ?? null,
  88. // 最后一列是消息本身。
  89. message: row.lastElementChild?.textContent ?? "",
  90. })),
  91. TID_EXTENSION_LOGS,
  92. TID_EXTENSION_LOGS_ROW,
  93. );
  94. }
  95. async function waitForRows(
  96. predicate: (rows: LogRow[]) => boolean,
  97. message: string,
  98. timeout = 30000,
  99. ): Promise<LogRow[]> {
  100. let latest: LogRow[] = [];
  101. try {
  102. await browser.waitUntil(
  103. async () => {
  104. latest = await readRows();
  105. return predicate(latest);
  106. },
  107. { timeout, interval: 300 },
  108. );
  109. } catch {
  110. throw new Error(
  111. `${message}: ${JSON.stringify(latest.map((row) => ({ ...row, message: row.message.slice(0, 120) })))}`,
  112. );
  113. }
  114. return latest;
  115. }
  116. const hasRow = (rows: LogRow[], match: (row: LogRow) => boolean) => rows.some(match);
  117. const byMessage = (text: string, extra: (row: LogRow) => boolean = () => true) => {
  118. return (row: LogRow) => row.message.includes(text) && extra(row);
  119. };
  120. async function waitForActiveLogsTab(): Promise<void> {
  121. await browser.waitUntil(async () => (await readActiveSidePaneTab()) === LOGS_TAB, {
  122. timeout: 15000,
  123. timeoutMsg: "the extension-logs tab should be active",
  124. });
  125. await $(`[data-testid="${TID_EXTENSION_LOGS}"][data-loaded="true"]`).waitForDisplayed({
  126. timeout: 15000,
  127. });
  128. }
  129. async function openLogsFromLauncher(): Promise<void> {
  130. await openLauncher();
  131. await browser.waitUntil(
  132. async () =>
  133. browser.execute((rowTestId) => {
  134. const row = document.querySelector<HTMLElement>(`[data-testid="${rowTestId}"]`);
  135. if (!row || row.getBoundingClientRect().width === 0) return false;
  136. row.scrollIntoView({ block: "center" });
  137. row.click();
  138. return true;
  139. }, TID_SIDE_PANE_EXTENSION_LOGS_ITEM),
  140. { timeout: 30000, interval: 500, timeoutMsg: "launcher should list 扩展日志" },
  141. );
  142. await waitForActiveLogsTab();
  143. }
  144. async function openLogsFromCommandCenter(): Promise<void> {
  145. await $('[data-testid="sidebar-search-open"]').click();
  146. const input = $('[role="dialog"] [cmdk-input]');
  147. await input.waitForDisplayed({ timeout: 10000 });
  148. await input.setValue(">打开扩展日志");
  149. await browser.waitUntil(
  150. async () =>
  151. browser.execute(() => {
  152. const item = Array.from(
  153. document.querySelectorAll<HTMLElement>('[role="dialog"] [cmdk-item]'),
  154. ).find((element) => /打开扩展日志|Open extension logs/.test(element.textContent ?? ""));
  155. if (!item) return false;
  156. item.click();
  157. return true;
  158. }),
  159. { timeout: 10000, timeoutMsg: "command center should list 打开扩展日志" },
  160. );
  161. await waitForActiveLogsTab();
  162. }
  163. async function closeLogsTab(): Promise<void> {
  164. await browser.execute((tabId) => {
  165. document
  166. .querySelector<HTMLElement>(`[data-side-pane-tab-id="${tabId}"] button[aria-label]`)
  167. ?.click();
  168. }, LOGS_TAB);
  169. await browser.waitUntil(
  170. async () =>
  171. browser.execute(
  172. (tabId) => !document.querySelector(`[data-side-pane-tab-id="${tabId}"]`),
  173. LOGS_TAB,
  174. ),
  175. { timeout: 10000, timeoutMsg: "the extension-logs tab should close" },
  176. );
  177. }
  178. /** Radix Select 靠真实指针事件开合:用 WDIO 点击触发器与选项。 */
  179. async function selectFilter(triggerTestId: string, optionText: string): Promise<void> {
  180. await $(`[data-testid="${triggerTestId}"]`).click();
  181. const option = await browser.waitUntil(
  182. async () => {
  183. for (const candidate of await $$('[role="option"]')) {
  184. if ((await candidate.getText()).trim() === optionText) return candidate;
  185. }
  186. return false;
  187. },
  188. { timeout: 10000, timeoutMsg: `filter option ${optionText} should be listed` },
  189. );
  190. await option.click();
  191. await browser.waitUntil(async () => (await $$('[role="option"]').length) === 0, {
  192. timeout: 5000,
  193. timeoutMsg: "the filter menu should close",
  194. });
  195. }
  196. async function readFilterLabel(triggerTestId: string): Promise<string> {
  197. return (await $(`[data-testid="${triggerTestId}"]`).getText()).trim();
  198. }
  199. function utf8Length(text: string): number {
  200. return Buffer.byteLength(text, "utf8");
  201. }
  202. describe("PLM-EXT-P2E 扩展日志控制台", () => {
  203. after(async () => {
  204. await writeFile(
  205. join(process.env.ZCODE_E2E_ARTIFACT_DIR ?? process.cwd(), "plm-ext-p2e-evidence.json"),
  206. JSON.stringify(evidence, null, 2),
  207. ).catch(() => undefined);
  208. await clearAppData();
  209. });
  210. it("实时日志、按插件与级别过滤、清空、复制、扩展进程崩溃后旧日志保留", async function () {
  211. this.timeout(300000);
  212. requirePluginManualReview();
  213. await seedFixtures();
  214. await restartIntoWorkspacePreservingProfile(DEFAULT_WORKSPACE, {
  215. afterElectronProcessExit: () => log.mark(),
  216. });
  217. await prepareV4ConversationE2E();
  218. await setPluginPresentation({ locale: "zh-CN", theme: "zai-light", width: 1400, height: 900 });
  219. await waitForSlot(EMIT_ITEM, (slot) => slot.text === "E2E logs", "emit slot should render");
  220. // (a) 启动页「扩展」分区的「扩展日志」一行打开 extension-logs 标签。
  221. await openLauncher();
  222. await browser.execute((rowTestId) => {
  223. document.querySelector(`[data-testid="${rowTestId}"]`)?.scrollIntoView({ block: "center" });
  224. }, TID_SIDE_PANE_EXTENSION_LOGS_ITEM);
  225. const screenshots: string[] = [
  226. await capturePluginManualReview(CASE_ID, "launcher-zh-CN-zai-light"),
  227. ];
  228. await openLogsFromLauncher();
  229. // (b) 激活时的三行带插件归因与级别;console.* 同样归因;第二个插件与监管器生命周期行都在。
  230. const initial = await waitForRows(
  231. (rows) =>
  232. hasRow(
  233. rows,
  234. byMessage("E2E_LOGS_ACTIVATE_INFO", (row) => row.level === "info"),
  235. ) &&
  236. hasRow(
  237. rows,
  238. byMessage("E2E_LOGS_ACTIVATE_WARN", (row) => row.level === "warn"),
  239. ) &&
  240. hasRow(
  241. rows,
  242. byMessage("E2E_LOGS_ACTIVATE_ERROR", (row) => row.level === "error"),
  243. ) &&
  244. hasRow(rows, byMessage("E2E_LOGS_PEER_INFO")) &&
  245. hasRow(rows, byMessage("E2E_LOGS_STDOUT")) &&
  246. hasRow(rows, byMessage("E2E_LOGS_CONSOLE_WARN")) &&
  247. hasRow(
  248. rows,
  249. byMessage("status=running", (row) => row.pluginId === null),
  250. ),
  251. "activation logs should appear in the log tab",
  252. );
  253. evidence.initialRows = initial.length;
  254. for (const marker of ["E2E_LOGS_ACTIVATE_INFO", "E2E_LOGS_ACTIVATE_WARN"]) {
  255. const row = initial.find(byMessage(marker));
  256. expect(row?.pluginId).toBe(LOGS_PLUGIN);
  257. expect(row?.gen).toBe(1);
  258. }
  259. expect(initial.find(byMessage("E2E_LOGS_PEER_INFO"))?.pluginId).toBe(PEER_PLUGIN);
  260. // console.* 在插件上下文里按插件归因,级别按方法映射,不再是没有归属的 [stdout] 行。
  261. const consoleLog = initial.find(byMessage("E2E_LOGS_STDOUT"));
  262. expect(consoleLog?.pluginId).toBe(LOGS_PLUGIN);
  263. expect(consoleLog?.level).toBe("info");
  264. expect(consoleLog?.message.startsWith("[stdout]")).toBe(false);
  265. expect(initial.find(byMessage("E2E_LOGS_CONSOLE_WARN"))?.level).toBe("warn");
  266. expect(initial.find(byMessage("E2E_LOGS_CONSOLE_WARN"))?.pluginId).toBe(LOGS_PLUGIN);
  267. // seq 严格递增:快照与追加合起来没有重复。
  268. expect(initial.every((row, index) => index === 0 || row.seq > initial[index - 1]!.seq)).toBe(
  269. true,
  270. );
  271. // 超过 4KB 的行在缓冲里截断,日志文件照写完整内容。
  272. const longRow = initial.find(byMessage("E2E_LOGS_LONG"));
  273. evidence.longRowBytes = longRow ? utf8Length(longRow.message) : null;
  274. expect(longRow?.message.endsWith(TRUNCATED_MARKER)).toBe(true);
  275. expect(utf8Length(longRow?.message ?? "")).toBeLessThanOrEqual(MESSAGE_MAX_BYTES);
  276. const longFileLine = await log.waitFor(
  277. (line) => line.includes(`[${LOGS_PLUGIN}] E2E_LOGS_LONG`),
  278. "the log file should keep the long line",
  279. );
  280. evidence.longFileLineLength = longFileLine.length;
  281. expect(longFileLine.includes("x".repeat(6000))).toBe(true);
  282. // (c) 实时追加:执行命令后三行出现,不用重开标签。
  283. await clickSlot(EMIT_ITEM);
  284. const afterRun1 = await waitForRows(
  285. (rows) =>
  286. ["INFO", "WARN", "ERROR"].every((level) =>
  287. hasRow(
  288. rows,
  289. byMessage(`E2E_LOGS_COMMAND_${level} run=1`, (row) => row.pluginId === LOGS_PLUGIN),
  290. ),
  291. ),
  292. "command logs should arrive live",
  293. );
  294. expect(
  295. afterRun1.every((row, index) => index === 0 || row.seq > afterRun1[index - 1]!.seq),
  296. ).toBe(true);
  297. // (d) 按插件过滤。
  298. await selectFilter(TID_EXTENSION_LOGS_SOURCE_FILTER, LOGS_PLUGIN);
  299. const pluginRows = await waitForRows(
  300. (rows) => rows.length > 0 && rows.every((row) => row.pluginId === LOGS_PLUGIN),
  301. "plugin filter should keep only e2e-ext-logs rows",
  302. );
  303. evidence.pluginFilterRows = pluginRows.length;
  304. await selectFilter(TID_EXTENSION_LOGS_SOURCE_FILTER, PEER_PLUGIN);
  305. await waitForRows(
  306. (rows) =>
  307. rows.length > 0 &&
  308. rows.every((row) => row.pluginId === PEER_PLUGIN) &&
  309. hasRow(rows, byMessage("E2E_LOGS_PEER_INFO")),
  310. "plugin filter should keep only peer rows",
  311. );
  312. await selectFilter(TID_EXTENSION_LOGS_SOURCE_FILTER, "扩展进程");
  313. await waitForRows(
  314. (rows) =>
  315. rows.length > 0 &&
  316. rows.every((row) => row.pluginId === null) &&
  317. hasRow(rows, byMessage("status=running")),
  318. "host filter should keep only extension host and supervisor rows",
  319. );
  320. await selectFilter(TID_EXTENSION_LOGS_SOURCE_FILTER, "全部来源");
  321. // (e) 按级别过滤。
  322. await selectFilter(TID_EXTENSION_LOGS_LEVEL_FILTER, "仅错误");
  323. await waitForRows(
  324. (rows) =>
  325. rows.length > 0 &&
  326. rows.every((row) => row.level === "error") &&
  327. hasRow(rows, byMessage("E2E_LOGS_COMMAND_ERROR run=1")),
  328. "error filter should keep only error rows",
  329. );
  330. await selectFilter(TID_EXTENSION_LOGS_LEVEL_FILTER, "警告及以上");
  331. await waitForRows(
  332. (rows) =>
  333. rows.every((row) => row.level === "warn" || row.level === "error") &&
  334. hasRow(rows, byMessage("E2E_LOGS_COMMAND_WARN run=1")),
  335. "warn filter should keep warnings and errors",
  336. );
  337. // 过滤叠加:插件 + 级别。
  338. await selectFilter(TID_EXTENSION_LOGS_SOURCE_FILTER, LOGS_PLUGIN);
  339. await selectFilter(TID_EXTENSION_LOGS_LEVEL_FILTER, "仅错误");
  340. const combined = await waitForRows(
  341. (rows) =>
  342. rows.length > 0 &&
  343. rows.every((row) => row.level === "error" && row.pluginId === LOGS_PLUGIN),
  344. "plugin and level filters should combine",
  345. );
  346. evidence.combinedFilterRows = combined.map((row) => row.message);
  347. await selectFilter(TID_EXTENSION_LOGS_SOURCE_FILTER, "全部来源");
  348. await selectFilter(TID_EXTENSION_LOGS_LEVEL_FILTER, "全部级别");
  349. await waitForRows(
  350. (rows) => hasRow(rows, byMessage("E2E_LOGS_ACTIVATE_INFO")),
  351. "all rows should return after resetting the filters",
  352. );
  353. // (f) 深浅主题 × 中英文截图(全部来源、全部级别)。
  354. for (const [locale, theme] of [
  355. ["zh-CN", "zai-light"],
  356. ["zh-CN", "zai-dark"],
  357. ["en-US", "zai-light"],
  358. ["en-US", "zai-dark"],
  359. ] as const) {
  360. await setPluginPresentation({ locale, theme, width: 1400, height: 900 });
  361. screenshots.push(await capturePluginManualReview(CASE_ID, `logs-${locale}-${theme}`));
  362. }
  363. evidence.filterLabelsEnUS = {
  364. source: await readFilterLabel(TID_EXTENSION_LOGS_SOURCE_FILTER),
  365. level: await readFilterLabel(TID_EXTENSION_LOGS_LEVEL_FILTER),
  366. };
  367. expect(evidence.filterLabelsEnUS).toEqual({ source: "All sources", level: "All levels" });
  368. await setPluginPresentation({ locale: "zh-CN", theme: "zai-light", width: 1400, height: 900 });
  369. // (g) 清空只清视图;之后的新日志照常出现。
  370. const lastSeqBeforeClear = Math.max(...(await readRows()).map((row) => row.seq));
  371. await $(`[data-testid="${TID_EXTENSION_LOGS_CLEAR}"]`).click();
  372. await waitForRows((rows) => rows.length === 0, "clear should empty the view");
  373. await clickSlot(EMIT_ITEM);
  374. const afterClear = await waitForRows(
  375. (rows) => hasRow(rows, byMessage("E2E_LOGS_COMMAND_ERROR run=2")),
  376. "new logs should still arrive after clearing",
  377. );
  378. expect(afterClear.every((row) => row.seq > lastSeqBeforeClear)).toBe(true);
  379. expect(hasRow(afterClear, byMessage("E2E_LOGS_ACTIVATE_INFO"))).toBe(false);
  380. // 清空不影响 Main 的缓冲与日志文件。
  381. await log.waitFor(
  382. (line) => line.includes(`[${LOGS_PLUGIN}] E2E_LOGS_ACTIVATE_INFO`),
  383. "the log file should keep the cleared lines",
  384. );
  385. // (h) 复制当前过滤后的条目。先清空剪贴板:系统剪贴板跨运行保留,上一轮的内容会让断言误判通过。
  386. await browser.electron.execute((electron) => electron.clipboard.writeText(""));
  387. await $(`[data-testid="${TID_EXTENSION_LOGS_COPY}"]`).click();
  388. let copied = "";
  389. await browser.waitUntil(
  390. async () => {
  391. copied = (await browser.electron.execute((electron) =>
  392. electron.clipboard.readText(),
  393. )) as string;
  394. return copied.includes("E2E_LOGS_COMMAND_ERROR run=2");
  395. },
  396. { timeout: 10000, timeoutMsg: "copy should put the visible rows on the clipboard" },
  397. );
  398. evidence.copied = copied.split("\n");
  399. expect(copied).toContain(`ERROR [${LOGS_PLUGIN}] E2E_LOGS_COMMAND_ERROR run=2`);
  400. expect(copied).not.toContain("E2E_LOGS_ACTIVATE_INFO");
  401. // (i) 杀掉扩展进程:旧行还在,监管器的退出与重启行出现,新代际的日志到达。
  402. const pid = await readExtensionPid();
  403. evidence.gen1Pid = pid;
  404. process.kill(pid, "SIGKILL");
  405. const afterCrash = await waitForRows(
  406. (rows) =>
  407. hasRow(
  408. rows,
  409. byMessage("extension host exited", (row) => row.gen === 1 && row.pluginId === null),
  410. ) &&
  411. hasRow(
  412. rows,
  413. byMessage("status=restarting", (row) => row.gen === 1),
  414. ) &&
  415. hasRow(
  416. rows,
  417. byMessage("status=running", (row) => row.gen === 2),
  418. ) &&
  419. hasRow(
  420. rows,
  421. byMessage(
  422. "E2E_LOGS_ACTIVATE_INFO",
  423. (row) => row.gen === 2 && row.pluginId === LOGS_PLUGIN,
  424. ),
  425. ),
  426. "lifecycle lines and the new generation should appear after the crash",
  427. 60000,
  428. );
  429. expect(afterCrash.find(byMessage("extension host exited"))?.message).toContain("intent=crash");
  430. // 崩溃前的行仍在(缓冲在 Main,扩展进程崩溃不影响)。
  431. expect(
  432. hasRow(
  433. afterCrash,
  434. byMessage("E2E_LOGS_COMMAND_ERROR run=2", (row) => row.gen === 1),
  435. ),
  436. ).toBe(true);
  437. evidence.afterCrash = afterCrash
  438. .filter((row) => row.pluginId === null || row.gen === 2)
  439. .map((row) => `${row.seq} gen=${row.gen} ${row.level} ${row.pluginId ?? "-"} ${row.message}`);
  440. screenshots.push(await capturePluginManualReview(CASE_ID, "after-crash-zh-CN-zai-light"));
  441. // (j) 命令中心「打开扩展日志」:关闭标签后重新打开,取新快照;清空的位置仍然保留。
  442. await closeLogsTab();
  443. await openLogsFromCommandCenter();
  444. const reopened = await waitForRows(
  445. (rows) =>
  446. hasRow(
  447. rows,
  448. byMessage("E2E_LOGS_ACTIVATE_INFO", (row) => row.gen === 2),
  449. ) && hasRow(rows, byMessage("E2E_LOGS_COMMAND_ERROR run=2")),
  450. "the command center should reopen the log tab with a fresh snapshot",
  451. );
  452. expect(reopened.every((row) => row.seq > lastSeqBeforeClear)).toBe(true);
  453. evidence.rendererLogs = (await log.lines()).filter((line) =>
  454. line.includes("[extension-slots] logs"),
  455. );
  456. evidence.screenshots = screenshots;
  457. });
  458. });