Last active
February 27, 2018 14:34
-
-
Save fivetanley/c7bb2f839ff3def11b026e26baf17f4e 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 () => { | |
const { HEROKU_EMAIL, HEROKU_PASSWORD } = process.env; | |
const browser = await puppeteer.launch({headless: false}) | |
const page = await browser.newPage(); | |
await page.goto('https://dashboard.heroku.com'); | |
// login | |
await page.type('#email', HEROKU_EMAIL); | |
await page.type('#password', HEROKU_PASSWORD); | |
await page.click('button[name=commit]'); | |
await page.waitForNavigation(); | |
await page.goto('https://dashboard.heroku.com/apps/cool-app3/logs'); | |
// wait for logs to show up! | |
const element = await page.waitForSelector('.build-stream-output .build-stream-line'); | |
// read the log line | |
const value = await (await element.getProperty('innerHTML')).jsonValue(); | |
// log out the log line for debugging | |
console.log('value', value); | |
// does it match what we expect? | |
// in this case we have a canary app that only logs one thing | |
if (/noisy-server/.test(value)) { | |
console.log('success!'); | |
} else { | |
console.log('dang no logs!!'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment