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>

0 commit comments

Comments
 (0)