-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changes from all commits
5d910a8
f29ffed
ca2cdfb
96ca4fd
f4b07f1
a7d87d6
8001258
a74f633
3889554
7aa9685
6cc0402
01bf194
aaac579
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -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; | ||
|
@@ -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)); | ||
} | ||
|
@@ -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)}/`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was a bit buggy - e.g. if one dirname was |
||
} | ||
|
||
/** | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we always use |
||
return Math.max(matches ? matches.length : 1, 1); | ||
} catch (e) { | ||
console.error(`Could not read file ${testPath}`); | ||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was not used