-
-
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 remote-tracking branch 'origin/develop' into DominikB2014/add-s…
…pan-domain-to-span-data
- Loading branch information
Showing
247 changed files
with
3,425 additions
and
1,027 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
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
16 changes: 16 additions & 0 deletions
16
...wser-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/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,16 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
beforeSend(event) { | ||
Sentry.captureUserFeedback({ | ||
event_id: event.event_id, | ||
name: 'John Doe', | ||
email: 'john@doe.com', | ||
comments: 'This feedback should be attached associated with the captured error', | ||
}); | ||
return event; | ||
}, | ||
}); |
1 change: 1 addition & 0 deletions
1
...r-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/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.captureException(new Error('Error with Feedback')); |
23 changes: 23 additions & 0 deletions
23
...wser-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/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,23 @@ | ||
import { expect } from '@playwright/test'; | ||
import type { Event, UserFeedback } from '@sentry/types'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; | ||
|
||
sentryTest('capture user feedback when captureException is called', async ({ getLocalTestPath, page }) => { | ||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | UserFeedback)[]; | ||
|
||
expect(data).toHaveLength(2); | ||
|
||
const errorEvent = ('exception' in data[0] ? data[0] : data[1]) as Event; | ||
const feedback = ('exception' in data[0] ? data[1] : data[0]) as UserFeedback; | ||
|
||
expect(feedback).toEqual({ | ||
comments: 'This feedback should be attached associated with the captured error', | ||
email: 'john@doe.com', | ||
event_id: errorEvent.event_id, | ||
name: 'John Doe', | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
...rowser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/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,16 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
beforeSend(event) { | ||
Sentry.captureUserFeedback({ | ||
event_id: event.event_id, | ||
name: 'John Doe', | ||
email: 'john@doe.com', | ||
comments: 'This feedback should be attached associated with the captured message', | ||
}); | ||
return event; | ||
}, | ||
}); |
1 change: 1 addition & 0 deletions
1
...ser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/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('Message with Feedback'); |
23 changes: 23 additions & 0 deletions
23
...rowser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/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,23 @@ | ||
import { expect } from '@playwright/test'; | ||
import type { Event, UserFeedback } from '@sentry/types'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; | ||
|
||
sentryTest('capture user feedback when captureMessage is called', async ({ getLocalTestPath, page }) => { | ||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | UserFeedback)[]; | ||
|
||
expect(data).toHaveLength(2); | ||
|
||
const errorEvent = ('exception' in data[0] ? data[0] : data[1]) as Event; | ||
const feedback = ('exception' in data[0] ? data[1] : data[0]) as UserFeedback; | ||
|
||
expect(feedback).toEqual({ | ||
comments: 'This feedback should be attached associated with the captured message', | ||
email: 'john@doe.com', | ||
event_id: errorEvent.event_id, | ||
name: 'John Doe', | ||
}); | ||
}); |
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
18 changes: 18 additions & 0 deletions
18
dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/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'; | ||
|
||
window.Sentry = Sentry; | ||
window.Replay = new Sentry.Replay({ | ||
flushMinDelay: 50, | ||
flushMaxDelay: 50, | ||
minReplayDuration: 0, | ||
}); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
sampleRate: 0, | ||
replaysSessionSampleRate: 1.0, | ||
replaysOnErrorSampleRate: 0.0, | ||
debug: true, | ||
|
||
integrations: [window.Replay, new Sentry.ReplayCanvas({ enableManualSnapshot: true })], | ||
}); |
26 changes: 26 additions & 0 deletions
26
dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/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,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
</head> | ||
<body> | ||
<canvas id="canvas" width="150" height="150"></canvas> | ||
<button id="draw">Draw</button> | ||
</body> | ||
|
||
|
||
<script> | ||
function draw() { | ||
const canvas = document.getElementById("canvas"); | ||
if (canvas.getContext) { | ||
console.log('has canvas') | ||
const ctx = canvas.getContext("2d"); | ||
|
||
ctx.fillRect(25, 25, 100, 100); | ||
ctx.clearRect(45, 45, 60, 60); | ||
ctx.strokeRect(50, 50, 50, 50); | ||
} | ||
} | ||
document.getElementById('draw').addEventListener('click', draw); | ||
</script> | ||
</html> |
79 changes: 79 additions & 0 deletions
79
dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/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,79 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } from '../../../../utils/replayHelpers'; | ||
|
||
sentryTest('can manually snapshot canvas', async ({ getLocalTestUrl, page, browserName }) => { | ||
if (shouldSkipReplayTest() || browserName === 'webkit' || (process.env.PW_BUNDLE || '').startsWith('bundle')) { | ||
sentryTest.skip(); | ||
} | ||
|
||
const reqPromise0 = waitForReplayRequest(page, 0); | ||
const reqPromise1 = waitForReplayRequest(page, 1); | ||
const reqPromise2 = waitForReplayRequest(page, 2); | ||
const reqPromise3 = waitForReplayRequest(page, 3); | ||
|
||
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 getLocalTestUrl({ testDir: __dirname }); | ||
|
||
await page.goto(url); | ||
await reqPromise0; | ||
await Promise.all([page.click('#draw'), reqPromise1]); | ||
|
||
const { incrementalSnapshots } = getReplayRecordingContent(await reqPromise2); | ||
expect(incrementalSnapshots).toEqual([]); | ||
|
||
await page.evaluate(() => { | ||
(window as any).Sentry.getClient().getIntegrationById('ReplayCanvas').snapshot(); | ||
}); | ||
|
||
const { incrementalSnapshots: incrementalSnapshotsManual } = getReplayRecordingContent(await reqPromise3); | ||
expect(incrementalSnapshotsManual).toEqual( | ||
expect.arrayContaining([ | ||
{ | ||
data: { | ||
commands: [ | ||
{ | ||
args: [0, 0, 150, 150], | ||
property: 'clearRect', | ||
}, | ||
{ | ||
args: [ | ||
{ | ||
args: [ | ||
{ | ||
data: [ | ||
{ | ||
base64: expect.any(String), | ||
rr_type: 'ArrayBuffer', | ||
}, | ||
], | ||
rr_type: 'Blob', | ||
type: 'image/webp', | ||
}, | ||
], | ||
rr_type: 'ImageBitmap', | ||
}, | ||
0, | ||
0, | ||
], | ||
property: 'drawImage', | ||
}, | ||
], | ||
id: 9, | ||
source: 9, | ||
type: 0, | ||
}, | ||
timestamp: 0, | ||
type: 3, | ||
}, | ||
]), | ||
); | ||
}); |
Oops, something went wrong.