Readable command output: ANSI stripped, Copy / Wrap / Expand / .txt (#27)
CI / Lint (eslint) (pull_request) Successful in 20s
CI / Test (jest) (pull_request) Successful in 21s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Integration (api) (pull_request) Successful in 2m43s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m44s
CI / UI (playwright) (pull_request) Successful in 2m35s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 1m54s
CI / Lint (eslint) (pull_request) Successful in 20s
CI / Test (jest) (pull_request) Successful in 21s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Integration (api) (pull_request) Successful in 2m43s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m44s
CI / UI (playwright) (pull_request) Successful in 2m35s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 1m54s
A shared output block (Pulse.output.render) now draws every command output in Executions and Quick Command: - ANSI escape codes (colours, cursor moves, titles, charset switches) are stripped, so systemctl, ls --color and docker read cleanly. - Copy and .txt use the full, clean text; .txt downloads it as a file. - Wrap turns long-line wrapping on or off for every block, remembered. - Output over 25 lines starts at 24rem high with an Expand button. - Over 100,000 characters, the display is cut with a notice saying how much is hidden; Copy and .txt still include all of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64703482fd
commit
ecc1b447be
6 files changed
+162
-22
No files matched your search
@@ -166,3 +166,40 @@ test('only the worker picker for the chosen mode is shown', async ({ page }) =>
|
||||
await expect(page.locator('#qc-multi-mode')).toBeVisible();
|
||||
await expect(page.locator('#qc-single-mode')).toBeHidden();
|
||||
});
|
||||
|
||||
test('output is readable: colours stripped, Copy / Wrap / Expand / .txt (#27)', async ({ page, context }) => {
|
||||
await context.grantPermissions(['clipboard-read', 'clipboard-write']);
|
||||
await page.goto('/quick');
|
||||
await page.locator('#qc-mode-single').check();
|
||||
await page.locator('#qc-worker').selectOption({ label: 'node-01 (online)' });
|
||||
await page.locator('#qc-command').fill(`printf '\\033[1;32mgreen\\033[0m plain\\n'; seq 1 40`);
|
||||
await page.locator('#qc-execute-btn').click();
|
||||
|
||||
const block = page.locator('#qc-result .pl-out').first();
|
||||
const pre = block.locator('pre');
|
||||
await expect(pre).toContainText('green plain');
|
||||
expect(await pre.textContent()).not.toContain('\u001b'); // no raw escape codes
|
||||
|
||||
// 41 lines: starts collapsed, Expand shows everything.
|
||||
await expect(pre).toHaveClass(/is-tall/);
|
||||
await block.getByRole('button', { name: 'Expand' }).click();
|
||||
await expect(pre).toHaveClass(/is-expanded/);
|
||||
await expect(block.getByRole('button', { name: 'Collapse' })).toBeVisible();
|
||||
|
||||
// Wrap toggles long-line wrapping, and the choice sticks.
|
||||
await block.getByRole('button', { name: 'Wrap' }).click();
|
||||
await expect(pre).toHaveClass(/is-nowrap/);
|
||||
await block.getByRole('button', { name: 'Wrap' }).click();
|
||||
await expect(pre).not.toHaveClass(/is-nowrap/);
|
||||
|
||||
// Copy gives the full, clean text.
|
||||
await block.getByRole('button', { name: 'Copy' }).click();
|
||||
const copied = await page.evaluate(() => navigator.clipboard.readText());
|
||||
expect(copied.startsWith('green plain\n1\n2\n')).toBe(true);
|
||||
expect(copied.trim().endsWith('40')).toBe(true);
|
||||
|
||||
// .txt downloads the same text.
|
||||
const [dl] = await Promise.all([page.waitForEvent('download'), block.getByRole('button', { name: '.txt' }).click()]);
|
||||
expect(dl.suggestedFilename()).toMatch(/^pulse-[0-9a-f]{8}\.txt$/);
|
||||
expect(require('fs').readFileSync(await dl.path(), 'utf8')).toBe(copied);
|
||||
});
|
||||
Reference in new issue
Block a user