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 <ben@blam.sh>
This commit is contained in:
blam
2021-10-28 19:31:53 +02:00
parent bb5fe02de3
commit fc6c990cc9
+7 -4
View File
@@ -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++;