Skip to content

Commit 53194d7

Browse files
authored
test(browser): Avoid using example.com for browser-integration-tests (#15332)
Mostly we already add a route for this anyhow, but it can be confusing. So let's just use a proper non-existing URL there to ensure we notice issues earlier.
1 parent 6deb156 commit 53194d7

File tree

72 files changed

+188
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+188
-159
lines changed

dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/onreadystatechange/subject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
window.calls = {};
22
const xhr = new XMLHttpRequest();
3-
xhr.open('GET', 'http://example.com');
3+
xhr.open('GET', 'http://sentry-test-site.example');
44
xhr.onreadystatechange = function wat() {
55
window.calls[xhr.readyState] = window.calls[xhr.readyState] ? window.calls[xhr.readyState] + 1 : 1;
66
};

dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/onreadystatechange/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sentryTest(
77
async ({ getLocalTestUrl, page }) => {
88
const url = await getLocalTestUrl({ testDir: __dirname });
99

10-
await page.route('http://example.com/', route => {
10+
await page.route('http://sentry-test-site.example/', route => {
1111
return route.fulfill({
1212
status: 200,
1313
contentType: 'application/json',

dev-packages/browser-integration-tests/suites/replay/requests/subject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ document.getElementById('go-background').addEventListener('click', () => {
66
});
77

88
document.getElementById('fetch').addEventListener('click', () => {
9-
fetch('https://example.com', { method: 'POST', body: 'foo' });
9+
fetch('https://sentry-test-site.example', { method: 'POST', body: 'foo' });
1010
});
1111

1212
document.getElementById('xhr').addEventListener('click', () => {
1313
const xhr = new XMLHttpRequest();
14-
xhr.open('GET', 'https://example.com');
14+
xhr.open('GET', 'https://sentry-test-site.example');
1515
xhr.send();
1616
});

dev-packages/browser-integration-tests/suites/replay/requests/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc
1010
sentryTest.skip();
1111
}
1212

13-
await page.route('https://example.com', route => {
13+
await page.route('https://sentry-test-site.example', route => {
1414
return route.fulfill({
1515
status: 200,
1616
contentType: 'application/json',
@@ -27,7 +27,7 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc
2727

2828
const { performanceSpans: spans0 } = getReplayRecordingContent(req0);
2929

30-
await Promise.all([page.waitForResponse('https://example.com'), page.locator('#fetch').click()]);
30+
await Promise.all([page.waitForResponse('https://sentry-test-site.example'), page.locator('#fetch').click()]);
3131

3232
const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1);
3333

@@ -40,7 +40,7 @@ sentryTest('replay recording should contain XHR request span', async ({ getLocal
4040
sentryTest.skip();
4141
}
4242

43-
await page.route('https://example.com', route => {
43+
await page.route('https://sentry-test-site.example', route => {
4444
return route.fulfill({
4545
status: 200,
4646
contentType: 'application/json',
@@ -57,7 +57,7 @@ sentryTest('replay recording should contain XHR request span', async ({ getLocal
5757

5858
const { performanceSpans: spans0 } = getReplayRecordingContent(req0);
5959

60-
await Promise.all([page.waitForResponse('https://example.com'), page.locator('#xhr').click()]);
60+
await Promise.all([page.waitForResponse('https://sentry-test-site.example'), page.locator('#xhr').click()]);
6161

6262
const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1);
6363

dev-packages/browser-integration-tests/suites/replay/slowClick/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ <h1 id="h2">Bottom</h1>
7676
document.getElementById('out').innerHTML += 'mutationButton clicked<br>';
7777
});
7878
document.getElementById('windowOpenButton').addEventListener('click', () => {
79-
window.open('https://example.com/', '_blank');
79+
window.open('https://github.com/', '_blank');
8080
});
8181

8282
// Do nothing on these elements

dev-packages/browser-integration-tests/suites/replay/slowClick/windowOpen/test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ sentryTest('window.open() is considered for slow click', async ({ getLocalTestUr
88
sentryTest.skip();
99
}
1010

11-
await page.route('http://example.com/', route => {
12-
return route.fulfill({
13-
status: 200,
14-
contentType: 'application/json',
15-
body: JSON.stringify({}),
16-
});
17-
});
18-
1911
const url = await getLocalTestUrl({ testDir: __dirname });
2012

2113
await Promise.all([waitForReplayRequest(page, 0), page.goto(url)]);
@@ -63,5 +55,5 @@ sentryTest('window.open() is considered for slow click', async ({ getLocalTestUr
6355
const pages = context.pages();
6456

6557
expect(pages.length).toBe(2);
66-
expect(pages[1].url()).toBe('https://example.com/');
58+
expect(pages[1].url()).toBe('https://github.com/');
6759
});
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
fetch('http://example.com/0').then(fetch('http://example.com/1').then(fetch('http://example.com/2')));
1+
fetch('http://sentry-test-site.example/0').then(
2+
fetch('http://sentry-test-site.example/1').then(fetch('http://sentry-test-site.example/2')),
3+
);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sentryTest('should create fetch spans with http timing @firefox', async ({ brows
1010
if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) {
1111
sentryTest.skip();
1212
}
13-
await page.route('http://example.com/*', async route => {
13+
await page.route('http://sentry-test-site.example/*', async route => {
1414
const request = route.request();
1515
const postData = await request.postDataJSON();
1616

@@ -33,7 +33,7 @@ sentryTest('should create fetch spans with http timing @firefox', async ({ brows
3333
await page.pause();
3434
requestSpans?.forEach((span, index) =>
3535
expect(span).toMatchObject({
36-
description: `GET http://example.com/${index}`,
36+
description: `GET http://sentry-test-site.example/${index}`,
3737
parent_span_id: tracingEvent.contexts?.trace?.span_id,
3838
span_id: expect.stringMatching(/[a-f0-9]{16}/),
3939
start_timestamp: expect.any(Number),

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-disabled/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
</head>
66
<body>
77
<div>Rendered Before Long Animation Frame</div>
8-
<script src="https://example.com/path/to/script.js"></script>
8+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
99
</body>
1010
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<button id="clickme">
99
click me to start the long animation!
1010
</button>
11-
<script src="https://example.com/path/to/script.js"></script>
11+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
1212
</body>
1313
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ sentryTest(
3333
expect(uiSpans?.length).toBeGreaterThanOrEqual(1);
3434

3535
const topLevelUISpan = (uiSpans || []).find(
36-
span => span.data?.['browser.script.invoker'] === 'https://example.com/path/to/script.js',
36+
span => span.data?.['browser.script.invoker'] === 'https://sentry-test-site.example/path/to/script.js',
3737
)!;
3838
expect(topLevelUISpan).toEqual(
3939
expect.objectContaining({
4040
op: 'ui.long-animation-frame',
4141
description: 'Main UI thread blocked',
4242
parent_span_id: eventData.contexts?.trace?.span_id,
4343
data: {
44-
'code.filepath': 'https://example.com/path/to/script.js',
44+
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
4545
'browser.script.source_char_position': 0,
46-
'browser.script.invoker': 'https://example.com/path/to/script.js',
46+
'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js',
4747
'browser.script.invoker_type': 'classic-script',
4848
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long-animation-frame',
4949
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
@@ -98,7 +98,7 @@ sentryTest(
9898
data: {
9999
'browser.script.invoker': 'BUTTON#clickme.onclick',
100100
'browser.script.invoker_type': 'event-listener',
101-
'code.filepath': 'https://example.com/path/to/script.js',
101+
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
102102
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long-animation-frame',
103103
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
104104
},

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-non-chromium/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
</head>
66
<body>
77
<div>Rendered Before Long Task</div>
8-
<script src="https://example.com/path/to/script.js"></script>
8+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
99
</body>
1010
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<button id="clickme">
99
click me to start the long animation!
1010
</button>
11-
<script src="https://example.com/path/to/script.js"></script>
11+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
1212
</body>
1313
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ sentryTest(
3535
expect(uiSpans?.length).toBeGreaterThanOrEqual(1);
3636

3737
const topLevelUISpan = (uiSpans || []).find(
38-
span => span.data?.['browser.script.invoker'] === 'https://example.com/path/to/script.js',
38+
span => span.data?.['browser.script.invoker'] === 'https://sentry-test-site.example/path/to/script.js',
3939
)!;
4040
expect(topLevelUISpan).toEqual(
4141
expect.objectContaining({
4242
op: 'ui.long-animation-frame',
4343
description: 'Main UI thread blocked',
4444
parent_span_id: eventData.contexts?.trace?.span_id,
4545
data: {
46-
'code.filepath': 'https://example.com/path/to/script.js',
46+
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
4747
'browser.script.source_char_position': 0,
48-
'browser.script.invoker': 'https://example.com/path/to/script.js',
48+
'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js',
4949
'browser.script.invoker_type': 'classic-script',
5050
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long-animation-frame',
5151
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
@@ -100,7 +100,7 @@ sentryTest(
100100
data: {
101101
'browser.script.invoker': 'BUTTON#clickme.onclick',
102102
'browser.script.invoker_type': 'event-listener',
103-
'code.filepath': 'https://example.com/path/to/script.js',
103+
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
104104
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long-animation-frame',
105105
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
106106
},

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/template.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</head>
66
<body>
77
<div>Rendered Before Long Task</div>
8-
<script src="https://example.com/path/to/script.js"></script>
98

109
<button id="myButton">Start long task</button>
1110
<h1 id="myHeading">Heading</h1>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ sentryTest(
1313
}
1414
const url = await getLocalTestUrl({ testDir: __dirname });
1515

16+
await page.route('**/path/to/script.js', route => route.fulfill({ path: `${__dirname}/assets/script.js` }));
17+
1618
await page.goto(url);
1719

1820
const navigationTransactionEventPromise = getFirstSentryEnvelopeRequest<Event>(page);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
</head>
66
<body>
77
<div>Rendered Before Long Task</div>
8-
<script src="https://example.com/path/to/script.js"></script>
8+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
99
</body>
1010
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
</head>
66
<body>
77
<div>Rendered Before Long Task</div>
8-
<script src="https://example.com/path/to/script.js"></script>
8+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
99
</body>
1010
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-no-animation-frame/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
</head>
66
<body>
77
<div>Rendered Before Long Task</div>
8-
<script src="https://example.com/path/to/script.js"></script>
8+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
99
</body>
1010
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/customTargets/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ window.Sentry = Sentry;
55
Sentry.init({
66
dsn: 'https://public@dsn.ingest.sentry.io/1337',
77
integrations: [Sentry.browserTracingIntegration()],
8-
tracePropagationTargets: ['http://example.com'],
8+
tracePropagationTargets: ['http://sentry-test-site.example'],
99
tracesSampleRate: 1,
1010
});
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
fetch('http://example.com/0').then(fetch('http://example.com/1').then(fetch('http://example.com/2')));
1+
fetch('http://sentry-test-site.example/0').then(
2+
fetch('http://sentry-test-site.example/1').then(fetch('http://sentry-test-site.example/2')),
3+
);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/customTargets/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ sentryTest(
1515
const requests = (
1616
await Promise.all([
1717
page.goto(url),
18-
Promise.all([0, 1, 2].map(idx => page.waitForRequest(`http://example.com/${idx}`))),
18+
Promise.all([0, 1, 2].map(idx => page.waitForRequest(`http://sentry-test-site.example/${idx}`))),
1919
])
2020
)[1];
2121

Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
fetch('http://example.com/0').then(fetch('http://example.com/1').then(fetch('http://example.com/2')));
1+
fetch('http://sentry-test-site.example/0').then(
2+
fetch('http://sentry-test-site.example/1').then(fetch('http://sentry-test-site.example/2')),
3+
);

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/defaultTargetsNoMatch/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ sentryTest(
1515
const requests = (
1616
await Promise.all([
1717
page.goto(url),
18-
Promise.all([0, 1, 2].map(idx => page.waitForRequest(`http://example.com/${idx}`))),
18+
Promise.all([0, 1, 2].map(idx => page.waitForRequest(`http://sentry-test-site.example/${idx}`))),
1919
])
2020
)[1];
2121

dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Sentry.init({
66
dsn: 'https://public@dsn.ingest.sentry.io/1337',
77
integrations: [Sentry.browserTracingIntegration({ instrumentNavigation: false, instrumentPageLoad: false })],
88
tracesSampleRate: 1,
9-
tracePropagationTargets: ['example.com'],
9+
tracePropagationTargets: ['sentry-test-site.example'],
1010
release: '1.1.1',
1111
});

dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/subject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ btnUpdateName.addEventListener('click', () => {
2626
});
2727

2828
btnMakeRequest.addEventListener('click', () => {
29-
fetch('https://example.com/api');
29+
fetch('https://sentry-test-site.example/api');
3030
});
3131

3232
btnCaptureError.addEventListener('click', () => {

dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
1616

1717
const url = await getLocalTestUrl({ testDir: __dirname });
1818

19+
await page.route('http://sentry-test-site.example/**/*', route => {
20+
return route.fulfill({
21+
status: 200,
22+
contentType: 'application/json',
23+
body: JSON.stringify({}),
24+
});
25+
});
26+
1927
await page.goto(url);
2028

2129
/*
@@ -168,7 +176,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
168176
});
169177

170178
async function makeRequestAndGetBaggageItems(page: Page): Promise<string[]> {
171-
const requestPromise = page.waitForRequest('https://example.com/*');
179+
const requestPromise = page.waitForRequest('https://sentry-test-site.example/*');
172180
await page.locator('#btnMakeRequest').click();
173181
const request = await requestPromise;
174182

dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</head>
66
<body>
77
<div id="content"></div>
8-
<img src="https://example.com/path/to/image.png" />
8+
<img src="https://sentry-test-site.example/path/to/image.png" />
99
<button type="button">Test button</button>
1010
</body>
1111
</html>

dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/template.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<img src="https://example.com/path/to/image.svg" />
8-
<script src="https://example.com/path/to/script.js"></script>
9-
<link href="https://example.com/path/to/style.css" type="text/css" rel="stylesheet" />
7+
<img src="https://sentry-test-site.example/path/to/image.svg" />
8+
<script src="https://sentry-test-site.example/path/to/script.js"></script>
9+
<link href="https://sentry-test-site.example/path/to/style.css" type="text/css" rel="stylesheet" />
1010
<span>Rendered</span>
1111
</body>
1212
</html>

0 commit comments

Comments
 (0)