diff --git a/core/example-tests/example.js b/core/example-tests/example.js index c96fcca383..adc50b5123 100644 --- a/core/example-tests/example.js +++ b/core/example-tests/example.js @@ -14,6 +14,10 @@ const BASEURL = process.env.SIMPLETEST_BASE_URL; * @returns {*} */ const setupCookie = function (browser, cookieValue) { + const matches = BASEURL.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); + const domain = matches[1]; + const path = matches[2]; + return browser // See https://bugs.chromium.org/p/chromedriver/issues/detail?id=728#c10 .url(BASEURL) @@ -21,8 +25,8 @@ const setupCookie = function (browser, cookieValue) { name: 'SIMPLETEST_USER_AGENT', // Colons needs to be URL encoded to be valid. value: encodeURIComponent(cookieValue), - path: BASEURL.split(extractHostname)[1], - domain: extractHostname(BASEURL), + path: path, + domain: domain, }); };