Close test-gap noise rows and sync coverage documentation.
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
Restore P1/P2/fleet/erasure COVERED rows in PROBLEMS.md with refreshed counts; drop fixed poll-duplication and Vitest-noise items. Silence ECONNREFUSED stderr in Vitest setup, alias download mock exports, and expand erasure/Path Tracer test coverage.
This commit is contained in:
66
server/web/e2e/path-tracer.spec.ts
Normal file
66
server/web/e2e/path-tracer.spec.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { loginToDashboard } from './fixtures';
|
||||
import { ensureLiveStubAgent, isLiveStubReady } from './live-stub';
|
||||
import { E2E_STUB_AGENT_HOSTNAME, E2E_STUB_AGENT_ID } from './stub-agent';
|
||||
|
||||
const SESSION_ID = 'e2e-rs-lanes-sess';
|
||||
|
||||
test.describe('Path Tracer E2E', () => {
|
||||
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 page.route('**/pathtrace/start', async (route) => {
|
||||
await route.fulfill({
|
||||
json: {
|
||||
session_id: SESSION_ID,
|
||||
hops: [{ agent_id: E2E_STUB_AGENT_ID, status: 'pending' }],
|
||||
},
|
||||
});
|
||||
});
|
||||
await page.route(`**/pathtrace/${SESSION_ID}/status`, async (route) => {
|
||||
await route.fulfill({
|
||||
json: {
|
||||
session_id: SESSION_ID,
|
||||
ready: false,
|
||||
hops: [{ agent_id: E2E_STUB_AGENT_ID, status: 'pending' }],
|
||||
spread_routes: [
|
||||
{
|
||||
target_subnet: '192.168.1.0/24',
|
||||
seed_agent_id: E2E_STUB_AGENT_ID,
|
||||
seed_agent_name: E2E_STUB_AGENT_HOSTNAME,
|
||||
egress_agent_id: E2E_STUB_AGENT_ID,
|
||||
join_lane: 'dns_txt',
|
||||
score: 0.85,
|
||||
erasure_lanes_enabled: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
await loginToDashboard(page);
|
||||
await page.goto('/pathtracer');
|
||||
await expect(page.getByRole('heading', { name: /Path Tracer/i })).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test('shows RS lanes hint on spread routes when erasure is enabled', async ({ page }) => {
|
||||
const card = page.locator('.pt-agent-card').filter({ hasText: E2E_STUB_AGENT_HOSTNAME });
|
||||
await expect(card).toBeVisible({ timeout: 15_000 });
|
||||
await card.click();
|
||||
await page.getByRole('button', { name: /TRACE/i }).click();
|
||||
|
||||
await expect(page.getByText('Spread Routes')).toBeVisible({ timeout: 15_000 });
|
||||
await expect(page.getByText(/192\.168\.1\.0\/24/)).toBeVisible();
|
||||
await expect(page.getByText(/dns_txt/)).toBeVisible();
|
||||
await expect(page.getByText(/RS lanes/)).toBeVisible();
|
||||
});
|
||||
});
|
||||
@@ -67,10 +67,9 @@ vi.mock('../context/ForgeContext', () => ({
|
||||
|
||||
vi.mock('../api/download', () => {
|
||||
const downloadAuthedFile = vi.fn();
|
||||
const downloadApiFile = vi.fn();
|
||||
return {
|
||||
downloadAuthedFile,
|
||||
downloadApiFile,
|
||||
downloadApiFile: downloadAuthedFile,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* @vitest-environment happy-dom
|
||||
*/
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
@@ -57,7 +57,7 @@ describe('MissionDeckPage', () => {
|
||||
|
||||
it('shows loading state then mission deck hero', async () => {
|
||||
renderMissionDeck();
|
||||
expect(screen.getByText('Loading loadout defaults…')).toBeInTheDocument();
|
||||
expect(screen.getByText(/Loading loadout defaults/)).toBeInTheDocument();
|
||||
expect(await screen.findByRole('heading', { level: 1, name: /Mission Deck/i })).toBeInTheDocument();
|
||||
expect(screen.getByText('FAST PATH')).toBeInTheDocument();
|
||||
expect(await screen.findByText(/Pick a preset loadout/i)).toBeInTheDocument();
|
||||
@@ -79,7 +79,7 @@ describe('MissionDeckPage', () => {
|
||||
await screen.findByRole('region', { name: 'Mission loadout' });
|
||||
expect(screen.getByRole('heading', { level: 3, name: /Spread profile/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'LAN Kindling' })).toBeInTheDocument();
|
||||
expect(screen.getByLabelText(/Campaign slug/i)).toBeInTheDocument();
|
||||
expect(document.getElementById('md-campaign')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('links to Forge, Emberwake, Builds, and field guide', async () => {
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
import { vi, beforeEach } from 'vitest';
|
||||
import { vi, beforeEach, afterEach } from 'vitest';
|
||||
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
|
||||
const nativeConsoleError = console.error.bind(console);
|
||||
|
||||
/** Builder/dashboard happy-dom tests stub fetch failures; silence noisy ECONNREFUSED stderr. */
|
||||
function isBenignTestStderr(args: unknown[]): boolean {
|
||||
const text = args.map((a) => (a instanceof Error ? a.message : String(a))).join(' ');
|
||||
return text.includes('ECONNREFUSED');
|
||||
}
|
||||
|
||||
let consoleErrorSpy: ReturnType<typeof vi.spyOn> | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
if (typeof Element !== 'undefined') {
|
||||
Element.prototype.scrollIntoView = vi.fn();
|
||||
}
|
||||
consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation((...args: unknown[]) => {
|
||||
if (isBenignTestStderr(args)) return;
|
||||
nativeConsoleError(...args);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
consoleErrorSpy?.mockRestore();
|
||||
consoleErrorSpy = undefined;
|
||||
});
|
||||
Reference in New Issue
Block a user