import { expect, test } from '@playwright/test'; import { loginToDashboard } from './fixtures'; import { ensureLiveStubAgent, isLiveStubReady } from './live-stub'; import { E2E_STUB_AGENT_HOSTNAME, E2E_WHOAMI_RESPONSE } from './stub-agent'; test.describe('Crucible remote command', () => { test.beforeAll(async ({ request }) => { await ensureLiveStubAgent(request); }); test.beforeEach(async ({ page }) => { test.skip( !isLiveStubReady(), 'Requires live E2E server (test-suite phase 8 on :18989 or AETHERFORGE_URL)', ); await loginToDashboard(page); await page.getByRole('link', { name: /Crucible/i }).click(); await expect(page.getByRole('heading', { name: 'Crucible' })).toBeVisible({ timeout: 10_000 }); await expect(page.getByText(E2E_STUB_AGENT_HOSTNAME)).toBeVisible({ timeout: 15_000 }); }); test('whoami on selected online node shows terminal output', async ({ page }) => { await page.getByText(E2E_STUB_AGENT_HOSTNAME).click(); await expect( page.locator('.crucible-actions-card').getByText(new RegExp(`→ ${E2E_STUB_AGENT_HOSTNAME}`)), ).toBeVisible(); await page.getByRole('button', { name: 'CMD', exact: true }).click(); const input = page.locator('.crucible-term-input'); await input.fill('whoami'); await page.getByRole('button', { name: 'SEND' }).click(); const terminal = page.locator('.crucible-terminal'); await expect(terminal.getByText('whoami', { exact: true })).toBeVisible({ timeout: 10_000 }); await expect(terminal.getByText(E2E_WHOAMI_RESPONSE)).toBeVisible({ timeout: 15_000 }); }); test('exec echo via master terminal shows output', async ({ page }) => { await page.getByText(E2E_STUB_AGENT_HOSTNAME).click(); await page.getByRole('button', { name: 'CMD', exact: true }).click(); const input = page.locator('.crucible-term-input'); await expect(input).toBeEnabled(); await input.fill('echo crucible-e2e-ping'); await page.getByRole('button', { name: 'SEND' }).click(); const terminal = page.locator('.crucible-terminal'); await expect(terminal.getByText('echo crucible-e2e-ping')).toBeVisible({ timeout: 10_000 }); await expect(terminal.getByText('crucible-e2e-ping', { exact: true })).toBeVisible({ timeout: 15_000, }); }); });