diff --git a/commands.js b/commands.js
index 77f508616e6923a13945627d7c58fb0eedd565ee..1a422b924bf65044751cf9c5f628487cb2d86254 100644
--- a/commands.js
+++ b/commands.js
@@ -1,3 +1,17 @@
+Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
+    options = {};
+    if (Cypress.env('basicauth_user') != null) {
+        options = {
+            auth : {
+                username: Cypress.env('basicauth_user'),
+                password: Cypress.env('basicauth_pass')
+            }
+        };
+    }
+
+    return originalFn(url, options);
+});
+
 Cypress.Commands.add('followLink', (selector) => {
     cy.get(selector).then(($link) => {
         cy.visit($link.attr('href'));