From fc6c990cc9c9ccb34c2438ce33243243d5966c06 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Oct 2021 19:31:53 +0200 Subject: [PATCH] chore: this time, I promise. I fixed it. Sorted out all the scoping stuff for the hacky stuff that evaluate does with .toString Signed-off-by: blam --- packages/e2e-test/src/lib/helpers.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/e2e-test/src/lib/helpers.ts b/packages/e2e-test/src/lib/helpers.ts index f51cf5b798..350898234d 100644 --- a/packages/e2e-test/src/lib/helpers.ts +++ b/packages/e2e-test/src/lib/helpers.ts @@ -142,10 +142,12 @@ export async function waitForPageWithText( waitUntil: 'networkidle0', }); - const match = await page.evaluate(() => - Array.from(document.querySelectorAll('*')).some( - el => el.textContent === text, - ), + const match = await page.evaluate( + textContent => + Array.from(document.querySelectorAll('*')).some( + el => el.textContent === textContent, + ), + text, ); if (!match) { @@ -154,6 +156,7 @@ export async function waitForPageWithText( break; } catch (error) { + console.log(error); assertError(error); findAttempts++;