@playwright/test 1.34.0-alpha-may-2-2023 → 1.34.0-alpha-may-3-2023
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/worker/workerMain.js +34 -17
- package/package.json +2 -2
package/lib/worker/workerMain.js
CHANGED
|
@@ -391,18 +391,8 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
391
391
|
firstAfterHooksError = firstAfterHooksError || afterEachError;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
// Run "afterAll" hooks for suites that are not shared with the next test.
|
|
395
|
-
// In case of failure the worker will be stopped and we have to make sure that afterAll
|
|
396
|
-
// hooks run before test fixtures teardown.
|
|
397
|
-
for (const suite of reversedSuites) {
|
|
398
|
-
if (!nextSuites.has(suite) || testInfo._isFailure()) {
|
|
399
|
-
const afterAllError = await this._runAfterAllHooksForSuite(suite, testInfo);
|
|
400
|
-
firstAfterHooksError = firstAfterHooksError || afterAllError;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
394
|
// Teardown test-scoped fixtures. Attribute to 'test' so that users understand
|
|
405
|
-
// they should probably
|
|
395
|
+
// they should probably increase the test timeout to fix this issue.
|
|
406
396
|
testInfo._timeoutManager.setCurrentRunnable({
|
|
407
397
|
type: 'test',
|
|
408
398
|
slot: afterHooksSlot
|
|
@@ -411,6 +401,16 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
411
401
|
const testScopeError = await testInfo._runAndFailOnError(() => this._fixtureRunner.teardownScope('test', testInfo._timeoutManager));
|
|
412
402
|
(0, _util2.debugTest)(`tearing down test scope finished`);
|
|
413
403
|
firstAfterHooksError = firstAfterHooksError || testScopeError;
|
|
404
|
+
|
|
405
|
+
// Run "afterAll" hooks for suites that are not shared with the next test.
|
|
406
|
+
// In case of failure the worker will be stopped and we have to make sure that afterAll
|
|
407
|
+
// hooks run before worker fixtures teardown.
|
|
408
|
+
for (const suite of reversedSuites) {
|
|
409
|
+
if (!nextSuites.has(suite) || testInfo._isFailure()) {
|
|
410
|
+
const afterAllError = await this._runAfterAllHooksForSuite(suite, testInfo);
|
|
411
|
+
firstAfterHooksError = firstAfterHooksError || afterAllError;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
414
|
});
|
|
415
415
|
if (testInfo._isFailure()) this._isStopped = true;
|
|
416
416
|
if (this._isStopped) {
|
|
@@ -421,10 +421,6 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
421
421
|
// Give it more time for the full cleanup.
|
|
422
422
|
await testInfo._runWithTimeout(async () => {
|
|
423
423
|
(0, _util2.debugTest)(`running full cleanup after the failure`);
|
|
424
|
-
for (const suite of reversedSuites) {
|
|
425
|
-
const afterAllError = await this._runAfterAllHooksForSuite(suite, testInfo);
|
|
426
|
-
firstAfterHooksError = firstAfterHooksError || afterAllError;
|
|
427
|
-
}
|
|
428
424
|
const teardownSlot = {
|
|
429
425
|
timeout: this._project.project.timeout,
|
|
430
426
|
elapsed: 0
|
|
@@ -438,6 +434,11 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
438
434
|
const testScopeError = await testInfo._runAndFailOnError(() => this._fixtureRunner.teardownScope('test', testInfo._timeoutManager));
|
|
439
435
|
(0, _util2.debugTest)(`tearing down test scope finished`);
|
|
440
436
|
firstAfterHooksError = firstAfterHooksError || testScopeError;
|
|
437
|
+
for (const suite of reversedSuites) {
|
|
438
|
+
const afterAllError = await this._runAfterAllHooksForSuite(suite, testInfo);
|
|
439
|
+
firstAfterHooksError = firstAfterHooksError || afterAllError;
|
|
440
|
+
}
|
|
441
|
+
|
|
441
442
|
// Attribute to 'teardown' because worker fixtures are not perceived as a part of a test.
|
|
442
443
|
testInfo._timeoutManager.setCurrentRunnable({
|
|
443
444
|
type: 'teardown',
|
|
@@ -509,7 +510,15 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
509
510
|
category: 'hook',
|
|
510
511
|
title: `${hook.type} hook`,
|
|
511
512
|
location: hook.location
|
|
512
|
-
}, () =>
|
|
513
|
+
}, async () => {
|
|
514
|
+
try {
|
|
515
|
+
await this._fixtureRunner.resolveParametersAndRunFunction(hook.fn, testInfo, 'all-hooks-only');
|
|
516
|
+
} finally {
|
|
517
|
+
// Each beforeAll hook has its own scope for test fixtures. Attribute to the same runnable and timeSlot.
|
|
518
|
+
// Note: we must teardown even after beforeAll fails, because we'll run more beforeAlls.
|
|
519
|
+
await this._fixtureRunner.teardownScope('test', testInfo._timeoutManager);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
513
522
|
} catch (e) {
|
|
514
523
|
// Always run all the hooks, and capture the first error.
|
|
515
524
|
beforeAllError = beforeAllError || e;
|
|
@@ -540,7 +549,15 @@ class WorkerMain extends _process.ProcessRunner {
|
|
|
540
549
|
category: 'hook',
|
|
541
550
|
title: `${hook.type} hook`,
|
|
542
551
|
location: hook.location
|
|
543
|
-
}, () =>
|
|
552
|
+
}, async () => {
|
|
553
|
+
try {
|
|
554
|
+
await this._fixtureRunner.resolveParametersAndRunFunction(hook.fn, testInfo, 'all-hooks-only');
|
|
555
|
+
} finally {
|
|
556
|
+
// Each afterAll hook has its own scope for test fixtures. Attribute to the same runnable and timeSlot.
|
|
557
|
+
// Note: we must teardown even after afterAll fails, because we'll run more afterAlls.
|
|
558
|
+
await this._fixtureRunner.teardownScope('test', testInfo._timeoutManager);
|
|
559
|
+
}
|
|
560
|
+
});
|
|
544
561
|
});
|
|
545
562
|
firstError = firstError || afterAllError;
|
|
546
563
|
(0, _util2.debugTest)(`${hook.type} hook at "${(0, _util2.formatLocation)(hook.location)}" finished`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/test",
|
|
3
|
-
"version": "1.34.0-alpha-may-
|
|
3
|
+
"version": "1.34.0-alpha-may-3-2023",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": "github:Microsoft/playwright",
|
|
6
6
|
"homepage": "https://playwright.dev",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@types/node": "*",
|
|
39
|
-
"playwright-core": "1.34.0-alpha-may-
|
|
39
|
+
"playwright-core": "1.34.0-alpha-may-3-2023"
|
|
40
40
|
},
|
|
41
41
|
"optionalDependencies": {
|
|
42
42
|
"fsevents": "2.3.2"
|