From 216a51f876b79271162ea004c5500f1ac717f60b Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Wed, 9 Sep 2020 12:46:24 -0700 Subject: [PATCH] Fix screenshots hopefully --- script/percy-tests.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/script/percy-tests.js b/script/percy-tests.js index 0eee647e..2f15e9d6 100644 --- a/script/percy-tests.js +++ b/script/percy-tests.js @@ -22,18 +22,17 @@ PercyScript.run(async (page, percySnapshot) => { } } await page.goto('http://localhost:8000') - await page.waitFor('.module-example__doodad-link').then(doodads => { - return doodads.$$('a').then(links => { - return links.reduce((acc, link) => { - return acc.then(_ => { - return link.evaluate(node => [node["dataset"]["percyName"], node.href]).then(([name, location]) => { - let handler = specialProcessing[name] || defaultProcessing - return handler(name, location) - } - ) - } - ) - }, Promise.resolve()) - }) - }) + await page.waitFor('.module-example__doodad-link') + let links = await page.evaluate(() => { + let nodes = Array.from(document.querySelectorAll('.module-example__doodad-link')); + return nodes.map(node => [node["dataset"]["percyName"], node.href]) + }); + + await links.reduce((acc, [name, location]) => { + return acc.then(() => { + let handler = specialProcessing[name] || defaultProcessing + return handler(name, location) + } + ) + }, Promise.resolve()) })