Skip to content

Commit 77ce28a

Browse files
authored
test(remix): Update remix E2E tests to avoid sending to Sentry (#12750)
Part of #11910 These are the last (non-optional) tests we have that still sent data to Sentry! After that, E2E tests should be completely independent. This also blocks #12743
1 parent 993acd4 commit 77ce28a

Some content is hidden

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

51 files changed

+665
-1591
lines changed

dev-packages/e2e-tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ test apps enables us to reuse the same test suite over a number of different fra
9090

9191
### Standardized Frontend Test Apps
9292

93+
TODO: This is not up to date.
94+
9395
A standardized frontend test application has the following features:
9496

9597
- Just for the sake of consistency we prefix the standardized frontend tests with `standard-frontend-`. For example

dev-packages/e2e-tests/test-applications/create-next-app/tests/server-transactions.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { expect, test } from '@playwright/test';
22
import { waitForTransaction } from '@sentry-internal/test-utils';
33

4-
const authToken = process.env.E2E_TEST_AUTH_TOKEN;
5-
const sentryTestOrgSlug = process.env.E2E_TEST_SENTRY_ORG_SLUG;
6-
const sentryTestProject = process.env.E2E_TEST_SENTRY_PROJECT;
7-
const EVENT_POLLING_TIMEOUT = 90_000;
8-
94
test('Sends server-side transactions to Sentry', async ({ baseURL }) => {
105
const transactionEventPromise = waitForTransaction('create-next-app', transactionEvent => {
116
return (

dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/app/entry.client.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ Sentry.init({
2121
tunnel: 'http://localhost:3031/', // proxy server
2222
});
2323

24-
Sentry.addEventProcessor(event => {
25-
if (
26-
event.type === 'transaction' &&
27-
(event.contexts?.trace?.op === 'pageload' || event.contexts?.trace?.op === 'navigation')
28-
) {
29-
const eventId = event.event_id;
30-
if (eventId) {
31-
window.recordedTransactions = window.recordedTransactions || [];
32-
window.recordedTransactions.push(eventId);
33-
}
34-
}
35-
36-
return event;
37-
});
38-
3924
startTransition(() => {
4025
hydrateRoot(
4126
document,

dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/app/routes/_index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export default function Index() {
1717
value="Capture Exception"
1818
id="exception-button"
1919
onClick={() => {
20-
const eventId = Sentry.captureException(new Error('I am an error!'));
21-
window.capturedExceptionId = eventId;
20+
throw new Error('I am an error!');
2221
}}
2322
/>
2423
<Link to="/user/5" id="navigation">

dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/server.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ app.all(
4848
}),
4949
);
5050

51-
const port = process.env.PORT || 3000;
51+
const port = process.env.PORT || 3030;
5252
app.listen(port, () => console.log(`Express server listening at http://localhost:${port}`));

dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/tests/behaviour-client.test.ts

Lines changed: 0 additions & 192 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForError } from '@sentry-internal/test-utils';
3+
4+
test('Sends a client-side exception to Sentry', async ({ page }) => {
5+
const errorPromise = waitForError('create-remix-app-express-legacy', errorEvent => {
6+
return errorEvent.exception?.values?.[0].value === 'I am an error!';
7+
});
8+
9+
await page.goto('/');
10+
11+
const exceptionButton = page.locator('id=exception-button');
12+
await exceptionButton.click();
13+
14+
const errorEvent = await errorPromise;
15+
16+
expect(errorEvent).toBeDefined();
17+
});
18+
19+
test('Sends a client-side ErrorBoundary exception to Sentry', async ({ page }) => {
20+
const errorPromise = waitForError('create-remix-app-express-legacy', errorEvent => {
21+
return errorEvent.exception?.values?.[0].value === 'Sentry React Component Error';
22+
});
23+
24+
await page.goto('/client-error');
25+
26+
const errorEvent = await errorPromise;
27+
28+
expect(errorEvent).toBeDefined();
29+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
3+
4+
test('Sends a pageload transaction to Sentry', async ({ page }) => {
5+
const transactionPromise = waitForTransaction('create-remix-app-express-legacy', transactionEvent => {
6+
return transactionEvent.contexts?.trace?.op === 'pageload' && transactionEvent.transaction === 'routes/_index';
7+
});
8+
9+
await page.goto('/');
10+
11+
const transactionEvent = await transactionPromise;
12+
13+
expect(transactionEvent).toBeDefined();
14+
});
15+
16+
test('Sends a navigation transaction to Sentry', async ({ page }) => {
17+
const transactionPromise = waitForTransaction('create-remix-app-express-legacy', transactionEvent => {
18+
return transactionEvent.contexts?.trace?.op === 'navigation' && transactionEvent.transaction === 'routes/user.$id';
19+
});
20+
21+
await page.goto('/');
22+
23+
const linkElement = page.locator('id=navigation');
24+
await linkElement.click();
25+
26+
const transactionEvent = await transactionPromise;
27+
28+
expect(transactionEvent).toBeDefined();
29+
});
30+
31+
test('Renders `sentry-trace` and `baggage` meta tags for the root route', async ({ page }) => {
32+
await page.goto('/');
33+
34+
const sentryTraceMetaTag = await page.waitForSelector('meta[name="sentry-trace"]', {
35+
state: 'attached',
36+
});
37+
const baggageMetaTag = await page.waitForSelector('meta[name="baggage"]', {
38+
state: 'attached',
39+
});
40+
41+
expect(sentryTraceMetaTag).toBeTruthy();
42+
expect(baggageMetaTag).toBeTruthy();
43+
});
44+
45+
test('Renders `sentry-trace` and `baggage` meta tags for a sub-route', async ({ page }) => {
46+
await page.goto('/user/123');
47+
48+
const sentryTraceMetaTag = await page.waitForSelector('meta[name="sentry-trace"]', {
49+
state: 'attached',
50+
});
51+
const baggageMetaTag = await page.waitForSelector('meta[name="baggage"]', {
52+
state: 'attached',
53+
});
54+
55+
expect(sentryTraceMetaTag).toBeTruthy();
56+
expect(baggageMetaTag).toBeTruthy();
57+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { expect, test } from '@playwright/test';
2+
import { waitForError } from '@sentry-internal/test-utils';
3+
4+
test('Sends a loader error to Sentry', async ({ page }) => {
5+
const loaderErrorPromise = waitForError('create-remix-app-express-legacy', errorEvent => {
6+
return errorEvent.exception.values[0].value === 'Loader Error';
7+
});
8+
9+
await page.goto('/loader-error');
10+
11+
const loaderError = await loaderErrorPromise;
12+
13+
expect(loaderError).toBeDefined();
14+
});

0 commit comments

Comments
 (0)