fix(e2e): dual-stack selector compatibility — 18/18 specs pass on Tauri

- selectors.ts: dual CSS selectors for all divergent class names
- actions.ts: fallback DOM queries (try primary, then alternatives)
- assertions.ts: waitUntil with dual selectors
- 12 spec files updated with graceful skip for stack-specific features
- 175 tests pass, 30 skip (expected: groups/diagnostics Tauri-absent)
This commit is contained in:
Hibryda 2026-03-22 05:56:01 +01:00
parent 77b9ce9f62
commit 3d74398fde
16 changed files with 482 additions and 236 deletions

View file

@ -1,7 +1,8 @@
/**
* Custom E2E assertions domain-specific checks for Agent Orchestrator.
*
* Uses browser.execute() for DOM queries (WebKitGTK reliability).
* Uses browser.execute() for DOM queries with dual selectors to support
* both Tauri and Electrobun UIs (WebKitGTK reliability).
*/
import { browser, expect } from '@wdio/globals';
@ -10,7 +11,8 @@ import * as S from './selectors.ts';
/** Assert that a project card with the given name is visible in the grid */
export async function assertProjectVisible(name: string): Promise<void> {
const found = await browser.execute((n: string) => {
const cards = document.querySelectorAll('.project-card, .project-header');
// Tauri: .project-box | Electrobun: .project-card | Both: .project-header
const cards = document.querySelectorAll('.project-box, .project-card, .project-header');
for (const card of cards) {
if (card.textContent?.includes(n)) return true;
}
@ -45,8 +47,16 @@ export async function assertSettingsPersist(selector: string): Promise<void> {
/** Assert the status bar is visible and contains expected sections */
export async function assertStatusBarComplete(): Promise<void> {
const statusBar = await browser.$(S.STATUS_BAR);
await expect(statusBar).toBeDisplayed();
await browser.waitUntil(
async () =>
browser.execute(() => {
const el = document.querySelector('[data-testid="status-bar"]')
?? document.querySelector('.status-bar');
if (!el) return false;
return getComputedStyle(el).display !== 'none';
}) as Promise<boolean>,
{ timeout: 10_000, timeoutMsg: 'Status bar not visible within 10s' },
);
}
/** Assert element count matches expected via DOM query */