-
-
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.
test: Port loader tests from karma to playwright (#11688)
This ports `packages/browser/test/integration/suites/loader.js` and `packages/browser/test/integration/suites/loader-specific.js` to playwright. Specifically it just adds tests for SDK source and breadcrumbs, which were missing previously. ref #11084
- Loading branch information
1 parent
3a45a3c
commit fce8e8c
Showing
10 changed files
with
85 additions
and
113 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...packages/browser-integration-tests/loader-suites/loader/noOnLoad/addBreadcrumb/subject.js
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Sentry.addBreadcrumb({ | ||
category: 'auth', | ||
message: 'testing loader', | ||
level: 'error', | ||
}); | ||
Sentry.captureMessage('test'); |
22 changes: 22 additions & 0 deletions
22
dev-packages/browser-integration-tests/loader-suites/loader/noOnLoad/addBreadcrumb/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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers'; | ||
|
||
sentryTest('should add breadcrumb to message', async ({ getLocalTestUrl, page }) => { | ||
const url = await getLocalTestUrl({ testDir: __dirname }); | ||
const req = await waitForErrorRequestOnUrl(page, url); | ||
|
||
const eventData = envelopeRequestParser(req); | ||
|
||
expect(eventData.message).toBe('test'); | ||
expect(eventData.breadcrumbs?.length).toBe(1); | ||
expect(eventData.breadcrumbs).toEqual([ | ||
{ | ||
category: 'auth', | ||
level: 'error', | ||
message: 'testing loader', | ||
timestamp: expect.any(Number), | ||
}, | ||
]); | ||
}); |
8 changes: 8 additions & 0 deletions
8
dev-packages/browser-integration-tests/loader-suites/loader/onLoad/addBreadcrumb/init.js
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Sentry.onLoad(function () { | ||
Sentry.init({}); | ||
Sentry.addBreadcrumb({ | ||
category: 'auth', | ||
message: 'testing loader', | ||
level: 'error', | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
dev-packages/browser-integration-tests/loader-suites/loader/onLoad/addBreadcrumb/subject.js
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Sentry.captureMessage('test'); |
22 changes: 22 additions & 0 deletions
22
dev-packages/browser-integration-tests/loader-suites/loader/onLoad/addBreadcrumb/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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers'; | ||
|
||
sentryTest('should add breadcrumb from onLoad callback to message', async ({ getLocalTestUrl, page }) => { | ||
const url = await getLocalTestUrl({ testDir: __dirname }); | ||
const req = await waitForErrorRequestOnUrl(page, url); | ||
|
||
const eventData = envelopeRequestParser(req); | ||
|
||
expect(eventData.message).toBe('test'); | ||
expect(eventData.breadcrumbs?.length).toBe(1); | ||
expect(eventData.breadcrumbs).toEqual([ | ||
{ | ||
category: 'auth', | ||
level: 'error', | ||
message: 'testing loader', | ||
timestamp: expect.any(Number), | ||
}, | ||
]); | ||
}); |
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
43 changes: 0 additions & 43 deletions
43
packages/browser/test/integration/suites/loader-specific.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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