chore: follow up with iframe stitch (#110)

This commit is contained in:
Pavel Feldman 2025-04-01 15:10:23 -07:00 committed by GitHub
parent 0a5518b252
commit 0de7c0d38c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -188,8 +188,12 @@ export class Context {
if (value.startsWith('iframe ')) {
const ref = value.match(/\[ref=(.*)\]/)?.[1];
if (ref) {
const childSnapshot = await this._allFramesSnapshot(frame.frameLocator(`aria-ref=${ref}`));
return snapshot.createPair(node.value, childSnapshot);
try {
const childSnapshot = await this._allFramesSnapshot(frame.frameLocator(`aria-ref=${ref}`));
return snapshot.createPair(node.value, childSnapshot);
} catch (error) {
return snapshot.createPair(node.value, '<could not take iframe snapshot>');
}
}
}
}

View File

@ -347,7 +347,7 @@ test('save as pdf', async ({ client }) => {
- Page Title: Title
- Page Snapshot
\`\`\`yaml
- document [ref=s1e2]: Hello, world!
- text: Hello, world!
\`\`\`
`
);