Skip to content

Commit b1708d0

Browse files
authored
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 1dffbbc commit b1708d0

File tree

228 files changed

+543
-2636
lines changed

Some content is hidden

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

228 files changed

+543
-2636
lines changed

.github/workflows/canary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414

1515
CACHED_BUILD_PATHS: |
1616
${{ github.workspace }}/packages/*/*.tgz
17-
${{ github.workspace }}/dev-packages/event-proxy-server/build
17+
${{ github.workspace }}/dev-packages/test-utils/build
1818
${{ github.workspace }}/node_modules
1919
${{ github.workspace }}/packages/*/node_modules
2020
${{ github.workspace }}/dev-packages/*/node_modules

dev-packages/browser-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"dependencies": {
4242
"@babel/preset-typescript": "^7.16.7",
43-
"@playwright/test": "^1.43.1",
43+
"@playwright/test": "^1.44.1",
4444
"@sentry-internal/rrweb": "2.11.0",
4545
"@sentry/browser": "8.7.0",
4646
"axios": "1.6.7",

dev-packages/e2e-tests/test-applications/angular-17/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
"zone.js": "~0.14.3"
3030
},
3131
"devDependencies": {
32-
"@sentry-internal/event-proxy-server": "link:../../../event-proxy-server",
32+
"@playwright/test": "^1.44.1",
33+
"@sentry-internal/test-utils": "link:../../../test-utils",
3334
"@angular-devkit/build-angular": "^17.1.1",
3435
"@angular/cli": "^17.1.1",
3536
"@angular/compiler-cli": "^17.1.0",
36-
"@playwright/test": "^1.41.1",
3737
"@types/jasmine": "~5.1.0",
3838
"http-server": "^14.1.1",
3939
"jasmine-core": "~5.1.0",
@@ -42,8 +42,7 @@
4242
"karma-coverage": "~2.2.0",
4343
"karma-jasmine": "~5.1.0",
4444
"karma-jasmine-html-reporter": "~2.1.0",
45-
"typescript": "~5.3.2",
46-
"wait-port": "1.0.4"
45+
"typescript": "~5.3.2"
4746
},
4847
"volta": {
4948
"extends": "../../package.json"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
2+
3+
const config = getPlaywrightConfig({
4+
startCommand: `pnpm preview`,
5+
port: 8080,
6+
});
7+
8+
export default config;

dev-packages/e2e-tests/test-applications/angular-17/playwright.config.ts

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

dev-packages/e2e-tests/test-applications/angular-17/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { appConfig } from './app/app.config';
55
import * as Sentry from '@sentry/angular';
66

77
Sentry.init({
8+
// Cannot use process.env here, so we hardcode the DSN
89
dsn: 'https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576',
910
tracesSampleRate: 1.0,
1011
integrations: [Sentry.browserTracingIntegration({})],
1112
tunnel: `http://localhost:3031/`, // proxy server
12-
debug: true,
1313
});
1414

1515
bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err));

dev-packages/e2e-tests/test-applications/angular-17/start-event-proxy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { startEventProxyServer } from '@sentry-internal/event-proxy-server';
1+
import { startEventProxyServer } from '@sentry-internal/test-utils';
22

33
startEventProxyServer({
44
port: 3031,

dev-packages/e2e-tests/test-applications/angular-17/tests/errors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from '@playwright/test';
2-
import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server';
2+
import { waitForError, waitForTransaction } from '@sentry-internal/test-utils';
33

44
test('sends an error', async ({ page }) => {
55
const errorPromise = waitForError('angular-17', async errorEvent => {

dev-packages/e2e-tests/test-applications/angular-17/tests/performance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from '@playwright/test';
2-
import { waitForTransaction } from '@sentry-internal/event-proxy-server';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
33
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
44

55
test('sends a pageload transaction with a parameterized URL', async ({ page }) => {

dev-packages/e2e-tests/test-applications/angular-18/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
"zone.js": "~0.14.3"
3030
},
3131
"devDependencies": {
32-
"@sentry-internal/event-proxy-server": "link:../../../event-proxy-server",
32+
"@playwright/test": "^1.44.1",
33+
"@sentry-internal/test-utils": "link:../../../test-utils",
3334
"@angular-devkit/build-angular": "^18.0.0",
3435
"@angular/cli": "^18.0.0",
3536
"@angular/compiler-cli": "^18.0.0",
36-
"@playwright/test": "^1.41.1",
3737
"@types/jasmine": "~5.1.0",
3838
"http-server": "^14.1.1",
3939
"jasmine-core": "~5.1.0",
@@ -42,8 +42,7 @@
4242
"karma-coverage": "~2.2.0",
4343
"karma-jasmine": "~5.1.0",
4444
"karma-jasmine-html-reporter": "~2.1.0",
45-
"typescript": "~5.4.5",
46-
"wait-port": "1.0.4"
45+
"typescript": "~5.4.5"
4746
},
4847
"volta": {
4948
"extends": "../../package.json"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
2+
3+
const config = getPlaywrightConfig({
4+
startCommand: `pnpm preview`,
5+
port: 8080,
6+
});
7+
8+
export default config;

dev-packages/e2e-tests/test-applications/angular-18/playwright.config.ts

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

dev-packages/e2e-tests/test-applications/angular-18/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { appConfig } from './app/app.config';
55
import * as Sentry from '@sentry/angular';
66

77
Sentry.init({
8+
// Cannot use process.env here, so we hardcode the DSN
89
dsn: 'https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576',
910
tracesSampleRate: 1.0,
1011
integrations: [Sentry.browserTracingIntegration({})],
1112
tunnel: `http://localhost:3031/`, // proxy server
12-
debug: true,
1313
});
1414

1515
bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err));

dev-packages/e2e-tests/test-applications/angular-18/start-event-proxy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { startEventProxyServer } from '@sentry-internal/event-proxy-server';
1+
import { startEventProxyServer } from '@sentry-internal/test-utils';
22

33
startEventProxyServer({
44
port: 3031,

dev-packages/e2e-tests/test-applications/angular-18/tests/errors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from '@playwright/test';
2-
import { waitForError, waitForTransaction } from '@sentry-internal/event-proxy-server';
2+
import { waitForError, waitForTransaction } from '@sentry-internal/test-utils';
33

44
test('sends an error', async ({ page }) => {
55
const errorPromise = waitForError('angular-18', async errorEvent => {

dev-packages/e2e-tests/test-applications/angular-18/tests/performance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from '@playwright/test';
2-
import { waitForTransaction } from '@sentry-internal/event-proxy-server';
2+
import { waitForTransaction } from '@sentry-internal/test-utils';
33
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
44

55
test('sends a pageload transaction with a parameterized URL', async ({ page }) => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"typescript": "4.9.5"
2424
},
2525
"devDependencies": {
26-
"@playwright/test": "^1.27.1"
26+
"@playwright/test": "^1.44.1"
2727
},
2828
"volta": {
2929
"extends": "../../package.json"

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"react-dom": "^18.2.0"
2626
},
2727
"devDependencies": {
28-
"@sentry-internal/event-proxy-server": "link:../../../event-proxy-server",
29-
"@playwright/test": "^1.36.2",
28+
"@playwright/test": "^1.44.1",
29+
"@sentry-internal/test-utils": "link:../../../test-utils",
3030
"@remix-run/dev": "^2.7.2",
3131
"@sentry/types": "latest || *",
3232
"@sentry/utils": "latest || *",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
2+
3+
const config = getPlaywrightConfig({
4+
startCommand: `pnpm dev`,
5+
});
6+
7+
export default config;

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/playwright.config.ts

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

dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/start-event-proxy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { startEventProxyServer } from '@sentry-internal/event-proxy-server';
1+
import { startEventProxyServer } from '@sentry-internal/test-utils';
22

33
startEventProxyServer({
44
port: 3031,

0 commit comments

Comments
 (0)