From d207dcb2f14beb990c02ed1823b39abbffc6fb3c Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Thu, 19 Oct 2023 15:20:45 +0200 Subject: [PATCH 1/2] fix: proceedSee --- lib/helper/Playwright.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 2b84f1214..e9ada0748 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -3354,7 +3354,11 @@ async function proceedSee(assertType, text, context, strict = false) { if (!context) { const el = await this.context; - allText = [await el.locator('body').innerText()]; + if (el.constructor.name) { + allText = [await el.locator('body').innerText()]; + } else { + allText = [await el.innerText()]; + } description = 'web application'; } else { const locator = new Locator(context, 'css'); From 78df28fd47b734fbd053213e3c2af210d28f4e16 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Thu, 19 Oct 2023 15:31:16 +0200 Subject: [PATCH 2/2] improve code --- lib/helper/Playwright.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index e9ada0748..abb6fb927 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -3354,11 +3354,8 @@ async function proceedSee(assertType, text, context, strict = false) { if (!context) { const el = await this.context; - if (el.constructor.name) { - allText = [await el.locator('body').innerText()]; - } else { - allText = [await el.innerText()]; - } + allText = el.constructor.name ? [await el.locator('body').innerText()] : [await el.innerText()]; + description = 'web application'; } else { const locator = new Locator(context, 'css');