Harden E2E selectors for Forge mode toggle and spread actions card.

Use scoped Simple button locator, containText for hostname in actions card, and card-scoped TRACE click to avoid strict-mode and encoding flakes.
This commit is contained in:
AetherForge
2026-06-07 07:06:19 -07:00
parent e3d7ecc33f
commit f9ce44b962
3 changed files with 5 additions and 9 deletions

View File

@@ -16,9 +16,7 @@ async function openCrucibleSpreadTab(page: import('@playwright/test').Page, host
await expect(page.getByRole('heading', { name: 'Crucible' })).toBeVisible({ timeout: 10_000 }); await expect(page.getByRole('heading', { name: 'Crucible' })).toBeVisible({ timeout: 10_000 });
const card = await expectOnlineCrucibleCard(page, hostname); const card = await expectOnlineCrucibleCard(page, hostname);
await card.click(); await card.click();
await expect( await expect(page.locator('.crucible-actions-card')).toContainText(hostname, { timeout: 10_000 });
page.locator('.crucible-actions-card').getByText(new RegExp(`${hostname}`)),
).toBeVisible({ timeout: 10_000 });
await page.getByRole('button', { name: 'LATERAL / SPREAD' }).click(); await page.getByRole('button', { name: 'LATERAL / SPREAD' }).click();
await expect(page.getByRole('button', { name: 'Probe & Join' })).toBeVisible({ await expect(page.getByRole('button', { name: 'Probe & Join' })).toBeVisible({
timeout: 10_000, timeout: 10_000,
@@ -126,9 +124,7 @@ test.describe('Crucible discover and spread E2E', () => {
const card = await expectOnlineCrucibleCard(page, hop.hostname); const card = await expectOnlineCrucibleCard(page, hop.hostname);
await card.scrollIntoViewIfNeeded(); await card.scrollIntoViewIfNeeded();
await card.click(); await card.click();
await expect( await expect(page.locator('.crucible-actions-card')).toContainText(hop.hostname, { timeout: 20_000 });
page.locator('.crucible-actions-card').getByText(new RegExp(`${hop.hostname}`)),
).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,

View File

@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test'; import { expect, test } from '@playwright/test';
import { loginToDashboard } from './fixtures'; import { loginToDashboard } from './fixtures';
test.describe('Page smoke', () => { test.describe('Page smoke', () => {
@@ -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', exact: true })).toBeVisible(); await expect(page.locator('.forge-mode-toggle').getByRole('button', { name: 'Simple', exact: true }).first()).toBeVisible();
}); });
}); });

View File

@@ -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' }).click(); await card.getByRole('button', { name: /TRACE/i }).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();