Files
paseo/packages/app/e2e/support/helpers/file-callouts.ts
T
Mohamed BoudraandGitHub 5a30affd7f Skip unrelated required checks without losing their names (#2542)
* fix(ci): skip unrelated required checks cleanly

Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable.

* fix(ci): gate changes to install patching script

* fix(ci): route cross-package test contracts narrowly

* fix(ci): keep routed contracts merge-blocking

* fix(server): exclude nested test utilities from builds

* fix(ci): cover app-owned native and browser domains

* refactor(ci): align tests with runtime domains

Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check.

* fix(ci): keep routing and desktop suites isolated

The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs.

* fix(ci): isolate desktop e2e runtime

* perf(test): isolate Playwright workers

* perf(test): parallelize Playwright within specs

* fix(test): keep Playwright file scheduling

* fix(test): share dynamic Metro fixture

* fix(test): preserve own-host restart fixtures

* fix(ci): preserve routed contracts after rebase

* Stabilize Playwright wheel-scroll assertions
2026-08-02 00:56:05 +08:00

49 lines
1.8 KiB
TypeScript

import type { Page } from "@playwright/test";
import { expect } from "../fixtures";
export async function recordFileCallouts(page: Page): Promise<void> {
await page.evaluate(() => {
const callouts: string[] = [];
const recordAlert = (alert: Element) => {
const text = alert.textContent?.trim();
if (text && !callouts.includes(text)) callouts.push(text);
};
const record = (records: MutationRecord[]) => {
for (const mutation of records) {
if (
!(mutation.target instanceof Element) ||
!mutation.target.closest('[data-testid="workspace-file-pane"]')
) {
continue;
}
for (const node of mutation.addedNodes) {
if (!(node instanceof Element)) continue;
if (node.matches('[role="alert"]')) recordAlert(node);
for (const alert of node.querySelectorAll('[role="alert"]')) recordAlert(alert);
}
}
};
const observer = new MutationObserver(record);
observer.observe(document.body, { childList: true, subtree: true, characterData: true });
Object.assign(globalThis, { __PASEO_RECORDED_FILE_CALLOUTS__: callouts });
});
}
export async function expectFileCalloutWasRendered(page: Page, title: string): Promise<void> {
await expect
.poll(() => recordedFileCallouts(page))
.toEqual(expect.arrayContaining([expect.stringContaining(title)]));
}
export async function expectNoFileCalloutWasRendered(page: Page): Promise<void> {
await expect.poll(() => recordedFileCallouts(page)).toEqual([]);
}
function recordedFileCallouts(page: Page): Promise<string[]> {
return page.evaluate(
() =>
(globalThis as typeof globalThis & { __PASEO_RECORDED_FILE_CALLOUTS__?: string[] })
.__PASEO_RECORDED_FILE_CALLOUTS__ ?? [],
);
}