-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
less mutation on options; review comments
- Loading branch information
Showing
4 changed files
with
78 additions
and
77 deletions.
There are no files selected for viewing
47 changes: 25 additions & 22 deletions
47
...ckages/browser-integration-tests/suites/manual-client/skip-init-browser-extension/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
import { expect } from '@playwright/test'; | ||
import { sentryTest } from '../../../utils/fixtures'; | ||
|
||
sentryTest('should not initialize when inside a Chrome browser extension', async ({ getLocalTestUrl, page }) => { | ||
await page.route('https://dsn.ingest.sentry.io/**/*', route => { | ||
return route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ id: 'test-id' }), | ||
sentryTest( | ||
'should not initialize when inside a Firefox/Safari browser extension', | ||
async ({ getLocalTestUrl, page }) => { | ||
await page.route('https://dsn.ingest.sentry.io/**/*', route => { | ||
return route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ id: 'test-id' }), | ||
}); | ||
}); | ||
}); | ||
|
||
const errorLogs: string[] = []; | ||
const errorLogs: string[] = []; | ||
|
||
page.on('console', message => { | ||
if (message.type() === 'error') errorLogs.push(message.text()); | ||
}); | ||
page.on('console', message => { | ||
if (message.type() === 'error') errorLogs.push(message.text()); | ||
}); | ||
|
||
const url = await getLocalTestUrl({ testDir: __dirname }); | ||
await page.goto(url); | ||
const url = await getLocalTestUrl({ testDir: __dirname }); | ||
await page.goto(url); | ||
|
||
const isInitialized = await page.evaluate(() => { | ||
return !!(window as any).Sentry.isInitialized(); | ||
}); | ||
const isInitialized = await page.evaluate(() => { | ||
return !!(window as any).Sentry.isInitialized(); | ||
}); | ||
|
||
expect(isInitialized).toEqual(false); | ||
expect(errorLogs.length).toEqual(1); | ||
expect(errorLogs[0]).toEqual( | ||
'[Sentry] You cannot run Sentry this way in an extension, check: https://docs.sentry.io/platforms/javascript/troubleshooting/#setting-up-sentry-in-shared-environments-eg-browser-extensions', | ||
); | ||
}); | ||
expect(isInitialized).toEqual(false); | ||
expect(errorLogs.length).toEqual(1); | ||
expect(errorLogs[0]).toEqual( | ||
'[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/troubleshooting/#setting-up-sentry-in-shared-environments-eg-browser-extensions', | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters