-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Skinner
committed
Nov 26, 2024
1 parent
784cdf6
commit 287bf9b
Showing
5 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
test/browser/features/fixtures/packages/integrity/index.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,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link href="/favicon.png" rel="shortcut icon" type="image/x-icon"> | ||
<script src="./dist/bundle.js" type="module"></script> | ||
<title>Integrity header</title> | ||
</head> | ||
<body> | ||
<h1>integrity-header</h1> | ||
<button id="send-span">send-span</button> | ||
</body> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
test/browser/features/fixtures/packages/integrity/package.json
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 @@ | ||
{ | ||
"name": "integrity", | ||
"private": true, | ||
"scripts": { | ||
"build": "rollup --config ../rollup.config.mjs", | ||
"clean": "rm -rf dist" | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
test/browser/features/fixtures/packages/integrity/src/index.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,28 @@ | ||
import BugsnagPerformance from '@bugsnag/browser-performance' | ||
|
||
const parameters = new URLSearchParams(window.location.search) | ||
const apiKey = parameters.get('api_key') | ||
const endpoint = parameters.get('endpoint') | ||
|
||
BugsnagPerformance.start({ | ||
apiKey, | ||
endpoint, | ||
sendPayloadChecksums: true, | ||
maximumBatchSize: 1, | ||
autoInstrumentFullPageLoads: false, | ||
autoInstrumentNetworkRequests: false, | ||
autoInstrumentRouteChanges: false, | ||
serviceName: 'integrity' | ||
}) | ||
|
||
document.getElementById('send-span').onclick = () => { | ||
const spanOptions = {} | ||
|
||
if (parameters.has('isFirstClass')) { | ||
spanOptions.isFirstClass = JSON.parse(parameters.get('isFirstClass')) | ||
} | ||
|
||
const span = BugsnagPerformance.startSpan("Custom/ManualSpanScenario", spanOptions) | ||
span.end() | ||
} | ||
|
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,10 @@ | ||
Feature: Integrity header | ||
|
||
Scenario: Integrity headers are set when setPayloadChecksums is true | ||
Given I navigate to the test URL "/docs/integrity" | ||
And I wait to receive a sampling request | ||
Then I click the element "send-span" | ||
And I wait for 1 span | ||
|
||
Then the sampling request "bugsnag-integrity" header matches the regex "^sha1 (\d|[abcdef]){40}$" | ||
Then the trace "bugsnag-integrity" header matches the regex "^sha1 (\d|[abcdef]){40}$" |
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