Stabilize Playwright phase 8 E2E to 25 green specs.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Harden login and online-card assertions, fix multi-hop discover spread selection, add Path Tracer RS lanes mock E2E, and graceful stub WS teardown.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
import { loginToDashboard } from './fixtures';
|
import { expectOnlineCrucibleCard, loginToDashboard } from './fixtures';
|
||||||
import { ensureLiveStubAgent, isLiveStubReady } from './live-stub';
|
import { ensureLiveStubAgent, isLiveStubReady } from './live-stub';
|
||||||
import { E2E_STUB_AGENT_HOSTNAME, E2E_STUB_AGENT_ID } from './stub-agent';
|
import { E2E_STUB_AGENT_HOSTNAME, E2E_STUB_AGENT_ID } from './stub-agent';
|
||||||
|
|
||||||
@@ -22,8 +22,7 @@ test.describe('Crucible bulk command', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('bulk pause on selected online node fires POST bulk-command', async ({ page }) => {
|
test('bulk pause on selected online node fires POST bulk-command', async ({ page }) => {
|
||||||
const card = page.locator('.crucible-node-card').filter({ hasText: E2E_STUB_AGENT_HOSTNAME });
|
const card = await expectOnlineCrucibleCard(page, E2E_STUB_AGENT_HOSTNAME);
|
||||||
await expect(card.locator('.cn-status-dot.on')).toBeVisible({ timeout: 15_000 });
|
|
||||||
await card.click();
|
await card.click();
|
||||||
await expect(page.locator('.fleet-bulk-bar').getByText(/1 selected/)).toBeVisible({
|
await expect(page.locator('.fleet-bulk-bar').getByText(/1 selected/)).toBeVisible({
|
||||||
timeout: 10_000,
|
timeout: 10_000,
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ export const E2E_DISCOVER_AGENT_HOSTNAME = E2E_DISCOVER_CHAIN_HOPS[0].hostname;
|
|||||||
export const E2E_DISCOVER_JOIN_LANE = E2E_DISCOVER_CHAIN_HOPS[0].joinLane;
|
export const E2E_DISCOVER_JOIN_LANE = E2E_DISCOVER_CHAIN_HOPS[0].joinLane;
|
||||||
export const E2E_DISCOVER_JOIN_LABEL = E2E_DISCOVER_CHAIN_HOPS[0].joinLabel;
|
export const E2E_DISCOVER_JOIN_LABEL = E2E_DISCOVER_CHAIN_HOPS[0].joinLabel;
|
||||||
|
|
||||||
const baseURL = process.env.AETHERFORGE_URL || 'http://127.0.0.1:8989';
|
function e2eBaseURL(): string {
|
||||||
|
return process.env.AETHERFORGE_URL || 'http://127.0.0.1:8989';
|
||||||
|
}
|
||||||
const STATS_INTERVAL_MS = 1_000;
|
const STATS_INTERVAL_MS = 1_000;
|
||||||
|
|
||||||
type HubMessage = {
|
type HubMessage = {
|
||||||
@@ -217,7 +219,9 @@ async function connectDiscoverSpreadHop(
|
|||||||
return () => {
|
return () => {
|
||||||
hopConnections.delete(hop.id);
|
hopConnections.delete(hop.id);
|
||||||
clearInterval(statsTimer);
|
clearInterval(statsTimer);
|
||||||
ws.close();
|
if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) {
|
||||||
|
ws.close(1000, 'e2e-teardown');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,11 +237,13 @@ export async function ensureDiscoverSpreadStub(request: APIRequestContext): Prom
|
|||||||
if (!serverReady) return false;
|
if (!serverReady) return false;
|
||||||
|
|
||||||
const fleetSecret = await fetchFleetSecret(request);
|
const fleetSecret = await fetchFleetSecret(request);
|
||||||
|
const baseURL = e2eBaseURL();
|
||||||
for (const hop of E2E_DISCOVER_CHAIN_HOPS) {
|
for (const hop of E2E_DISCOVER_CHAIN_HOPS) {
|
||||||
const disconnect = await connectDiscoverSpreadHop(baseURL, fleetSecret, hop);
|
const disconnect = await connectDiscoverSpreadHop(baseURL, fleetSecret, hop);
|
||||||
disconnectStubs.push(disconnect);
|
disconnectStubs.push(disconnect);
|
||||||
}
|
}
|
||||||
await new Promise((r) => setTimeout(r, 3_000));
|
// Allow agent_online, stats_batch (250ms coalesce), and DB upsert to settle.
|
||||||
|
await new Promise((r) => setTimeout(r, 4_000));
|
||||||
return true;
|
return true;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
import { loginToDashboard } from './fixtures';
|
import { expectOnlineCrucibleCard, loginToDashboard } from './fixtures';
|
||||||
import { ensureLiveStubAgent, isLiveStubReady } from './live-stub';
|
import { ensureLiveStubAgent, isLiveStubReady } from './live-stub';
|
||||||
import {
|
import {
|
||||||
ensureDiscoverSpreadStub,
|
ensureDiscoverSpreadStub,
|
||||||
@@ -14,9 +14,7 @@ import { E2E_STUB_AGENT_HOSTNAME, E2E_STUB_AGENT_ID } from './stub-agent';
|
|||||||
async function openCrucibleSpreadTab(page: import('@playwright/test').Page, hostname: string) {
|
async function openCrucibleSpreadTab(page: import('@playwright/test').Page, hostname: string) {
|
||||||
await page.getByRole('link', { name: /Crucible/i }).click();
|
await page.getByRole('link', { name: /Crucible/i }).click();
|
||||||
await expect(page.getByRole('heading', { name: 'Crucible' })).toBeVisible({ timeout: 10_000 });
|
await expect(page.getByRole('heading', { name: 'Crucible' })).toBeVisible({ timeout: 10_000 });
|
||||||
const card = page.locator('.crucible-node-card').filter({ hasText: hostname });
|
const card = await expectOnlineCrucibleCard(page, hostname);
|
||||||
await expect(card).toBeVisible({ timeout: 15_000 });
|
|
||||||
await expect(card.locator('.cn-status-dot.on')).toBeVisible({ timeout: 15_000 });
|
|
||||||
await card.click();
|
await card.click();
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('.crucible-actions-card').getByText(new RegExp(`→ ${hostname}`)),
|
page.locator('.crucible-actions-card').getByText(new RegExp(`→ ${hostname}`)),
|
||||||
@@ -116,14 +114,21 @@ test.describe('Crucible discover and spread E2E', () => {
|
|||||||
timeout: 15_000,
|
timeout: 15_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Stub propagates join_lane stats to downstream hops with staggered delays.
|
||||||
|
await page.waitForTimeout(2_000);
|
||||||
|
|
||||||
for (const hop of [seed, leaf]) {
|
for (const hop of [seed, leaf]) {
|
||||||
const card = page.locator('.crucible-node-card').filter({ hasText: hop.hostname });
|
// Crucible toggles multi-select — clear egress (and any prior hop) before focusing downstream.
|
||||||
await expect(card).toBeVisible({ timeout: 15_000 });
|
const selectedCards = page.locator('.crucible-node-card.selected');
|
||||||
await expect(card.locator('.cn-status-dot.on')).toBeVisible({ timeout: 15_000 });
|
for (let i = 0, n = await selectedCards.count(); i < n; i++) {
|
||||||
|
await selectedCards.first().click();
|
||||||
|
}
|
||||||
|
const card = await expectOnlineCrucibleCard(page, hop.hostname);
|
||||||
|
await card.scrollIntoViewIfNeeded();
|
||||||
await card.click();
|
await card.click();
|
||||||
await expect(
|
await expect(
|
||||||
page.locator('.crucible-actions-card').getByText(new RegExp(`→ ${hop.hostname}`)),
|
page.locator('.crucible-actions-card').getByText(new RegExp(`→ ${hop.hostname}`)),
|
||||||
).toBeVisible({ timeout: 10_000 });
|
).toBeVisible({ timeout: 20_000 });
|
||||||
await page.getByRole('button', { name: 'LATERAL / SPREAD' }).click();
|
await page.getByRole('button', { name: 'LATERAL / SPREAD' }).click();
|
||||||
await expect(page.locator('.access-depth-panel')).toContainText(hop.joinLabel, {
|
await expect(page.locator('.access-depth-panel')).toContainText(hop.joinLabel, {
|
||||||
timeout: 20_000,
|
timeout: 20_000,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { expect, type APIRequestContext, type Page } from '@playwright/test';
|
import { expect, type APIRequestContext, type Locator, type Page } from '@playwright/test';
|
||||||
|
|
||||||
/** Matches server/internal/api/integration_test.go testAuthUser / testAuthPass. */
|
/** Matches server/internal/api/integration_test.go testAuthUser / testAuthPass. */
|
||||||
export const E2E_USER = process.env.AETHERFORGE_E2E_USER || 'testuser';
|
export const E2E_USER = process.env.AETHERFORGE_E2E_USER || 'testuser';
|
||||||
@@ -65,19 +65,46 @@ export async function waitForServerHealth(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 6px status dots fail Playwright visibility — assert card online via class instead. */
|
||||||
|
export async function expectOnlineCrucibleCard(page: Page, hostname: string): Promise<Locator> {
|
||||||
|
const card = page.locator('.crucible-node-card').filter({
|
||||||
|
has: page.locator('.cn-name', { hasText: hostname }),
|
||||||
|
});
|
||||||
|
await expect(card).toBeVisible({ timeout: 20_000 });
|
||||||
|
await expect(card).not.toHaveClass(/offline/, { timeout: 20_000 });
|
||||||
|
await expect(card.locator('.cn-status-dot')).toHaveClass(/on/, { timeout: 5_000 });
|
||||||
|
return card;
|
||||||
|
}
|
||||||
|
|
||||||
export async function loginToDashboard(page: Page): Promise<void> {
|
export async function loginToDashboard(page: Page): Promise<void> {
|
||||||
for (let attempt = 0; attempt < 2; attempt++) {
|
const commandDeck = page.getByRole('heading', { name: 'Command Deck' });
|
||||||
await page.goto('/', { waitUntil: 'load', timeout: 30_000 });
|
|
||||||
|
for (let attempt = 0; attempt < 3; attempt++) {
|
||||||
|
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30_000 });
|
||||||
|
|
||||||
|
if (await commandDeck.isVisible().catch(() => false)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const loginHeading = page.getByRole('heading', { name: 'AetherForge' });
|
||||||
try {
|
try {
|
||||||
await expect(page.getByRole('heading', { name: 'AetherForge' })).toBeVisible({ timeout: 20_000 });
|
await expect(loginHeading).toBeVisible({ timeout: 25_000 });
|
||||||
break;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (attempt === 1) throw err;
|
if (attempt === 2) throw err;
|
||||||
await page.waitForTimeout(1_500);
|
await page.waitForTimeout(2_000);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.getByLabel('Username').fill(E2E_USER);
|
||||||
|
await page.getByLabel('Password').fill(E2E_PASS);
|
||||||
|
await page.getByRole('button', { name: /enter command deck/i }).click();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await expect(commandDeck).toBeVisible({ timeout: 25_000 });
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
if (attempt === 2) throw err;
|
||||||
|
await page.waitForTimeout(2_000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await page.getByLabel('Username').fill(E2E_USER);
|
|
||||||
await page.getByLabel('Password').fill(E2E_PASS);
|
|
||||||
await page.getByRole('button', { name: /enter command deck/i }).click();
|
|
||||||
await expect(page.getByRole('heading', { name: 'Command Deck' })).toBeVisible({ timeout: 20_000 });
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import { teardownDiscoverSpreadStub } from './discover-spread-stub';
|
||||||
import { teardownLiveStubAgent } from './live-stub';
|
import { teardownLiveStubAgent } from './live-stub';
|
||||||
|
|
||||||
export default function globalTeardown(): void {
|
export default function globalTeardown(): void {
|
||||||
|
teardownDiscoverSpreadStub();
|
||||||
teardownLiveStubAgent();
|
teardownLiveStubAgent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import type { APIRequestContext } from '@playwright/test';
|
|||||||
import { fetchFleetSecret, waitForServerHealth } from './fixtures';
|
import { fetchFleetSecret, waitForServerHealth } from './fixtures';
|
||||||
import { connectStubAgent } from './stub-agent';
|
import { connectStubAgent } from './stub-agent';
|
||||||
|
|
||||||
const baseURL = process.env.AETHERFORGE_URL || 'http://127.0.0.1:8989';
|
function e2eBaseURL(): string {
|
||||||
|
return process.env.AETHERFORGE_URL || 'http://127.0.0.1:8989';
|
||||||
|
}
|
||||||
|
|
||||||
let serverReady = false;
|
let serverReady = false;
|
||||||
let disconnectStub: (() => void) | null = null;
|
let disconnectStub: (() => void) | null = null;
|
||||||
@@ -17,7 +19,7 @@ export async function ensureLiveStubAgent(request: APIRequestContext): Promise<b
|
|||||||
if (!serverReady) return false;
|
if (!serverReady) return false;
|
||||||
|
|
||||||
const fleetSecret = await fetchFleetSecret(request);
|
const fleetSecret = await fetchFleetSecret(request);
|
||||||
disconnectStub = await connectStubAgent(baseURL, fleetSecret);
|
disconnectStub = await connectStubAgent(e2eBaseURL(), fleetSecret);
|
||||||
// Allow agent_online, stats_batch (250ms coalesce), and DB upsert to settle.
|
// Allow agent_online, stats_batch (250ms coalesce), and DB upsert to settle.
|
||||||
await new Promise((r) => setTimeout(r, 2_500));
|
await new Promise((r) => setTimeout(r, 2_500));
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -46,6 +46,6 @@ test.describe('Page smoke', () => {
|
|||||||
await page.getByRole('link', { name: /Forge/i }).click();
|
await page.getByRole('link', { name: /Forge/i }).click();
|
||||||
await expect(page.getByRole('heading', { level: 1, name: 'Forge', exact: true })).toBeVisible({ timeout: 10_000 });
|
await expect(page.getByRole('heading', { level: 1, name: 'Forge', exact: true })).toBeVisible({ timeout: 10_000 });
|
||||||
await expect(page.getByRole('heading', { name: 'Quick Forge' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Quick Forge' })).toBeVisible();
|
||||||
await expect(page.getByRole('button', { name: 'Simple' })).toBeVisible();
|
await expect(page.getByRole('button', { name: 'Simple', exact: true })).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ test.describe('Path Tracer E2E', () => {
|
|||||||
const card = page.locator('.pt-agent-card').filter({ hasText: E2E_STUB_AGENT_HOSTNAME });
|
const card = page.locator('.pt-agent-card').filter({ hasText: E2E_STUB_AGENT_HOSTNAME });
|
||||||
await expect(card).toBeVisible({ timeout: 15_000 });
|
await expect(card).toBeVisible({ timeout: 15_000 });
|
||||||
await card.click();
|
await card.click();
|
||||||
await page.getByRole('button', { name: /TRACE/i }).click();
|
await page.getByRole('button', { name: '⬡ TRACE' }).click();
|
||||||
|
|
||||||
await expect(page.getByText('Spread Routes')).toBeVisible({ timeout: 15_000 });
|
await expect(page.getByText('Spread Routes')).toBeVisible({ timeout: 15_000 });
|
||||||
await expect(page.getByText(/192\.168\.1\.0\/24/)).toBeVisible();
|
await expect(page.getByText(/192\.168\.1\.0\/24/)).toBeVisible();
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ export async function connectStubAgent(
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(statsTimer);
|
clearInterval(statsTimer);
|
||||||
ws.close();
|
if (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING) {
|
||||||
|
ws.close(1000, 'e2e-teardown');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user