Skip to content

Commit 2a5733b

Browse files
committed
Merge branch 'lforst-standard-react-application-behaviour-e2e-test' into lforst-standard-react-application-transaction-session-tests
2 parents 34501b1 + cb00525 commit 2a5733b

File tree

11 files changed

+48
-125
lines changed

11 files changed

+48
-125
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ jobs:
643643
env:
644644
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ env.DEFAULT_NODE_VERSION }}
645645
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
646+
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
646647
run: |
647648
cd packages/e2e-tests
648649
yarn test:e2e

packages/e2e-tests/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
E2E_TEST_AUTH_TOKEN=
2+
E2E_TEST_DSN=

packages/e2e-tests/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
auth-token.json
1+
.env

packages/e2e-tests/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
"lint": "run-s lint:prettier lint:eslint",
1414
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
1515
"lint:prettier": "prettier --config ../../.prettierrc.json --check .",
16-
"test:e2e": "run-s test:validate-configuration test:validate-test-app-setups test:validate-auth-token test:run",
16+
"test:e2e": "run-s test:validate-configuration test:validate-test-app-setups test:run",
1717
"test:run": "ts-node run.ts",
1818
"test:validate-configuration": "ts-node validate-verdaccio-configuration.ts",
19-
"test:validate-test-app-setups": "ts-node validate-test-app-setups.ts",
20-
"test:validate-auth-token": "ts-node validate-auth-token.ts"
19+
"test:validate-test-app-setups": "ts-node validate-test-app-setups.ts"
2120
},
2221
"devDependencies": {
2322
"@types/glob": "8.0.0",

packages/e2e-tests/run.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@ const PUBLISH_PACKAGES_DOCKER_IMAGE_NAME = 'publish-packages';
1313

1414
const publishScriptNodeVersion = process.env.E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION;
1515

16-
const DEFAULT_BUILD_TIMEOUT_SECONDS = 60;
16+
const DEFAULT_BUILD_TIMEOUT_SECONDS = 60 * 5;
1717
const DEFAULT_TEST_TIMEOUT_SECONDS = 60;
1818

19-
let authToken = process.env.E2E_TEST_AUTH_TOKEN;
19+
if (!process.env.E2E_TEST_AUTH_TOKEN) {
20+
console.log(
21+
"No auth token configured! Please configure the E2E_TEST_AUTH_TOKEN environment variable with an auth token that has the scope 'project:read'!",
22+
);
23+
}
2024

21-
try {
22-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-var-requires
23-
authToken = require(path.resolve(__dirname, 'auth-token.json')).authToken;
24-
} catch (e) {
25-
console.log('Failed to parse auth-token.json');
25+
if (!process.env.E2E_TEST_DSN) {
26+
console.log('No DSN configured! Please configure the E2E_TEST_DSN environment variable with a DSN!');
2627
}
2728

28-
if (!authToken) {
29-
console.log('No auth token configured!');
29+
if (!process.env.E2E_TEST_AUTH_TOKEN || !process.env.E2E_TEST_DSN) {
3030
process.exit(1);
3131
}
3232

33+
const envVarsToInject = {
34+
REACT_APP_E2E_TEST_DSN: process.env.E2E_TEST_DSN,
35+
};
36+
3337
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines
3438
function groupCIOutput(groupTitle: string, fn: () => void): void {
3539
if (process.env.CI) {
@@ -159,13 +163,32 @@ const recipeResults: RecipeResult[] = recipePaths.map(recipePath => {
159163
encoding: 'utf8',
160164
shell: true, // needed so we can pass the build command in as whole without splitting it up into args
161165
timeout: (recipe.buildTimeoutSeconds ?? DEFAULT_BUILD_TIMEOUT_SECONDS) * 1000,
166+
env: {
167+
...process.env,
168+
...envVarsToInject,
169+
},
162170
});
163171

164172
// Prepends some text to the output build command's output so we can distinguish it from logging in this script
165173
console.log(buildCommandProcess.stdout.replace(/^/gm, '[BUILD OUTPUT] '));
166174
console.log(buildCommandProcess.stderr.replace(/^/gm, '[BUILD OUTPUT] '));
167175

168-
if (buildCommandProcess.status !== 0) {
176+
const error: undefined | (Error & { code?: string }) = buildCommandProcess.error;
177+
178+
if (error?.code === 'ETIMEDOUT') {
179+
processShouldExitWithError = true;
180+
181+
printCIErrorMessage(
182+
`Build command in test application "${recipe.testApplicationName}" (${path.dirname(recipePath)}) timed out!`,
183+
);
184+
185+
return {
186+
testApplicationName: recipe.testApplicationName,
187+
testApplicationPath: recipePath,
188+
buildFailed: true,
189+
testResults: [],
190+
};
191+
} else if (buildCommandProcess.status !== 0) {
169192
processShouldExitWithError = true;
170193

171194
printCIErrorMessage(
@@ -190,11 +213,11 @@ const recipeResults: RecipeResult[] = recipePaths.map(recipePath => {
190213
cwd: path.dirname(recipePath),
191214
timeout: (test.timeoutSeconds ?? DEFAULT_TEST_TIMEOUT_SECONDS) * 1000,
192215
encoding: 'utf8',
216+
shell: true, // needed so we can pass the test command in as whole without splitting it up into args
193217
env: {
194218
...process.env,
195-
E2E_TEST_AUTH_TOKEN: authToken,
219+
...envVarsToInject,
196220
},
197-
shell: true, // needed so we can pass the test command in as whole without splitting it up into args
198221
});
199222

200223
// Prepends some text to the output test command's output so we can distinguish it from logging in this script

packages/e2e-tests/test-applications/standard-frontend-react/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
2424

25-
!*.d.ts
2625
/test-results/
2726
/playwright-report/
2827
/playwright/.cache/
28+
29+
!*.d.ts

packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import Index from './pages/Index';
1515
import User from './pages/User';
1616

1717
Sentry.init({
18-
// DSN belongs to "e2e-javascript-standard-frontend-react" project in "sentry-sdks" org
19-
dsn: 'https://[email protected]/4503941750587392',
18+
dsn: process.env.REACT_APP_E2E_TEST_DSN,
2019
integrations: [
2120
new BrowserTracing({
2221
routingInstrumentation: Sentry.reactRouterV6Instrumentation(

packages/e2e-tests/test-applications/standard-frontend-react/test-recipe.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "../../test-recipe-schema.json",
33
"testApplicationName": "standard-frontend-react",
4-
"buildCommand": "yarn install && yarn build",
4+
"buildCommand": "yarn install --pure-lockfile && npx playwright install && yarn build",
55
"tests": [
66
{
77
"testName": "Playwright tests",

packages/e2e-tests/test-applications/standard-frontend-react/tests/behaviour-test.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';
22
import axios, { AxiosError } from 'axios';
33

44
const SENTRY_TEST_ORG_SLUG = 'sentry-sdks';
5-
const SENTRY_TEST_PROJECT = 'e2e-javascript-standard-frontend-react';
5+
const SENTRY_TEST_PROJECT = 'sentry-javascript-e2e-tests';
66

77
const EVENT_POLLING_TIMEOUT = 45000;
88
const EVENT_POLLING_RETRY_INTERVAL = 1000;

packages/e2e-tests/test-applications/standard-frontend-react/yarn.lock

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,69 +1630,6 @@
16301630
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.2.0.tgz#8be36a1f66f3265389e90b5f9c9962146758f728"
16311631
integrity sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==
16321632

1633-
1634-
version "7.14.0"
1635-
resolved "http://localhost:4873/@sentry%2fbrowser/-/browser-7.14.0.tgz#bc2c6934f9270e1287ae1437b63e4b0edd67a9f0"
1636-
integrity sha512-AdLmqeOXvCVYgJAgMUUby+TRh+yIeZO16NPpZWQPGggXIjnhSzoN4liyXJvQ7Mhm326GboFUKjQwqpCEviQcyg==
1637-
dependencies:
1638-
"@sentry/core" "7.14.0"
1639-
"@sentry/types" "7.14.0"
1640-
"@sentry/utils" "7.14.0"
1641-
tslib "^1.9.3"
1642-
1643-
1644-
version "7.14.0"
1645-
resolved "http://localhost:4873/@sentry%2fcore/-/core-7.14.0.tgz#89178822de75c6023e1718c29bee8d588687cedd"
1646-
integrity sha512-Hgn7De6CiCFnz868/Lrtei+9rj7/TIwhbDe3J+NeH+2ffXYn4VI8FxrlR/p2XfIq9iCfmG80EQXDtSh+Kh7mOw==
1647-
dependencies:
1648-
"@sentry/hub" "7.14.0"
1649-
"@sentry/types" "7.14.0"
1650-
"@sentry/utils" "7.14.0"
1651-
tslib "^1.9.3"
1652-
1653-
1654-
version "7.14.0"
1655-
resolved "http://localhost:4873/@sentry%2fhub/-/hub-7.14.0.tgz#cf8e8a345c63a75ea1f3a2d7169a47ab73ff9603"
1656-
integrity sha512-O+pxsipeiURC6Mxuivz1pX3yHlkQCI2yjP38bISxUZv1NIijHuxiDmgqrrcCJltiIfyY2+f9LAezKVCAXnPFuw==
1657-
dependencies:
1658-
"@sentry/types" "7.14.0"
1659-
"@sentry/utils" "7.14.0"
1660-
tslib "^1.9.3"
1661-
1662-
"@sentry/react@*":
1663-
version "7.14.0"
1664-
resolved "http://localhost:4873/@sentry%2freact/-/react-7.14.0.tgz#62149de131ebac1d28a672a290c53a24d8de365a"
1665-
integrity sha512-IXO004UN3DGdd3Cz9nY2MrlyMMMrGz0uTJrkavbqjC/tLfcxB6iWNLkUueRCla6EzwFbuHRheJlK0EO/Qel2pQ==
1666-
dependencies:
1667-
"@sentry/browser" "7.14.0"
1668-
"@sentry/types" "7.14.0"
1669-
"@sentry/utils" "7.14.0"
1670-
hoist-non-react-statics "^3.3.2"
1671-
tslib "^1.9.3"
1672-
1673-
"@sentry/tracing@*":
1674-
version "7.14.0"
1675-
resolved "http://localhost:4873/@sentry%2ftracing/-/tracing-7.14.0.tgz#2660be14502b1b7f73d61c2a0273abf52a06771e"
1676-
integrity sha512-dBQUHOHV9Qed/RzqGwJV/zaNHGZb2IKZl8lXno5p4YwOsGWnfs+54Bgqic0OqvOB5oJ/9Ye7nyGJqN7bbLff7A==
1677-
dependencies:
1678-
"@sentry/hub" "7.14.0"
1679-
"@sentry/types" "7.14.0"
1680-
"@sentry/utils" "7.14.0"
1681-
tslib "^1.9.3"
1682-
1683-
1684-
version "7.14.0"
1685-
resolved "http://localhost:4873/@sentry%2ftypes/-/types-7.14.0.tgz#8069e58a0104190e328647963036c7597e2e5fa8"
1686-
integrity sha512-9iFZS9Hr5hAoL+M9oUH2dY9burOaQh+CHGH66fortuTp++YDWKdbPEeKcz8hRJaUyBBn53rdxiBmAyHsrlE6KA==
1687-
1688-
1689-
version "7.14.0"
1690-
resolved "http://localhost:4873/@sentry%2futils/-/utils-7.14.0.tgz#477e3bf90b3ad75133645502db6162ffb1c949d1"
1691-
integrity sha512-QmogvExurgOF9jz95ibkiWdLrJoKq9LvozOPjr6ntL4mBKGxXChagfyrbWQ1cs6Z3QgExNIhCJU465Wmfcrqvg==
1692-
dependencies:
1693-
"@sentry/types" "7.14.0"
1694-
tslib "^1.9.3"
1695-
16961633
"@sinclair/typebox@^0.24.1":
16971634
version "0.24.44"
16981635
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.44.tgz#0a0aa3bf4a155a678418527342a3ee84bd8caa5c"
@@ -4908,13 +4845,6 @@ he@^1.2.0:
49084845
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
49094846
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
49104847

4911-
hoist-non-react-statics@^3.3.2:
4912-
version "3.3.2"
4913-
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
4914-
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
4915-
dependencies:
4916-
react-is "^16.7.0"
4917-
49184848
hoopy@^0.1.4:
49194849
version "0.1.4"
49204850
resolved "https://registry.yarnpkg.com/hoopy/-/hoopy-0.1.4.tgz#609207d661100033a9a9402ad3dea677381c1b1d"
@@ -7591,7 +7521,7 @@ react-error-overlay@^6.0.11:
75917521
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
75927522
integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==
75937523

7594-
react-is@^16.13.1, react-is@^16.7.0:
7524+
react-is@^16.13.1:
75957525
version "16.13.1"
75967526
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
75977527
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
@@ -8726,7 +8656,7 @@ tsconfig-paths@^3.14.1:
87268656
minimist "^1.2.6"
87278657
strip-bom "^3.0.0"
87288658

8729-
tslib@^1.8.1, tslib@^1.9.3:
8659+
tslib@^1.8.1:
87308660
version "1.14.1"
87318661
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
87328662
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

packages/e2e-tests/validate-auth-token.ts

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

0 commit comments

Comments
 (0)