Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"parse5": "^8.0.0",
"pixelmatch": "^7.2.0",
"playwright": "^1.62",
"playwright-core": "^1.62",
"pngjs": "^7.0.0",
"react": "^19.1.1",
"sambanova-ai-provider": "^1.2.2",
Expand Down
17 changes: 6 additions & 11 deletions src/playwright-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const RECORDABLE: Record<string, Set<string>> = {
Page: new Set(['goBack', 'goForward', 'reload', 'keyboardPress', 'keyboardType', 'keyboardDown', 'keyboardUp', 'keyboardInsertText', 'mouseClick', 'mouseDblclick', 'mouseMove', 'mouseDown', 'mouseUp', 'mouseWheel']),
};

const PLAYWRIGHT_INCOMPATIBLE = "Playwright output is not compatible with this Playwright version (playwright-core/lib/utils does not expose asLocator). Use output.framework: 'codeceptjs' instead, or pin Playwright to a version shipping lib/utils/isomorphic/locatorGenerators.js.";
const PLAYWRIGHT_INCOMPATIBLE = "Playwright output requires playwright-core 1.62 or newer (lib/coreBundle does not expose iso.asLocator). Use output.framework: 'codeceptjs' instead.";

let cachedAsLocator: ((lang: string, selector: string) => string) | null = null;
let asLocatorLoadAttempted = false;
Expand All @@ -20,16 +20,11 @@ function getAsLocator(): (lang: string, selector: string) => string {
if (asLocatorLoadAttempted) throw new Error(PLAYWRIGHT_INCOMPATIBLE);

asLocatorLoadAttempted = true;
try {
const mod = nodeRequire('playwright-core/lib/utils');
if (typeof (mod as any)?.asLocator === 'function') {
cachedAsLocator = (mod as any).asLocator;
return cachedAsLocator!;
}
} catch {
// Module not exported or not found
}
throw new Error(PLAYWRIGHT_INCOMPATIBLE);
const asLocator = nodeRequire('playwright-core/lib/coreBundle')?.iso?.asLocator;
if (typeof asLocator !== 'function') throw new Error(PLAYWRIGHT_INCOMPATIBLE);

cachedAsLocator = asLocator;
return cachedAsLocator;
}

export interface TraceCall {
Expand Down
Loading