Created
February 14, 2019 15:21
-
-
Save RodrigoSC/dce7a76ca60e7d1209d5bc367a8ae72d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
var result = 0; | |
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']}); | |
console.log("Accessing: " + process.argv[2]); | |
const page = await browser.newPage(); | |
await page.goto(process.argv[2]); | |
await page.waitForSelector('#__reactivedoc__ > *, #__reactivedoc__.shiny-output-error') | |
.then(() => page.$('#__reactivedoc__') | |
.then(el => el.getProperty('className')) | |
.then(cname => cname.jsonValue()) | |
.then(json => { | |
if (json.includes('shiny-output-error')) { | |
console.log('Error in Rmd') | |
result = 1 | |
} else console.log('All is good!') | |
}) | |
.catch(error => {result = 1; console.log('Failed to get element content:' + error)})) | |
.catch(error => {result = 1; console.log('Timeout waiting for result:' + error)}) | |
await browser.close(); | |
process.exit(result); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment