9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
26 lines
945 B
JavaScript
26 lines
945 B
JavaScript
import * as fs from 'node:fs';
|
|
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
export const dumpCommand = cli({
|
|
site: 'doubao-app',
|
|
name: 'dump',
|
|
access: 'read',
|
|
description: 'Dump Doubao desktop app DOM and snapshot to /tmp for debugging',
|
|
domain: 'doubao-app',
|
|
strategy: Strategy.UI,
|
|
browser: true,
|
|
args: [],
|
|
columns: ['Status', 'File'],
|
|
func: async (page) => {
|
|
const htmlPath = '/tmp/doubao-dom.html';
|
|
const snapPath = '/tmp/doubao-snapshot.json';
|
|
const html = await page.evaluate('document.documentElement.outerHTML');
|
|
const snap = await page.snapshot({ compact: true });
|
|
fs.writeFileSync(htmlPath, html);
|
|
fs.writeFileSync(snapPath, typeof snap === 'string' ? snap : JSON.stringify(snap, null, 2));
|
|
return [
|
|
{ Status: 'Success', File: htmlPath },
|
|
{ Status: 'Success', File: snapPath },
|
|
];
|
|
},
|
|
});
|