Skip to content

chore(deps): Update playwright to 1.50.0 #15164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ jobs:
env:
PW_BUNDLE: ${{ matrix.bundle }}
working-directory: dev-packages/browser-integration-tests
run: yarn test:ci${{ matrix.project && format(' --project={0}', matrix.project) || '' }}${{ matrix.shard && format(' --shard={0}/{1}', matrix.shard, matrix.shards) || '' }}
run: yarn test:all${{ matrix.project && format(' --project={0}', matrix.project) || '' }}${{ matrix.shard && format(' --shard={0}/{1}', matrix.shard, matrix.shards) || '' }}

- name: Upload Playwright Traces
uses: actions/upload-artifact@v4
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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was not used

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)}/`);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a bit buggy - e.g. if one dirname was suites/tracing/metrics/web-vitals/test.ts, it would have made it to suites/tracing/metrics/web-vitals, which then in turn also matches e.g. web-vitals-cls etc. dirs. Now, it should be stricter in that regard.

}

/**
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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always use sentryTest, so no need to check others here IMHO

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
Loading