CI / Lint (eslint) (pull_request) Successful in 23s
CI / Test (jest) (pull_request) Successful in 23s
CI / Security (npm audit) (pull_request) Successful in 10s
CI / Integration (api) (pull_request) Successful in 2m40s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m51s
CI / UI (playwright) (pull_request) Successful in 4m32s
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 4m43s
The mode (single or multi), the single worker and the multi-worker selection are saved in localStorage (pulse_qc_prefs): the mode when it changes, the workers when a command is sent. A reload starts from that choice instead of the first worker; a Re-run from Executions still overrides it. The Ctrl+Enter hint and shortcut already existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
111 lines
5.3 KiB
JavaScript
111 lines
5.3 KiB
JavaScript
'use strict';
|
|
|
|
// End to end: browser -> server -> a real worker over the authenticated
|
|
// WebSocket -> result stored -> shown in the UI.
|
|
const { test, expect } = require('./fixtures');
|
|
|
|
const token = () => `ui-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
|
|
test('a quick command runs on a worker and its output shows in Executions', async ({ page }) => {
|
|
const marker = token();
|
|
await page.goto('/quick');
|
|
await page.locator('#qc-worker').selectOption({ label: 'node-02 (online)' });
|
|
await page.locator('#qc-command').fill(`echo ${marker}`);
|
|
await page.locator('#qc-execute-btn').click();
|
|
|
|
const result = page.locator('#qc-result');
|
|
await expect(result).toContainText('Command sent successfully');
|
|
await result.getByRole('link', { name: 'view in Executions' }).click();
|
|
|
|
await expect(page).toHaveURL(/\/executions/);
|
|
const detail = page.locator('#ex-detail-body');
|
|
await expect(detail).toContainText(marker);
|
|
await expect(detail).toContainText(/completed/i);
|
|
|
|
// The list row says what ran and where, not just "[Quick Command]" (#15).
|
|
await page.keyboard.press('Escape');
|
|
await expect(page.locator('#ex-list-manual .ex-row').filter({ hasText: `echo ${marker}` }).first()).toContainText('@ node-02');
|
|
});
|
|
|
|
test('a failing command is reported as failed with its stderr', async ({ page }) => {
|
|
const marker = token();
|
|
await page.goto('/quick');
|
|
await page.locator('#qc-worker').selectOption({ label: 'node-01 (online)' });
|
|
await page.locator('#qc-command').fill(`echo ${marker} >&2; exit 3`);
|
|
await page.locator('#qc-command').press('Control+Enter'); // the documented shortcut
|
|
|
|
await page.locator('#qc-result').getByRole('link', { name: 'view in Executions' }).click();
|
|
const detail = page.locator('#ex-detail-body');
|
|
await expect(detail).toContainText(marker);
|
|
await expect(detail).toContainText(/failed/i);
|
|
});
|
|
|
|
test('multi-worker mode sends the command to every selected worker', async ({ page }) => {
|
|
await page.goto('/quick');
|
|
await page.locator('label[for="qc-mode-multi"], #qc-mode-multi').first().click();
|
|
await page.getByRole('button', { name: /select all/i }).click();
|
|
await page.locator('#qc-command').fill(`echo ${token()}`);
|
|
await page.locator('#qc-execute-btn').click();
|
|
|
|
const result = page.locator('#qc-result');
|
|
await expect(result).toContainText('Success: 3');
|
|
await expect(result).toContainText('Failed: 0');
|
|
await expect(result.locator('tbody tr')).toHaveCount(3);
|
|
});
|
|
|
|
test('Executions updates live when a command starts elsewhere', async ({ page, request }) => {
|
|
await page.goto('/executions');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Start a command through the API, not this page: only the WebSocket can tell it.
|
|
const workers = await (await request.get('/api/workers')).json();
|
|
const node3 = workers.find(w => w.name === 'node-03');
|
|
const res = await request.post(`/api/workers/${node3.id}/command`, { data: { command: `echo ${token()}` } });
|
|
expect(res.ok()).toBeTruthy();
|
|
const { execution_id: id } = await res.json();
|
|
|
|
// Its own row appears without a reload (by id, so it works however full the list is).
|
|
await expect(page.locator(`#ex-list-manual .ex-row[data-execution-id="${id}"]`)).toBeVisible();
|
|
});
|
|
|
|
test('searching Executions finds a run by its command (#16)', async ({ page, request }) => {
|
|
const marker = token();
|
|
const workers = await (await request.get('/api/workers')).json();
|
|
const node1 = workers.find(w => w.name === 'node-01');
|
|
const { execution_id: id } = await (await request.post(`/api/workers/${node1.id}/command`, { data: { command: `echo ${marker}` } })).json();
|
|
|
|
await page.goto('/executions');
|
|
await page.locator('#ex-search').fill(marker);
|
|
const rows = page.locator('#ex-list-manual .ex-row');
|
|
await expect(rows).toHaveCount(1);
|
|
await expect(rows.first()).toHaveAttribute('data-execution-id', id);
|
|
});
|
|
|
|
test('Quick Command remembers the mode and workers after a reload (#31)', async ({ page }) => {
|
|
await page.goto('/quick');
|
|
await page.locator('#qc-mode-multi').check();
|
|
const boxes = page.locator('#qc-worker-list label');
|
|
await boxes.filter({ hasText: 'node-02' }).locator('input').check();
|
|
await boxes.filter({ hasText: 'node-03' }).locator('input').check();
|
|
await page.locator('#qc-command').fill('true');
|
|
await page.locator('#qc-execute-btn').click();
|
|
await expect(page.locator('#qc-result')).toContainText(/2/);
|
|
|
|
await page.reload();
|
|
await expect(page.locator('#qc-mode-multi')).toBeChecked();
|
|
await expect(boxes.filter({ hasText: 'node-02' }).locator('input')).toBeChecked();
|
|
await expect(boxes.filter({ hasText: 'node-03' }).locator('input')).toBeChecked();
|
|
await expect(boxes.filter({ hasText: 'node-01' }).locator('input')).not.toBeChecked();
|
|
|
|
// Single mode remembers its worker too.
|
|
await page.locator('#qc-mode-single').check();
|
|
const node3 = await page.locator('#qc-worker option', { hasText: 'node-03' }).getAttribute('value');
|
|
await page.locator('#qc-worker').selectOption(node3);
|
|
await page.locator('#qc-command').fill('true'); // the reload emptied it
|
|
await page.locator('#qc-execute-btn').click();
|
|
await expect(page.locator('#qc-result')).toContainText('Command sent successfully');
|
|
await page.reload();
|
|
await expect(page.locator('#qc-mode-single')).toBeChecked();
|
|
await expect(page.locator('#qc-worker option:checked')).toContainText('node-03');
|
|
});
|