From 0de7c0d38c77c20e4c5489204d7d02ca2f25ce6a Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Tue, 1 Apr 2025 15:10:23 -0700 Subject: [PATCH] chore: follow up with iframe stitch (#110) --- src/context.ts | 8 ++++++-- tests/basic.spec.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/context.ts b/src/context.ts index f119f44..2467955 100644 --- a/src/context.ts +++ b/src/context.ts @@ -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, ''); + } } } } diff --git a/tests/basic.spec.ts b/tests/basic.spec.ts index 4809b0f..6d4640c 100644 --- a/tests/basic.spec.ts +++ b/tests/basic.spec.ts @@ -347,7 +347,7 @@ test('save as pdf', async ({ client }) => { - Page Title: Title - Page Snapshot \`\`\`yaml -- document [ref=s1e2]: Hello, world! +- text: Hello, world! \`\`\` ` );