Skip to content

Commit d85c3ef

Browse files
mydeac298lee
authored andcommitted
test: Refactor utils into @sentry-internal/test-utils (#12277)
Re-use this for playwright config in E2E tests. Now, instead of repeating the whole playwright config, we can import the util from `@sentry-internal/test-utils` and pass it some config. I left the places where do not yet use the proxy, because for simplicity I built the util in a way that assumes the proxy (you can override it, but I figured not worth it for stuff that we will refactor soon anyhow). While at it, I also streamlined the playwright version used everywhere to an up-to-date version.
1 parent ea8f193 commit d85c3ef

File tree

7 files changed

+35
-86
lines changed

7 files changed

+35
-86
lines changed

dev-packages/e2e-tests/test-applications/aws-lambda-layer-cjs/playwright.config.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

dev-packages/e2e-tests/test-applications/create-next-app/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"typescript": "4.9.5"
2424
},
2525
"devDependencies": {
26-
"@playwright/test": "^1.44.1",
27-
"@sentry-internal/test-utils": "link:../../../test-utils"
26+
"@playwright/test": "^1.44.1"
2827
},
2928
"volta": {
3029
"extends": "../../package.json"

dev-packages/e2e-tests/test-applications/react-router-6/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
},
4343
"devDependencies": {
4444
"@playwright/test": "^1.44.1",
45-
"@sentry-internal/test-utils": "link:../../../test-utils",
4645
"serve": "14.0.1"
4746
},
4847
"volta": {

dev-packages/e2e-tests/test-applications/react-router-6/src/index.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,21 @@ Sentry.init({
3636
// Always capture replays, so we can test this properly
3737
replaysSessionSampleRate: 1.0,
3838
replaysOnErrorSampleRate: 0.0,
39+
});
40+
41+
Sentry.addEventProcessor(event => {
42+
if (
43+
event.type === 'transaction' &&
44+
(event.contexts?.trace?.op === 'pageload' || event.contexts?.trace?.op === 'navigation')
45+
) {
46+
const eventId = event.event_id;
47+
if (eventId) {
48+
window.recordedTransactions = window.recordedTransactions || [];
49+
window.recordedTransactions.push(eventId);
50+
}
51+
}
3952

40-
tunnel: 'http://localhost:3031',
53+
return event;
4154
});
4255

4356
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);

dev-packages/e2e-tests/test-applications/webpack-4/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"devDependencies": {
1111
"@playwright/test": "^1.44.1",
12-
"@sentry-internal/test-utils": "link:../../../test-utils",
1312
"@sentry/browser": "latest || *",
1413
"webpack": "^4.47.0",
1514
"terser-webpack-plugin": "^4.2.3",

dev-packages/e2e-tests/test-applications/webpack-5/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"devDependencies": {
1111
"@playwright/test": "^1.44.1",
12-
"@sentry-internal/test-utils": "link:../../../test-utils",
1312
"@sentry/browser": "latest || *",
1413
"webpack": "^5.91.0",
1514
"terser-webpack-plugin": "^5.3.10",

yarn.lock

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6644,12 +6644,17 @@
66446644
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
66456645
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
66466646

6647+
"@playwright/test@^1.44.1":
6648+
version "1.44.1"
6649+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.1.tgz#cc874ec31342479ad99838040e99b5f604299bcb"
6650+
integrity sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q==
66476651
"@playwright/test@^1.44.1":
66486652
version "1.44.1"
66496653
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.1.tgz#cc874ec31342479ad99838040e99b5f604299bcb"
66506654
integrity sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q==
66516655
dependencies:
66526656
playwright "1.44.1"
6657+
playwright "1.44.1"
66536658

66546659
"@polka/url@^1.0.0-next.20":
66556660
version "1.0.0-next.21"
@@ -25104,7 +25109,12 @@ [email protected], playwright-core@^1.44.1:
2510425109
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.1.tgz#53ec975503b763af6fc1a7aa995f34bc09ff447c"
2510525110
integrity sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA==
2510625111

25107-
[email protected], playwright@^1.44.1:
25112+
25113+
version "1.44.1"
25114+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.1.tgz#53ec975503b763af6fc1a7aa995f34bc09ff447c"
25115+
integrity sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA==
25116+
25117+
2510825118
version "1.44.1"
2510925119
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.44.1.tgz#5634369d777111c1eea9180430b7a184028e7892"
2511025120
integrity sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg==
@@ -25113,6 +25123,15 @@ [email protected], playwright@^1.44.1:
2511325123
optionalDependencies:
2511425124
fsevents "2.3.2"
2511525125

25126+
playwright@^1.31.1:
25127+
version "1.40.1"
25128+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.40.1.tgz#a11bf8dca15be5a194851dbbf3df235b9f53d7ae"
25129+
integrity sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==
25130+
dependencies:
25131+
playwright-core "1.40.1"
25132+
optionalDependencies:
25133+
fsevents "2.3.2"
25134+
2511625135
pluralize@^8.0.0:
2511725136
version "8.0.0"
2511825137
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"

0 commit comments

Comments
 (0)