Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix _isEnabled
  • Loading branch information
Lms24 committed Jan 16, 2023
commit 290f41f54e3aaa73b67686833ebb05f8e0203c57
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ sentryTest('errorResponse', async ({ getLocalTestPath, page }) => {
await page.waitForTimeout(5001);

expect(called).toBe(1);
debugger;
const replay = await getReplaySnapshot(page);
debugger;

expect(replay['_isEnabled']).toBe(false);
// @ts-ignore private API
expect(replay._isEnabled).toBe(false);
});
8 changes: 7 additions & 1 deletion packages/integration-tests/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Page, Request } from '@playwright/test';
import type { ReplayContainer } from '@sentry/replay/build/npm/types/types';
import { ReplayContainer } from '@sentry/replay/build/npm/types/types';
import type { Event, EventEnvelopeHeaders } from '@sentry/types';

const envelopeUrlRegex = /\.sentry\.io\/api\/\d+\/envelope\//;
Expand Down Expand Up @@ -60,6 +60,12 @@ async function getSentryEvents(page: Page, url?: string): Promise<Array<Event>>
*/
export async function getReplaySnapshot(page: Page): Promise<ReplayContainer> {
const replayIntegration = await page.evaluate<{ _replay: ReplayContainer }>('window.Replay');
debugger;
console.log(replayIntegration._replay);
console.log(typeof replayIntegration);
console.log(Object.getPrototypeOf(replayIntegration._replay));
console.log('isenabled', replayIntegration._replay.isEnabled);

return replayIntegration._replay;
}

Expand Down
3 changes: 2 additions & 1 deletion rollup/plugins/bundlePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ export function makeTerserPlugin() {
'_driver',
'_initStorage',
'_support',
// We want to keept he _replay variable unmangled to enable integration tests to access it
// We want to keept he _replay and _isEnabled variable unmangled to enable integration tests to access it
'_replay',
'_isEnabled',
],
},
},
Expand Down