diff --git a/bin/testrunner.js b/bin/testrunner.js index fe19610..9e091f3 100644 --- a/bin/testrunner.js +++ b/bin/testrunner.js @@ -1,9 +1,9 @@ /** - * - * make screenshots and log errors to + * + * make screenshots and log errors to * console * (c) 2019 - Leibniz-Insitut für Wissensmedien - * + * */ const puppeteer = require('puppeteer'); @@ -24,13 +24,13 @@ function logPageEvent(event){ } async function makeScreenshot(href){ - + const browser = await puppeteer.launch({args: [ '–allow-file-access-from-files', ],}); const page = await browser.newPage(); - + await page.setViewport({width: 1024,height : 624}) // register events @@ -53,9 +53,9 @@ async function makeScreenshot(href){ } // image_url = image_url.replace("file:///","") // fpath = fpath.replace("file:///","") - + page.removeAllListeners() - + fs.ensureDir(fpath) await page.screenshot({path: image_url}); @@ -63,10 +63,10 @@ async function makeScreenshot(href){ } /** - * + * * collect all navigational links in all documents - * - * */ + * + * */ async function collectLinks(href,reflist) { @@ -76,12 +76,12 @@ async function collectLinks(href,reflist) await page.goto(href) let hrefs = await page.$$('a.wrapper') - + for (var i=0; i < hrefs.length; i++) { let hrefValue = await hrefs[i].getProperty('href') let linkText = await hrefValue.jsonValue(); if (!linkText.startsWith("file:")) - { + { continue; } if(linkText.endsWith("#")) continue; @@ -113,4 +113,4 @@ async function collectLinks(href,reflist) await makeScreenshot(reflist[i]) console.log(i,reflist[i]) } -})() \ No newline at end of file +})()