-
-
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.
Merge pull request #9596 from getsentry/prepare-release/7.81.0
- Loading branch information
Showing
76 changed files
with
1,518 additions
and
411 deletions.
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...egration-tests/loader-suites/loader/noOnLoad/unhandeledPromiseRejectionHandler/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,3 @@ | ||
new Promise(function (resolve, reject) { | ||
reject('this is unhandled'); | ||
}); |
15 changes: 15 additions & 0 deletions
15
...integration-tests/loader-suites/loader/noOnLoad/unhandeledPromiseRejectionHandler/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,15 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers'; | ||
|
||
sentryTest('unhandled promise rejection handler works', async ({ getLocalTestUrl, page }) => { | ||
const url = await getLocalTestUrl({ testDir: __dirname }); | ||
const req = await waitForErrorRequestOnUrl(page, url); | ||
|
||
const eventData = envelopeRequestParser(req); | ||
expect(eventData.exception?.values?.length).toBe(1); | ||
expect(eventData.exception?.values?.[0]?.value).toBe( | ||
'Non-Error promise rejection captured with value: this is unhandled', | ||
); | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/browser-integration-tests/suites/feedback/captureFeedback/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,9 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
import { Feedback } from '@sentry-internal/feedback'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
integrations: [new Feedback()], | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/browser-integration-tests/suites/feedback/captureFeedback/template.html
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,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
</head> | ||
<body></body> | ||
</html> |
74 changes: 74 additions & 0 deletions
74
packages/browser-integration-tests/suites/feedback/captureFeedback/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,74 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../utils/fixtures'; | ||
import { envelopeRequestParser, getEnvelopeType } from '../../../utils/helpers'; | ||
|
||
sentryTest('should capture feedback (@sentry-internal/feedback import)', async ({ getLocalTestPath, page }) => { | ||
if (process.env.PW_BUNDLE) { | ||
sentryTest.skip(); | ||
} | ||
|
||
const feedbackRequestPromise = page.waitForResponse(res => { | ||
const req = res.request(); | ||
|
||
const postData = req.postData(); | ||
if (!postData) { | ||
return false; | ||
} | ||
|
||
try { | ||
return getEnvelopeType(req) === 'feedback'; | ||
} catch (err) { | ||
return false; | ||
} | ||
}); | ||
|
||
await page.route('https://dsn.ingest.sentry.io/**/*', route => { | ||
return route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ id: 'test-id' }), | ||
}); | ||
}); | ||
|
||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
await page.goto(url); | ||
await page.getByText('Report a Bug').click(); | ||
expect(await page.locator(':visible:text-is("Report a Bug")').count()).toEqual(1); | ||
await page.locator('[name="name"]').fill('Jane Doe'); | ||
await page.locator('[name="email"]').fill('janedoe@example.org'); | ||
await page.locator('[name="message"]').fill('my example feedback'); | ||
await page.getByLabel('Send Bug Report').click(); | ||
|
||
const feedbackEvent = envelopeRequestParser((await feedbackRequestPromise).request()); | ||
expect(feedbackEvent).toEqual({ | ||
type: 'feedback', | ||
contexts: { | ||
feedback: { | ||
contact_email: 'janedoe@example.org', | ||
message: 'my example feedback', | ||
name: 'Jane Doe', | ||
source: 'widget', | ||
url: expect.stringContaining('/dist/index.html'), | ||
}, | ||
}, | ||
level: 'info', | ||
timestamp: expect.any(Number), | ||
event_id: expect.stringMatching(/\w{32}/), | ||
environment: 'production', | ||
sdk: { | ||
integrations: expect.arrayContaining(['Feedback']), | ||
version: expect.any(String), | ||
name: 'sentry.javascript.browser', | ||
packages: expect.anything(), | ||
}, | ||
request: { | ||
url: expect.stringContaining('/dist/index.html'), | ||
headers: { | ||
'User-Agent': expect.stringContaining(''), | ||
}, | ||
}, | ||
platform: 'javascript', | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/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,18 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
import { Feedback } from '@sentry-internal/feedback'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
replaysOnErrorSampleRate: 1.0, | ||
replaysSessionSampleRate: 0, | ||
integrations: [ | ||
new Sentry.Replay({ | ||
flushMinDelay: 200, | ||
flushMaxDelay: 200, | ||
minReplayDuration: 0, | ||
}), | ||
new Feedback(), | ||
], | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/template.html
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,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
</head> | ||
<body></body> | ||
</html> |
90 changes: 90 additions & 0 deletions
90
packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/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,90 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../utils/fixtures'; | ||
import { envelopeRequestParser, getEnvelopeType } from '../../../utils/helpers'; | ||
import { getCustomRecordingEvents, getReplayEvent, waitForReplayRequest } from '../../../utils/replayHelpers'; | ||
|
||
sentryTest('should capture feedback (@sentry-internal/feedback import)', async ({ getLocalTestPath, page }) => { | ||
if (process.env.PW_BUNDLE) { | ||
sentryTest.skip(); | ||
} | ||
|
||
const reqPromise0 = waitForReplayRequest(page, 0); | ||
const feedbackRequestPromise = page.waitForResponse(res => { | ||
const req = res.request(); | ||
|
||
const postData = req.postData(); | ||
if (!postData) { | ||
return false; | ||
} | ||
|
||
try { | ||
return getEnvelopeType(req) === 'feedback'; | ||
} catch (err) { | ||
return false; | ||
} | ||
}); | ||
|
||
await page.route('https://dsn.ingest.sentry.io/**/*', route => { | ||
return route.fulfill({ | ||
status: 200, | ||
contentType: 'application/json', | ||
body: JSON.stringify({ id: 'test-id' }), | ||
}); | ||
}); | ||
|
||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
await page.goto(url); | ||
await page.getByText('Report a Bug').click(); | ||
await page.locator('[name="name"]').fill('Jane Doe'); | ||
await page.locator('[name="email"]').fill('janedoe@example.org'); | ||
await page.locator('[name="message"]').fill('my example feedback'); | ||
await page.getByLabel('Send Bug Report').click(); | ||
|
||
const [feedbackResp, replayReq] = await Promise.all([feedbackRequestPromise, reqPromise0]); | ||
|
||
const feedbackEvent = envelopeRequestParser(feedbackResp.request()); | ||
const replayEvent = getReplayEvent(replayReq); | ||
const { breadcrumbs } = getCustomRecordingEvents(replayReq); | ||
|
||
expect(breadcrumbs).toEqual( | ||
expect.arrayContaining([ | ||
{ | ||
category: 'sentry.feedback', | ||
data: { feedbackId: expect.any(String) }, | ||
}, | ||
]), | ||
); | ||
|
||
expect(feedbackEvent).toEqual({ | ||
type: 'feedback', | ||
contexts: { | ||
feedback: { | ||
contact_email: 'janedoe@example.org', | ||
message: 'my example feedback', | ||
name: 'Jane Doe', | ||
replay_id: replayEvent.event_id, | ||
source: 'widget', | ||
url: expect.stringContaining('/dist/index.html'), | ||
}, | ||
}, | ||
level: 'info', | ||
timestamp: expect.any(Number), | ||
event_id: expect.stringMatching(/\w{32}/), | ||
environment: 'production', | ||
sdk: { | ||
integrations: expect.arrayContaining(['Feedback']), | ||
version: expect.any(String), | ||
name: 'sentry.javascript.browser', | ||
packages: expect.anything(), | ||
}, | ||
request: { | ||
url: expect.stringContaining('/dist/index.html'), | ||
headers: { | ||
'User-Agent': expect.stringContaining(''), | ||
}, | ||
}, | ||
platform: 'javascript', | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
packages/browser-integration-tests/suites/manual-client/browser-context/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,37 @@ | ||
import { | ||
BrowserClient, | ||
Breadcrumbs, | ||
Dedupe, | ||
FunctionToString, | ||
HttpContext, | ||
InboundFilters, | ||
LinkedErrors, | ||
defaultStackParser, | ||
makeFetchTransport, | ||
Hub, | ||
} from '@sentry/browser'; | ||
|
||
const integrations = [ | ||
new Breadcrumbs(), | ||
new FunctionToString(), | ||
new Dedupe(), | ||
new HttpContext(), | ||
new InboundFilters(), | ||
new LinkedErrors(), | ||
]; | ||
|
||
const client = new BrowserClient({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '0.0.1', | ||
environment: 'local', | ||
sampleRate: 1.0, | ||
tracesSampleRate: 0.0, | ||
transport: makeFetchTransport, | ||
stackParser: defaultStackParser, | ||
integrations, | ||
debug: true, | ||
}); | ||
|
||
const hub = new Hub(client); | ||
|
||
hub.captureException(new Error('test client')); |
Oops, something went wrong.