From af1e2865f725e8941bb0d4a4a140fd4e15a74fb2 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Wed, 3 Jan 2018 14:24:06 +0800
Subject: [PATCH] Re-introduce ability to handle basic authentication in smoke
 tests.

---
 test/smoke_test.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/smoke_test.js b/test/smoke_test.js
index 58ced5bb5fe..282a3e9c250 100644
--- a/test/smoke_test.js
+++ b/test/smoke_test.js
@@ -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);
   });