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,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. */
|
||||
export const E2E_USER = process.env.AETHERFORGE_E2E_USER || 'testuser';
|
||||
@@ -65,19 +65,46 @@ export async function waitForServerHealth(
|
||||
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> {
|
||||
for (let attempt = 0; attempt < 2; attempt++) {
|
||||
await page.goto('/', { waitUntil: 'load', timeout: 30_000 });
|
||||
const commandDeck = page.getByRole('heading', { name: 'Command Deck' });
|
||||
|
||||
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 {
|
||||
await expect(page.getByRole('heading', { name: 'AetherForge' })).toBeVisible({ timeout: 20_000 });
|
||||
break;
|
||||
await expect(loginHeading).toBeVisible({ timeout: 25_000 });
|
||||
} catch (err) {
|
||||
if (attempt === 1) throw err;
|
||||
await page.waitForTimeout(1_500);
|
||||
if (attempt === 2) throw err;
|
||||
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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user