DEV: add more information about failed smoke test

log the http status code and path that failed
This commit is contained in:
Sam
2018-05-17 16:00:43 +10:00
parent 392f184b24
commit 441a52ad17

View File

@ -14,8 +14,8 @@ const path = require('path');
(async () => {
const browser = await puppeteer.launch({
// headless: false,
// slowMo: 10,
// when debugging localy setting headless to "false" can be very helpful
headless: true,
args: ["--disable-local-storage"]
});
const page = await browser.newPage();
@ -53,6 +53,16 @@ const path = require('path');
page.on('console', msg => console.log(`PAGE LOG: ${msg.text}`));
page.setRequestInterception(true);
page.on('request', req => { return req.continue(); });
page.on('response', resp => {
if (resp.status !== 200) {
console.log("FAILED HTTP REQUEST TO " + resp.url + " Status is: " + resp.status);
}
return resp;
});
if (process.env.AUTH_USER && process.env.AUTH_PASSWORD) {
await exec("basic authentication", () => {
return page.setExtraHTTPHeaders({