diff --git a/package.json b/package.json index 1f354cbd2..5de8e27e0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "testcafe-hammerhead", "description": "A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).", - "version": "28.4.1", + "version": "28.4.2", "homepage": "https://github.com/DevExpress/testcafe-hammerhead", "bugs": { "url": "https://github.com/DevExpress/testcafe-hammerhead/issues" diff --git a/src/client/sandbox/cookie/index.ts b/src/client/sandbox/cookie/index.ts index f390b7bd3..3d63930c8 100644 --- a/src/client/sandbox/cookie/index.ts +++ b/src/client/sandbox/cookie/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import MessageSandbox from '../event/message'; import UnloadSandbox from '../event/unload'; import SandboxBase from '../base'; @@ -118,6 +119,7 @@ class CookieSandboxProxyStrategy implements CookieSandboxStrategy { } } + /* eslint-disable */ syncCookie (gettingCookies = false): void { const cookies = nativeMethods.documentCookieGetter.call(this.document); const parsedCookies = parseClientSyncCookieStr(cookies); @@ -140,7 +142,7 @@ class CookieSandboxProxyStrategy implements CookieSandboxStrategy { const maxAge = !isNull(parsedCookie.maxAge) && Number(parsedCookie.maxAge); const expires = Number(parsedCookie.expires); - if (!isNaN(maxAge) && isNumber(maxAge) && maxAge * 1000 < currentDate.getTime() - parsedCookie.lastAccessed.getTime() || + if (!isNaN(maxAge) && isNumber(maxAge) && maxAge * 1000 <= currentDate.getTime() - parsedCookie.lastAccessed.getTime() || !isNaN(expires) && isNumber(expires) && expires < currentDate.getTime()) { nativeMethods.documentCookieSetter.call(this.document, generateDeleteSyncCookieStr(parsedCookie)); CookieSandbox._updateClientCookieStr(parsedCookie.key, null); diff --git a/test/client/fixtures/sandbox/cookie-test.js b/test/client/fixtures/sandbox/cookie-test.js index 8858ff9c1..cb7c54ed2 100644 --- a/test/client/fixtures/sandbox/cookie-test.js +++ b/test/client/fixtures/sandbox/cookie-test.js @@ -1,3 +1,4 @@ +/* eslint-disable */ // NOTE: You should clear a browser's cookie if tests are fail, // because document.cookie can contains cookie from another sites which was run through playground var sharedCookieUtils = hammerhead.sharedUtils.cookie; @@ -107,7 +108,8 @@ if (!isGreaterThanSafari15_1) { //eslint-disable-line camelcase 'TestExpired1=value; expires=' + new Date((Math.floor(Date.now() / 1000) + 1) * 1000).toUTCString(), 'TestExpired2=value; max-age=' + 1, 'TestNotExpired3=value', - ], 'TestNotExpired3=value', 2000); + 'TestExpired4=value; max-age=' + 2, + ], 'TestNotExpired3=value', 2100); }) .then(function () { return destLocation.forceLocation(storedForcedLocation);