Skip to content

Commit

Permalink
Fix e2e bs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cy-moi committed Dec 16, 2024
1 parent 85ffdf2 commit 7c36d46
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ describe('session in local storage strategy', () => {
localStorageStrategy.persistSession(sessionState)
localStorageStrategy.expireSession(sessionState)
const session = localStorageStrategy?.retrieveSession()
expect(session).toEqual({ isExpired: '1', anonymousId: '2gosa7pa2gw' })
expect(window.localStorage.getItem(SESSION_STORE_KEY)).toBe('isExpired=1&aid=2gosa7pa2gw')
expect(session).toEqual({ isExpired: '1', anonymousId: 'device-123' })
expect(window.localStorage.getItem(SESSION_STORE_KEY)).toBe('isExpired=1&aid=device-123')
})

it('should not interfere with other keys present in local storage', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/logs/src/domain/logsSessionManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ describe('logs session manager', () => {
startLogsSessionManagerWithDefaults()

expireCookie()
expect(getCookie(SESSION_STORE_KEY)).toBe('isExpired=1')
expect(getCookie(SESSION_STORE_KEY)).toContain('isExpired=1')
expect(getCookie(SESSION_STORE_KEY)).toContain('aid=')
clock.tick(STORAGE_POLL_DELAY)

document.body.dispatchEvent(createNewEvent(DOM_EVENT.CLICK))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/lib/helpers/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function renewSession() {
export async function expireSession() {
await setCookie(SESSION_STORE_KEY, 'isExpired=1', SESSION_TIME_OUT_DELAY)

expect(await findSessionCookie()).toBe('isExpired=1')
expect(await findSessionCookie()).toContain('isExpired=1')

// Cookies are cached for 1s, wait until the cache expires
await browser.pause(1100)
Expand Down

0 comments on commit 7c36d46

Please sign in to comment.