Skip to content

Commit

Permalink
Merge branch 'getsentry:develop' into feat/graphqlClientIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
Zen-cronic authored Jan 29, 2025
2 parents 1405707 + 0963af0 commit 129a774
Show file tree
Hide file tree
Showing 161 changed files with 819 additions and 3,828 deletions.
440 changes: 4 additions & 436 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

Work in this release was contributed by @tjhiggins, @GrizliK1988, @davidturissini, @nwalters512, @aloisklink, @arturovt, @benjick, @maximepvrt, @mstrokin, @kunal-511, and @jahands. Thank you for your contributions!
Work in this release was contributed by @tjhiggins, @chris-basebone, @GrizliK1988, @davidturissini, @nwalters512, @aloisklink, @arturovt, @benjick, @maximepvrt, @mstrokin, @kunal-511, @jahands, @jrandolf and @nathankleyn. Thank you for your contributions!

## 9.0.0-alpha.0

Expand Down
3 changes: 1 addition & 2 deletions dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@
"test:loader:replay_buffer": "PW_BUNDLE=loader_replay_buffer yarn test:loader",
"test:loader:full": "PW_BUNDLE=loader_tracing_replay yarn test:loader",
"test:loader:debug": "PW_BUNDLE=loader_debug yarn test:loader",
"test:ci": "yarn test:all",
"test:update-snapshots": "yarn test:all --update-snapshots",
"test:detect-flaky": "ts-node scripts/detectFlakyTests.ts"
},
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "^1.44.1",
"@playwright/test": "~1.50.0",
"@sentry-internal/rrweb": "2.31.0",
"@sentry/browser": "9.0.0-alpha.0",
"axios": "1.7.7",
Expand Down
49 changes: 10 additions & 39 deletions dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ import * as path from 'path';
import * as glob from 'glob';

/**
* The number of browsers we run the tests in.
* Assume that each test runs for 3s.
*/
const NUM_BROWSERS = 3;

/**
* Assume that each test runs for 2s.
*/
const ASSUMED_TEST_DURATION_SECONDS = 2;
const ASSUMED_TEST_DURATION_SECONDS = 3;

/**
* We keep the runtime of the detector if possible under 30min.
Expand Down Expand Up @@ -51,22 +46,12 @@ ${changedPaths.join('\n')}
try {
await new Promise<void>((resolve, reject) => {
const cp = childProcess.spawn(
`npx playwright test ${
testPaths.length ? testPaths.join(' ') : './suites'
} --reporter='line' --repeat-each ${repeatEachCount}`,
{ shell: true, cwd },
`npx playwright test ${testPaths.length ? testPaths.join(' ') : './suites'} --repeat-each ${repeatEachCount}`,
{ shell: true, cwd, stdio: 'inherit' },
);

let error: Error | undefined;

cp.stdout.on('data', data => {
console.log(data ? (data as object).toString() : '');
});

cp.stderr.on('data', data => {
console.log(data ? (data as object).toString() : '');
});

cp.on('error', e => {
console.error(e);
error = e;
Expand Down Expand Up @@ -107,15 +92,16 @@ function getPerTestRunCount(testPaths: string[]) {
const estimatedNumberOfTests = testPaths.map(getApproximateNumberOfTests).reduce((a, b) => a + b);
console.log(`Estimated number of tests: ${estimatedNumberOfTests}`);

// tests are usually run against all browsers we test with, so let's assume this
const testRunCount = estimatedNumberOfTests * NUM_BROWSERS;
const testRunCount = estimatedNumberOfTests;
console.log(`Estimated test runs for one round: ${testRunCount}`);

const estimatedTestRuntime = testRunCount * ASSUMED_TEST_DURATION_SECONDS;
console.log(`Estimated test runtime: ${estimatedTestRuntime}s`);

const expectedPerTestRunCount = Math.floor(MAX_TARGET_TEST_RUNTIME_SECONDS / estimatedTestRuntime);
console.log(`Expected per-test run count: ${expectedPerTestRunCount}`);
console.log(
`Calculated # of repetitions: ${expectedPerTestRunCount} (min ${MIN_PER_TEST_RUN_COUNT}, max ${MAX_PER_TEST_RUN_COUNT})`,
);

return Math.min(MAX_PER_TEST_RUN_COUNT, Math.max(expectedPerTestRunCount, MIN_PER_TEST_RUN_COUNT));
}
Expand All @@ -128,22 +114,7 @@ function getTestPaths(): string[] {
cwd: path.join(__dirname, '../'),
});

return paths.map(p => path.dirname(p));
}

function logError(error: unknown) {
if (process.env.CI) {
console.log('::group::Test failed');
} else {
console.error(' ⚠️ Test failed:');
}

console.log((error as any).stdout);
console.log((error as any).stderr);

if (process.env.CI) {
console.log('::endgroup::');
}
return paths.map(p => `${path.dirname(p)}/`);
}

/**
Expand All @@ -156,7 +127,7 @@ function logError(error: unknown) {
function getApproximateNumberOfTests(testPath: string): number {
try {
const content = fs.readFileSync(path.join(process.cwd(), testPath, 'test.ts'), 'utf-8');
const matches = content.match(/it\(|test\(|sentryTest\(/g);
const matches = content.match(/sentryTest\(/g);
return Math.max(matches ? matches.length : 1, 1);
} catch (e) {
console.error(`Could not read file ${testPath}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sentryTest('should catch syntax errors', async ({ getLocalTestUrl, page, browser
expect(eventData.exception?.values).toHaveLength(1);
expect(eventData.exception?.values?.[0]).toMatchObject({
type: 'SyntaxError',
value: "Unexpected token '{'",
value: "Failed to execute 'appendChild' on 'Node': Unexpected token '{'",
mechanism: {
type: 'onerror',
handled: false,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": 1,
"id": 9,
"x": 41.810001373291016,
"y": 18.479999542236328
"y": 18.5
},
"timestamp": [timestamp]
},
Expand All @@ -26,7 +26,7 @@
"type": 0,
"id": 9,
"x": 41.810001373291016,
"y": 18.479999542236328
"y": 18.5
},
"timestamp": [timestamp]
},
Expand Down
Loading

0 comments on commit 129a774

Please sign in to comment.