diff --git a/core/tests/Drupal/Nightwatch/Commands/drupalUserIsLoggedIn.js b/core/tests/Drupal/Nightwatch/Commands/drupalUserIsLoggedIn.js
index 47ca4f7aa3011098d4798821a4a6cc67d423b6b1..e0cde167a5b3c09e457d005f41bd5c6f66a157e0 100644
--- a/core/tests/Drupal/Nightwatch/Commands/drupalUserIsLoggedIn.js
+++ b/core/tests/Drupal/Nightwatch/Commands/drupalUserIsLoggedIn.js
@@ -10,7 +10,7 @@ exports.command = function drupalUserIsLoggedIn(callback) {
   if (typeof callback === 'function') {
     this.getCookies(cookies => {
       const sessionExists = cookies.value.some(cookie =>
-        cookie.name.match(/^SESS/),
+        cookie.name.match(/^S?SESS/),
       );
 
       callback.call(this, sessionExists);