Re-introduce ability to handle basic authentication in smoke tests.

This commit is contained in:
Guo Xiang Tan 2018-01-03 14:24:06 +08:00
parent 73912ebc12
commit af1e2865f7
1 changed files with 9 additions and 0 deletions

View File

@ -53,6 +53,15 @@ const path = require('path');
page.on('console', msg => console.log(`PAGE LOG: ${msg.text}`));
if (process.env.AUTH_USER && process.env.AUTH_PASSWORD) {
await exec("basic authentication", () => {
return page.authenticate({
username: process.env.AUTH_USER,
password: process.env.AUTH_PASSWORD
});
});
}
await exec("go to site", () => {
return page.goto(url);
});