| |
| |
| |
| |
| @@ -198,6 +198,22 @@ describe('startSessionManagement', () => { |
| expectSessionIdToBeDefined(session) |
| expectTrackingTypeToBe(session, FIRST_PRODUCT_KEY, FakeTrackingType.TRACKED) |
| }) |
| + |
| + it('should not renew on visibility after expiration', () => { |
| + const session = startSessionManagement(FIRST_PRODUCT_KEY, () => ({ |
| + isTracked: true, |
| + trackingType: FakeTrackingType.TRACKED, |
| + })) |
| + const renewSessionSpy = jasmine.createSpy() |
| + session.renewObservable.subscribe(renewSessionSpy) |
| + |
| + expireSession() |
| + |
| + jasmine.clock().tick(VISIBILITY_CHECK_DELAY) |
| + |
| + expect(renewSessionSpy).not.toHaveBeenCalled() |
| + expectSessionIdToNotBeDefined(session) |
| + }) |
| }) |
| |
| describe('multiple startSessionManagement calls', () => { |
| |
| |
| |
| |
| @@ -10,9 +10,8 @@ import sinon from 'sinon' |
| |
| import { LifeCycle, LifeCycleEventType } from '../src/lifeCycle' |
| import { handleResourceEntry, RumEvent, RumResourceEvent } from '../src/rum' |
| -import { PAGE_ACTIVITY_VALIDATION_DELAY } from '../src/trackPageActivities' |
| import { UserAction, UserActionType } from '../src/userActionCollection' |
| -import { SESSION_KEEP_ALIVE_INTERVAL, THROTTLE_VIEW_UPDATE_PERIOD } from '../src/viewCollection' |
| +import { SESSION_KEEP_ALIVE_INTERVAL } from '../src/viewCollection' |
| import { setup, TestSetupBuilder } from './specHelper' |
| |
| function getEntry(addRumEvent: (event: RumEvent) => void, index: number) { |
| @@ -269,7 +268,7 @@ describe('rum session', () => { |
| it('when tracked without resources should not track resources', () => { |
| const { server, stubBuilder, lifeCycle } = setupBuilder |
| .withSession({ |
| - getId: () => undefined, |
| + getId: () => '1234', |
| isTracked: () => true, |
| isTrackedWithResource: () => false, |
| }) |
| @@ -313,7 +312,7 @@ describe('rum session', () => { |
| let isTracked = true |
| const { server, stubBuilder } = setupBuilder |
| .withSession({ |
| - getId: () => undefined, |
| + getId: () => '1234', |
| isTracked: () => isTracked, |
| isTrackedWithResource: () => isTracked, |
| }) |
| @@ -340,7 +339,7 @@ describe('rum session', () => { |
| let isTrackedWithResource = true |
| const { server, lifeCycle } = setupBuilder |
| .withSession({ |
| - getId: () => undefined, |
| + getId: () => '1234', |
| isTracked: () => true, |
| isTrackedWithResource: () => isTrackedWithResource, |
| }) |
| @@ -390,6 +389,30 @@ describe('rum session', () => { |
| expect(subsequentRequests[0].session_id).toEqual('43') |
| expect(subsequentRequests[0].view.id).not.toEqual(initialRequests[0].view.id) |
| }) |
| + |
| + it('when switching from not tracked to tracked, it should not send events without sessionId', () => { |
| + let sessionId = undefined as string | undefined |
| + let isTracked = false |
| + const { server, lifeCycle } = setupBuilder |
| + .withSession({ |
| + getId: () => sessionId, |
| + isTracked: () => isTracked, |
| + isTrackedWithResource: () => false, |
| + }) |
| + .withViewCollection() |
| + .build() |
| + |
| + server.requests = [] |
| + lifeCycle.notify(LifeCycleEventType.ERROR_COLLECTED, FAKE_ERROR as ErrorMessage) |
| + expect(getServerRequestBodies<ExpectedRequestBody>(server).length).toEqual(0) |
| + |
| + |
| + isTracked = true |
| + sessionId = '1234' |
| + |
| + lifeCycle.notify(LifeCycleEventType.ERROR_COLLECTED, FAKE_ERROR as ErrorMessage) |
| + expect(getServerRequestBodies<ExpectedRequestBody>(server).length).toEqual(0) |
| + }) |
| }) |
| |
| describe('rum session keep alive', () => { |
| @@ -406,7 +429,7 @@ describe('rum session keep alive', () => { |
| .withFakeServer() |
| .withFakeClock() |
| .withSession({ |
| - getId: () => undefined, |
| + getId: () => '1234', |
| isTracked: () => isSessionTracked, |
| isTrackedWithResource: () => true, |
| }) |
| @@ -464,11 +487,6 @@ describe('rum global context', () => { |
| let setupBuilder: TestSetupBuilder |
| |
| beforeEach(() => { |
| - const session = { |
| - getId: () => undefined, |
| - isTracked: () => true, |
| - isTrackedWithResource: () => true, |
| - } |
| setupBuilder = setup() |
| .withFakeServer() |
| .withRum() |
| |
| |
| |
| |
| @@ -56,7 +56,7 @@ export interface TestIO { |
| |
| export function setup(): TestSetupBuilder { |
| let session = { |
| - getId: () => undefined as string | undefined, |
| + getId: () => '1234' as string | undefined, |
| isTracked: () => true, |
| isTrackedWithResource: () => true, |
| } |
| |
| new file mode 100644 |
| |
| |
| @@ -0,0 +1,12 @@ |
| +H4sIAAAAAAAAA+2W30/bMBDH+5y/wmOT0krESUoDUqU+DIbUSaNFgzeEqvw40kBiZ7YDTIj/fZeE |
| +lgJjoAmGJu7z4tj+Xu/sO9vlUZXlyQzEudt5LTxkKwiaFrnfNt9+0Pf7njcIfL/j+X6w5XVY8GoR |
| +rVBpEyrGOkpK8yfdU/P/Kfw2/2ehKkKOu5GC4bEUJ/xUv4iPOsGbg8Fj+fcH3uYy/56HdeIHgw2/ |
| +w7wX8f4E7zz/mGdtWBmaORsxBT+qTEHXrvt2z2onm7rYDjXsYE2sqjh3DWjjViIzN9UToaypHbS2 |
| +CplUOXC4LKUyGi1PKhGbTIpurcjSHruyGGu/uQbTrbuMcc7vuFxvRutf3sewhk2w/FRmojubJZkS |
| +YQHrDIOxe63yJMtBD9lR02EMFxOfhSloN5YK2og1aI1x7IUCJwoQhusSYm60vf7ASlVFa4Qfz5HV |
| +kjHkJahb4XHblApKJWN0LhVGePVXEeLK7AuIahv7+JnhPtfmbuy/sbpuG1wHphTqRRzZtdFiPlLy |
| +Qt+M78yVLGAMYYL50BN5EIokkpcLaYwnTxbfQqyJOaxuxyN2t4K2GIbsnodlUrAE8jBtYnAcIR19 |
| +1/FyFU1z3bOurbc+hW/Hyv1fV8AslkWB28X1/OV8PPX+b/jB8v7f2Orj/T/Y9D26//8FHz+4USZc |
| +PFBzK05YUwQRJFZ7abP9z4fj0ZorS+MKmYDT79fy4ad6fG0hmky/7M6m+4dfp5OD0ZrjyBKE1rmT |
| +QxrGPx288s6zBNRSvzP+Pt3bnW1/nYzcSqsmgFTKNAcnbk60gzmJcrBEedm+PqxOkmEP35tcxmG+ |
| ++LPyjo8xQRAEQRAEQRAEQRAEQRAEQRAEQRBE5xeiAJkoACgAAA== |
| |
| new file mode 100755 |
| |
| |
| @@ -0,0 +1,6 @@ |
| +#!/usr/bin/env bash |
| + |
| +set -uo pipefail |
| +cd /testbed || exit 1 |
| +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 |
| +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' |
|
|