Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: remove old recovery, recover from expect errors (#37131)

Pavel Feldman82b1cfd3efe9
diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.ts
index 31adda7d17..26bc4bab7a 100644
--- a/packages/playwright-core/src/client/channelOwner.ts
+++ b/packages/playwright-core/src/client/channelOwner.ts
@@ -201,12 +201,9 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel
if (!options?.internal) {
const recoveryHandlers: RecoverFromApiErrorHandler[] = [];
apiZone.error = e;
- this._instrumentation.onApiCallRecovery(apiZone, e, recoveryHandlers);
- for (const handler of recoveryHandlers) {
- const recoverResult = await handler();
- if (recoverResult.status === 'recovered')
- return recoverResult.value as R;
- }
+ this._instrumentation.onApiCallRecovery(apiZone, e, this, recoveryHandlers);
+ for (const handler of recoveryHandlers)
+ await handler();
logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);
this._instrumentation.onApiCallEnd(apiZone);
}
diff --git a/packages/playwright-core/src/client/clientInstrumentation.ts b/packages/playwright-core/src/client/clientInstrumentation.ts
index 968e3d9810..a049668ea0 100644
--- a/packages/playwright-core/src/client/clientInstrumentation.ts
+++ b/packages/playwright-core/src/client/clientInstrumentation.ts
@@ -15,6 +15,7 @@
*/
import type { BrowserContext } from './browserContext';
+import type { ChannelOwner } from './channelOwner';
import type { APIRequestContext } from './fetch';
import type { StackFrame } from '@protocol/channels';
@@ -28,19 +29,14 @@ export interface ApiCallData {
error?: Error;
}
-export type RecoverFromApiErrorResult = {
- status: 'recovered' | 'failed';
- value?: string | number | boolean | undefined;
-};
-
-export type RecoverFromApiErrorHandler = () => Promise<RecoverFromApiErrorResult>;
+export type RecoverFromApiErrorHandler = () => Promise<void>;
export interface ClientInstrumentation {
addListener(listener: ClientInstrumentationListener): void;
removeListener(listener: ClientInstrumentationListener): void;
removeAllListeners(): void;
onApiCallBegin(apiCall: ApiCallData, channel: { type: string, method: string, params?: Record<string, any> }): void;
- onApiCallRecovery(apiCall: ApiCallData, error: Error, recoveryHandlers: RecoverFromApiErrorHandler[]): void;
+ onApiCallRecovery(apiCall: ApiCallData, error: Error, channelOwner: ChannelOwner, recoveryHandlers: RecoverFromApiErrorHandler[]): void;
onApiCallEnd(apiCall: ApiCallData): void;
onWillPause(options: { keepTestTimeout: boolean }): void;
@@ -52,7 +48,7 @@ export interface ClientInstrumentation {
export interface ClientInstrumentationListener {
onApiCallBegin?(apiCall: ApiCallData, channel: { type: string, method: string, params?: Record<string, any> }): void;
- onApiCallRecovery?(apiCall: ApiCallData, error: Error, recoveryHandlers: RecoverFromApiErrorHandler[]): void;
+ onApiCallRecovery?(apiCall: ApiCallData, error: Error, channelOwner: ChannelOwner, recoveryHandlers: RecoverFromApiErrorHandler[]): void;
onApiCallEnd?(apiCall: ApiCallData): void;
onWillPause?(options: { keepTestTimeout: boolean }): void;
diff --git a/packages/playwright/src/common/ipc.ts b/packages/playwright/src/common/ipc.ts
index e4645d1c69..806aed0532 100644
--- a/packages/playwright/src/common/ipc.ts
+++ b/packages/playwright/src/common/ipc.ts
@@ -21,7 +21,6 @@ import { serializeCompilationCache } from '../transform/compilationCache';
import type { ConfigLocation, FullConfigInternal } from './config';
import type { ReporterDescription, TestInfoError, TestStatus } from '../../types/test';
import type { SerializedCompilationCache } from '../transform/compilationCache';
-import type { RecoverFromStepErrorResult } from '@testIsomorphic/testServerInterface';
export type ConfigCLIOverrides = {
debug?: boolean;
@@ -67,7 +66,6 @@ export type WorkerInitParams = {
projectId: string;
config: SerializedConfig;
artifactsDir: string;
- recoverFromStepErrors: boolean;
};
export type TestBeginPayload = {
@@ -107,14 +105,6 @@ export type StepBeginPayload = {
location?: { file: string, line: number, column: number };
};
-export type StepRecoverFromErrorPayload = {
- testId: string;
- stepId: string;
- error: TestInfoErrorImpl;
-};
-
-export type ResumeAfterStepErrorPayload = RecoverFromStepErrorResult;
-
export type StepEndPayload = {
testId: string;
stepId: string;
diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts
index ef94853fc0..d8fed58ca4 100644
--- a/packages/playwright/src/index.ts
+++ b/packages/playwright/src/index.ts
@@ -22,8 +22,7 @@ import { setBoxedStackPrefixes, createGuid, currentZone, debugMode, jsonStringif
import { currentTestInfo } from './common/globals';
import { rootTestType } from './common/testType';
-import { BrowserBackend } from './mcp/browser/backend';
-import { runOnPauseBackendLoop } from './mcp/sdk/mdb';
+import { runBrowserBackendOnError } from './mcp/browser/backend';
import { codeFrameColumns } from './transform/babelBundle';
import { stripAnsiEscapes } from './util';
@@ -37,6 +36,7 @@ import type { BrowserContext as BrowserContextImpl } from '../../playwright-core
import type { APIRequestContext as APIRequestContextImpl } from '../../playwright-core/src/client/fetch';
import type { ChannelOwner } from '../../playwright-core/src/client/channelOwner';
import type { Page as PageImpl } from '../../playwright-core/src/client/page';
+import type { Frame as FrameImpl } from '../../playwright-core/src/client/frame';
import type { BrowserContext, BrowserContextOptions, LaunchOptions, Page, Tracing } from 'playwright-core';
export { expect } from './matchers/expect';
@@ -290,24 +290,21 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
if (data.apiName === 'tracing.group')
tracingGroupSteps.push(step);
},
- onApiCallRecovery: (data, error, recoveryHandlers) => {
- if (!process.env.PLAYWRIGHT_TEST_DEBUGGER_MCP)
- return;
-
+ onApiCallRecovery: (data, error, channelOwner, recoveryHandlers) => {
const step = data.userData;
if (!step)
return;
-
- const code = createErrorCodeframe(error.message, step.location);
-
+ const page = channelToPage(channelOwner);
+ if (!page)
+ return;
recoveryHandlers.push(async () => {
- const [context] = playwright._allContexts();
- const introMessage = `Paused on error:\n\n${stripAnsiEscapes(code)}\n\nTry recovering from the error prior to continuing.`;
- await runOnPauseBackendLoop(process.env.PLAYWRIGHT_TEST_DEBUGGER_MCP!, new BrowserBackend(context), introMessage);
- return { status: 'recovered' };
+ await runBrowserBackendOnError(page, () => {
+ return stripAnsiEscapes(createErrorCodeframe(error.message, step.location));
+ });
});
},
onApiCallEnd: data => {
+
// "tracing.group" step will end later, when "tracing.groupEnd" finishes.
if (data.apiName === 'tracing.group')
return;
@@ -802,6 +799,13 @@ export { defineConfig } from './common/configLoader';
export { mergeTests } from './common/testType';
export { mergeExpects } from './matchers/expect';
+function channelToPage(channelOwner: ChannelOwner): Page | undefined {
+ if (channelOwner._type === 'Page')
+ return channelOwner as PageImpl;
+ if (channelOwner._type === 'Frame')
+ return (channelOwner as FrameImpl).page();
+ return undefined;
+}
function createErrorCodeframe(message: string, location: Location) {
let source: string;
diff --git a/packages/playwright/src/isomorphic/testServerConnection.ts b/packages/playwright/src/isomorphic/testServerConnection.ts
index 76c383bd36..57a416a604 100644
--- a/packages/playwright/src/isomorphic/testServerConnection.ts
+++ b/packages/playwright/src/isomorphic/testServerConnection.ts
@@ -17,7 +17,6 @@
import * as events from './events';
import type { TestServerInterface, TestServerInterfaceEvents } from '@testIsomorphic/testServerInterface';
-import type * as reporterTypes from '../../types/testReporter';
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
@@ -69,14 +68,12 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
readonly onStdio: events.Event<{ type: 'stderr' | 'stdout'; text?: string | undefined; buffer?: string | undefined; }>;
readonly onTestFilesChanged: events.Event<{ testFiles: string[] }>;
readonly onLoadTraceRequested: events.Event<{ traceUrl: string }>;
- readonly onRecoverFromStepError: events.Event<{ stepId: string, message: string, location: reporterTypes.Location }>;
private _onCloseEmitter = new events.EventEmitter<void>();
private _onReportEmitter = new events.EventEmitter<any>();
private _onStdioEmitter = new events.EventEmitter<{ type: 'stderr' | 'stdout'; text?: string | undefined; buffer?: string | undefined; }>();
private _onTestFilesChangedEmitter = new events.EventEmitter<{ testFiles: string[] }>();
private _onLoadTraceRequestedEmitter = new events.EventEmitter<{ traceUrl: string }>();
- private _onRecoverFromStepErrorEmitter = new events.EventEmitter<{ stepId: string, message: string, location: reporterTypes.Location }>();
private _lastId = 0;
private _transport: TestServerTransport;
@@ -90,7 +87,6 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
this.onStdio = this._onStdioEmitter.event;
this.onTestFilesChanged = this._onTestFilesChangedEmitter.event;
this.onLoadTraceRequested = this._onLoadTraceRequestedEmitter.event;
- this.onRecoverFromStepError = this._onRecoverFromStepErrorEmitter.event;
this._transport = transport;
this._transport.onmessage(data => {
@@ -151,8 +147,6 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
this._onTestFilesChangedEmitter.fire(params);
else if (method === 'loadTraceRequested')
this._onLoadTraceRequestedEmitter.fire(params);
- else if (method === 'recoverFromStepError')
- this._onRecoverFromStepErrorEmitter.fire(params);
}
async initialize(params: Parameters<TestServerInterface['initialize']>[0]): ReturnType<TestServerInterface['initialize']> {
@@ -247,10 +241,6 @@ export class TestServerConnection implements TestServerInterface, TestServerInte
await this._sendMessage('closeGracefully', params);
}
- async resumeAfterStepError(params: Parameters<TestServerInterface['resumeAfterStepError']>[0]): Promise<void> {
- await this._sendMessage('resumeAfterStepError', params);
- }
-
close() {
try {
this._transport.close();
diff --git a/packages/playwright/src/isomorphic/testServerInterface.ts b/packages/playwright/src/isomorphic/testServerInterface.ts
index 461b9230b5..66136bab2e 100644
--- a/packages/playwright/src/isomorphic/testServerInterface.ts
+++ b/packages/playwright/src/isomorphic/testServerInterface.ts
@@ -22,12 +22,6 @@ import type * as reporterTypes from '../../types/testReporter';
export type ReportEntry = JsonEvent;
-export type RecoverFromStepErrorResult = {
- stepId: string;
- status: 'recovered' | 'failed';
- value?: string | number | boolean | undefined;
-};
-
export interface TestServerInterface {
initialize(params: {
serializer?: string,
@@ -35,7 +29,6 @@ export interface TestServerInterface {
interceptStdio?: boolean,
watchTestDirs?: boolean,
populateDependenciesOnList?: boolean,
- recoverFromStepErrors?: boolean,
}): Promise<void>;
ping(params: {}): Promise<void>;
@@ -120,8 +113,6 @@ export interface TestServerInterface {
stopTests(params: {}): Promise<void>;
closeGracefully(params: {}): Promise<void>;
-
- resumeAfterStepError(params: RecoverFromStepErrorResult): Promise<void>;
}
export interface TestServerInterfaceEvents {
@@ -136,5 +127,4 @@ export interface TestServerInterfaceEventEmitters {
dispatchEvent(event: 'stdio', params: { type: 'stdout' | 'stderr', text?: string, buffer?: string }): void;
dispatchEvent(event: 'testFilesChanged', params: { testFiles: string[] }): void;
dispatchEvent(event: 'loadTraceRequested', params: { traceUrl: string }): void;
- dispatchEvent(event: 'recoverFromStepError', params: { stepId: string, message: string, location: reporterTypes.Location }): void;
}
diff --git a/packages/playwright/src/matchers/DEPS.list b/packages/playwright/src/matchers/DEPS.list
index de39c6b545..978b4038f5 100644
--- a/packages/playwright/src/matchers/DEPS.list
+++ b/packages/playwright/src/matchers/DEPS.list
@@ -1,5 +1,6 @@
[*]
../common/
+../mcp/browser/backend.ts
../util.ts
../utilsBundle.ts
../worker/testInfo.ts
diff --git a/packages/playwright/src/matchers/expect.ts b/packages/playwright/src/matchers/expect.ts
index b6e3c0dc2e..97261c40bb 100644
--- a/packages/playwright/src/matchers/expect.ts
+++ b/packages/playwright/src/matchers/expect.ts
@@ -365,7 +365,7 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {
const step = testInfo._addStep(stepInfo);
- const reportStepError = (isAsync: boolean, e: Error | unknown) => {
+ const reportStepError = (e: Error | unknown) => {
const jestError = isJestError(e) ? e : null;
const expectError = jestError ? new ExpectError(jestError, customMessage, stackFrames) : undefined;
if (jestError?.matcherResult.suggestedRebaseline) {
@@ -378,24 +378,10 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {
const error = expectError ?? e;
step.complete({ error });
- if (!isAsync || !expectError) {
- if (this._info.isSoft)
- testInfo._failWithError(error);
- else
- throw error;
- return;
- }
-
- // Recoverable async failure.
- return (async () => {
- const recoveryResult = await step.recoverFromStepError(expectError);
- if (recoveryResult.status === 'recovered')
- return recoveryResult.value as any;
- if (this._info.isSoft)
- testInfo._failWithError(expectError);
- else
- throw expectError;
- })();
+ if (this._info.isSoft)
+ testInfo._failWithError(error);
+ else
+ throw error;
};
const finalizer = () => {
@@ -407,11 +393,11 @@ class ExpectMetaInfoProxyHandler implements ProxyHandler<any> {
const callback = () => matcher.call(target, ...args);
const result = currentZone().with('stepZone', step).run(callback);
if (result instanceof Promise)
- return result.then(finalizer).catch(reportStepError.bind(null, true));
+ return result.then(finalizer).catch(reportStepError);
finalizer();
return result;
} catch (e) {
- void reportStepError(false, e);
+ void reportStepError(e);
}
};
}
diff --git a/packages/playwright/src/matchers/toBeTruthy.ts b/packages/playwright/src/matchers/toBeTruthy.ts
index 0c2364c71f..6f627c994c 100644
--- a/packages/playwright/src/matchers/toBeTruthy.ts
+++ b/packages/playwright/src/matchers/toBeTruthy.ts
@@ -16,6 +16,7 @@
import { callLogText, expectTypes } from '../util';
import { kNoElementsFoundError, matcherHint } from './matcherHint';
+import { runBrowserBackendOnError } from '../mcp/browser/backend';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
@@ -64,6 +65,9 @@ export async function toBeTruthy(
const logText = callLogText(log);
return `${header}${logText}`;
};
+
+ await runBrowserBackendOnError(receiver.page(), message);
+
return {
message,
pass,
diff --git a/packages/playwright/src/matchers/toEqual.ts b/packages/playwright/src/matchers/toEqual.ts
index bfa1e6e04a..c188de257b 100644
--- a/packages/playwright/src/matchers/toEqual.ts
+++ b/packages/playwright/src/matchers/toEqual.ts
@@ -18,6 +18,7 @@ import { isRegExp } from 'playwright-core/lib/utils';
import { callLogText, expectTypes } from '../util';
import { matcherHint } from './matcherHint';
+import { runBrowserBackendOnError } from '../mcp/browser/backend';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
@@ -92,6 +93,9 @@ export async function toEqual<T>(
const header = matcherHint(this, receiver, matcherName, 'locator', undefined, matcherOptions, timedOut ? timeout : undefined, details, messagePreventExtraStatIndent);
return `${header}${callLogText(log)}`;
};
+
+ await runBrowserBackendOnError(receiver.page(), message);
+
// Passing the actual and expected objects so that a custom reporter
// could access them, for example in order to display a custom visual diff,
// or create a different error message
diff --git a/packages/playwright/src/matchers/toMatchText.ts b/packages/playwright/src/matchers/toMatchText.ts
index 0320d14f99..712f8361a8 100644
--- a/packages/playwright/src/matchers/toMatchText.ts
+++ b/packages/playwright/src/matchers/toMatchText.ts
@@ -24,6 +24,7 @@ import {
} from './expect';
import { kNoElementsFoundError, matcherHint } from './matcherHint';
import { EXPECTED_COLOR } from '../common/expectBundle';
+import { runBrowserBackendOnError } from '../mcp/browser/backend';
import type { MatcherResult } from './matcherHint';
import type { ExpectMatcherState } from '../../types/test';
@@ -112,6 +113,9 @@ export async function toMatchText(
return hints + callLogText(log);
};
+ if (receiverType === 'Locator')
+ await runBrowserBackendOnError((receiver as Locator).page(), message);
+
return {
name: matcherName,
expected,
diff --git a/packages/playwright/src/mcp/browser/DEPS.list b/packages/playwright/src/mcp/browser/DEPS.list
index a9266a844f..9bdbc0d02a 100644
--- a/packages/playwright/src/mcp/browser/DEPS.list
+++ b/packages/playwright/src/mcp/browser/DEPS.list
@@ -1,2 +1,3 @@
[*]
../sdk/
+../../util.ts
diff --git a/packages/playwright/src/mcp/browser/backend.ts b/packages/playwright/src/mcp/browser/backend.ts
index 5fe672cec2..5e2b87c43c 100644
--- a/packages/playwright/src/mcp/browser/backend.ts
+++ b/packages/playwright/src/mcp/browser/backend.ts
@@ -18,6 +18,8 @@ import * as mcp from '../sdk/exports';
import * as mcpBundle from '../sdk/bundle';
import { snapshot, pickLocator, evaluate } from './tools';
import { defineToolSchema } from '../sdk/exports';
+import { runOnPauseBackendLoop } from '../sdk/mdb';
+import { stripAnsiEscapes } from '../../util';
import type { Tool } from './tool';
import type * as playwright from '../../../index';
@@ -27,10 +29,10 @@ export class BrowserBackend implements ServerBackendOnPause {
readonly name = 'Playwright';
readonly version = '0.0.1';
private _tools: Tool<any>[] = [snapshot, pickLocator, evaluate];
- private _context: playwright.BrowserContext;
+ private _page: playwright.Page;
- constructor(context: playwright.BrowserContext) {
- this._context = context;
+ constructor(page: playwright.Page) {
+ this._page = page;
}
async initialize() {
@@ -52,7 +54,7 @@ export class BrowserBackend implements ServerBackendOnPause {
if (!tool)
throw new Error(`Tool not found: ${name}. Available tools: ${this._tools.map(tool => tool.schema.name).join(', ')}`);
const parsedArguments = tool.schema.inputSchema.parse(args || {});
- return await tool.handle(this._context, parsedArguments);
+ return await tool.handle(this._page, parsedArguments);
}
}
@@ -63,3 +65,10 @@ const doneToolSchema = defineToolSchema({
inputSchema: mcpBundle.z.object({}),
type: 'destructive',
});
+
+export async function runBrowserBackendOnError(page: playwright.Page, message: () => string) {
+ if (!process.env.PLAYWRIGHT_TEST_DEBUGGER_MCP)
+ return;
+ const introMessage = `Paused on error:\n\n${stripAnsiEscapes(message())}\n\nTry recovering from the error prior to continuing.`;
+ await runOnPauseBackendLoop(process.env.PLAYWRIGHT_TEST_DEBUGGER_MCP!, new BrowserBackend(page), introMessage);
+}
diff --git a/packages/playwright/src/mcp/browser/tool.ts b/packages/playwright/src/mcp/browser/tool.ts
index 1291ddc97c..5b09b17480 100644
--- a/packages/playwright/src/mcp/browser/tool.ts
+++ b/packages/playwright/src/mcp/browser/tool.ts
@@ -20,7 +20,7 @@ import type * as playwright from '../../../index';
export type Tool<Input extends z.Schema = z.Schema> = {
schema: mcp.ToolSchema<Input>;
- handle: (context: playwright.BrowserContext, params: z.output<Input>) => Promise<mcp.CallToolResult>;
+ handle: (page: playwright.Page, params: z.output<Input>) => Promise<mcp.CallToolResult>;
};
export function defineTool<Input extends z.Schema>(tool: Tool<Input>): Tool<Input> {
diff --git a/packages/playwright/src/mcp/browser/tools.ts b/packages/playwright/src/mcp/browser/tools.ts
index 65a6f377a1..ee00bd62be 100644
--- a/packages/playwright/src/mcp/browser/tools.ts
+++ b/packages/playwright/src/mcp/browser/tools.ts
@@ -35,11 +35,7 @@ export const snapshot = defineTool({
type: 'readOnly',
},
- handle: async (context, params) => {
- const [page] = context.pages();
- if (!page)
- throw new Error('No open pages available');
-
+ handle: async (page, params) => {
const snapshot = await (page as PageEx)._snapshotForAI();
return {
content: [
@@ -66,11 +62,7 @@ export const pickLocator = defineTool({
type: 'readOnly',
},
- handle: async (context, params) => {
- const [page] = context.pages();
- if (!page)
- throw new Error('No open pages available');
-
+ handle: async (page, params) => {
const locator = await refLocator(page, params);
const locatorString = await generateLocator(locator);
return {
@@ -100,11 +92,7 @@ export const evaluate = defineTool({
type: 'destructive',
},
- handle: async (context, params) => {
- const [page] = context.pages();
- if (!page)
- throw new Error('No open pages available');
-
+ handle: async (page, params) => {
if (params.ref && params.element) {
const locator = await refLocator(page, { ref: params.ref, element: params.element });
const result = await locator.evaluate(params.function);
diff --git a/packages/playwright/src/mcp/sdk/mdb.ts b/packages/playwright/src/mcp/sdk/mdb.ts
index 3216e4366b..b446587d5e 100644
--- a/packages/playwright/src/mcp/sdk/mdb.ts
+++ b/packages/playwright/src/mcp/sdk/mdb.ts
@@ -121,7 +121,7 @@ export type ServerBackendOnPause = mcpServer.ServerBackend & {
requestSelfDestruct?: () => void;
};
-export async function runToolsBackend(backendFactories: mcpServer.ServerBackendFactory[], options: { port: number }): Promise<string> {
+export async function runToolsBackend(backendFactory: mcpServer.ServerBackendFactory, options: { port: number }): Promise<string> {
const mdbBackend = new MDBBackend();
const mdbBackendFactory = {
name: 'Playwright MDB',
@@ -132,12 +132,10 @@ export async function runToolsBackend(backendFactories: mcpServer.ServerBackendF
const mdbUrl = await startAsHttp(mdbBackendFactory, options);
- for (const backendFactory of backendFactories) {
- const backendUrl = await startAsHttp(backendFactory, { port: 0 });
- const result = await callTool(mdbUrl, pushToolsSchema.name, { mcpUrl: backendUrl });
- if (result.isError)
- errorsDebug('Failed to push tools', result.content);
- }
+ const backendUrl = await startAsHttp(backendFactory, { port: 0 });
+ const result = await callTool(mdbUrl, pushToolsSchema.name, { mcpUrl: backendUrl });
+ if (result.isError)
+ errorsDebug('Failed to push tools', result.content);
return mdbUrl;
}
diff --git a/packages/playwright/src/mcp/test/program.ts b/packages/playwright/src/mcp/test/program.ts
index 0d5d0ea48f..4eecec8b90 100644
--- a/packages/playwright/src/mcp/test/program.ts
+++ b/packages/playwright/src/mcp/test/program.ts
@@ -37,7 +37,7 @@ program
version: '0.0.0',
create: () => new TestServerBackend(resolvedLocation),
};
- const mdbUrl = await runToolsBackend([backendFactory], { port: 9224 });
+ const mdbUrl = await runToolsBackend(backendFactory, { port: 9224 });
process.env.PLAYWRIGHT_TEST_DEBUGGER_MCP = mdbUrl;
// eslint-disable-next-line no-console
console.error('MCP Listening on: ', mdbUrl);
diff --git a/packages/playwright/src/runner/dispatcher.ts b/packages/playwright/src/runner/dispatcher.ts
index 5e0525e541..22293b2a9d 100644
--- a/packages/playwright/src/runner/dispatcher.ts
+++ b/packages/playwright/src/runner/dispatcher.ts
@@ -26,12 +26,11 @@ import type { ProcessExitData } from './processHost';
import type { TestGroup } from './testGroups';
import type { TestError, TestResult, TestStep } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
-import type { AttachmentPayload, DonePayload, RunPayload, SerializedConfig, StepBeginPayload, StepEndPayload, StepRecoverFromErrorPayload, TeardownErrorsPayload, TestBeginPayload, TestEndPayload, TestOutputPayload } from '../common/ipc';
+import type { AttachmentPayload, DonePayload, RunPayload, SerializedConfig, StepBeginPayload, StepEndPayload, TeardownErrorsPayload, TestBeginPayload, TestEndPayload, TestOutputPayload } from '../common/ipc';
import type { Suite } from '../common/test';
import type { TestCase } from '../common/test';
import type { ReporterV2 } from '../reporters/reporterV2';
import type { RegisteredListener } from 'playwright-core/lib/utils';
-import type { RecoverFromStepErrorResult } from '@testIsomorphic/testServerInterface';
export type EnvByProjectId = Map<string, Record<string, string | undefined>>;
@@ -219,8 +218,7 @@ export class Dispatcher {
_createWorker(testGroup: TestGroup, parallelIndex: number, loaderData: SerializedConfig) {
const projectConfig = this._config.projects.find(p => p.id === testGroup.projectId)!;
const outputDir = projectConfig.project.outputDir;
- const recoverFromStepErrors = this._failureTracker.canRecoverFromStepError();
- const worker = new WorkerHost(testGroup, parallelIndex, loaderData, recoverFromStepErrors, this._extraEnvByProjectId.get(testGroup.projectId) || {}, outputDir);
+ const worker = new WorkerHost(testGroup, parallelIndex, loaderData, this._extraEnvByProjectId.get(testGroup.projectId) || {}, outputDir);
const handleOutput = (params: TestOutputPayload) => {
const chunk = chunkFromParams(params);
if (worker.didFail()) {
@@ -398,26 +396,6 @@ class JobDispatcher {
this._reporter.onStepEnd?.(test, result, step);
}
- private _onStepRecoverFromError(resumeAfterStepError: (result: RecoverFromStepErrorResult) => void, params: StepRecoverFromErrorPayload) {
- const data = this._dataByTestId.get(params.testId);
- if (!data) {
- resumeAfterStepError({ stepId: params.stepId, status: 'failed' });
- return;
- }
- const { steps } = data;
- const step = steps.get(params.stepId);
- if (!step) {
- resumeAfterStepError({ stepId: params.stepId, status: 'failed' });
- return;
- }
-
- const testError: TestError = {
- ...params.error,
- location: step.location,
- };
- this._failureTracker.recoverFromStepError(params.stepId, testError, resumeAfterStepError);
- }
-
private _onAttach(params: AttachmentPayload) {
const data = this._dataByTestId.get(params.testId)!;
if (!data) {
@@ -582,14 +560,12 @@ class JobDispatcher {
}),
};
worker.runTestGroup(runPayload);
- const resumeAfterStepError = worker.resumeAfterStepError.bind(worker);
this._listeners = [
eventsHelper.addEventListener(worker, 'testBegin', this._onTestBegin.bind(this)),
eventsHelper.addEventListener(worker, 'testEnd', this._onTestEnd.bind(this)),
eventsHelper.addEventListener(worker, 'stepBegin', this._onStepBegin.bind(this)),
eventsHelper.addEventListener(worker, 'stepEnd', this._onStepEnd.bind(this)),
- eventsHelper.addEventListener(worker, 'stepRecoverFromError', this._onStepRecoverFromError.bind(this, resumeAfterStepError)),
eventsHelper.addEventListener(worker, 'attach', this._onAttach.bind(this)),
eventsHelper.addEventListener(worker, 'done', this._onDone.bind(this)),
eventsHelper.addEventListener(worker, 'exit', this.onExit.bind(this)),
diff --git a/packages/playwright/src/runner/failureTracker.ts b/packages/playwright/src/runner/failureTracker.ts
index 42481e06ca..dd8ce50587 100644
--- a/packages/playwright/src/runner/failureTracker.ts
+++ b/packages/playwright/src/runner/failureTracker.ts
@@ -14,30 +14,18 @@
* limitations under the License.
*/
-import type { RecoverFromStepErrorResult } from '@testIsomorphic/testServerInterface';
-import type { TestResult, TestError } from '../../types/testReporter';
+import type { TestResult } from '../../types/testReporter';
import type { FullConfigInternal } from '../common/config';
import type { Suite, TestCase } from '../common/test';
-export type RecoverFromStepErrorHandler = (stepId: string, error: TestError) => Promise<RecoverFromStepErrorResult>;
-
export class FailureTracker {
private _failureCount = 0;
private _hasWorkerErrors = false;
private _rootSuite: Suite | undefined;
- private _recoverFromStepErrorHandler: RecoverFromStepErrorHandler | undefined;
constructor(private _config: FullConfigInternal) {
}
- canRecoverFromStepError(): boolean {
- return !!this._recoverFromStepErrorHandler;
- }
-
- setRecoverFromStepErrorHandler(recoverFromStepErrorHandler: RecoverFromStepErrorHandler) {
- this._recoverFromStepErrorHandler = recoverFromStepErrorHandler;
- }
-
onRootSuite(rootSuite: Suite) {
this._rootSuite = rootSuite;
}
@@ -48,14 +36,6 @@ export class FailureTracker {
++this._failureCount;
}
- recoverFromStepError(stepId: string, error: TestError, resumeAfterStepError: (result: RecoverFromStepErrorResult) => void) {
- if (!this._recoverFromStepErrorHandler) {
- resumeAfterStepError({ stepId, status: 'failed' });
- return;
- }
- void this._recoverFromStepErrorHandler(stepId, error).then(resumeAfterStepError).catch(() => {});
- }
-
onWorkerError() {
this._hasWorkerErrors = true;
}
diff --git a/packages/playwright/src/runner/testRunner.ts b/packages/playwright/src/runner/testRunner.ts
index c678043b2b..b973a8852b 100644
--- a/packages/playwright/src/runner/testRunner.ts
+++ b/packages/playwright/src/runner/testRunner.ts
@@ -40,20 +40,12 @@ import type { ConfigCLIOverrides } from '../common/ipc';
import type { TestRunnerPluginRegistration } from '../plugins';
import type { AnyReporter } from '../reporters/reporterV2';
-export type RecoverFromStepErrorResult = {
- stepId: string;
- status: 'recovered' | 'failed';
- value?: string | number | boolean | undefined;
-};
-
export const TestRunnerEvent = {
TestFilesChanged: 'testFilesChanged',
- RecoverFromStepError: 'recoverFromStepError',
} as const;
export type TestRunnerEventMap = {
[TestRunnerEvent.TestFilesChanged]: [testFiles: string[]];
- [TestRunnerEvent.RecoverFromStepError]: [stepId: string, message: string, location: reporterTypes.Location];
};
export type ListTestsParams = {
@@ -99,8 +91,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {
private _plugins: TestRunnerPluginRegistration[] | undefined;
private _watchTestDirs = false;
private _populateDependenciesOnList = false;
- private _recoverFromStepErrors = false;
- private _resumeAfterStepErrors: Map<string, ManualPromise<RecoverFromStepErrorResult>> = new Map();
constructor(configLocation: ConfigLocation, configCLIOverrides: ConfigCLIOverrides) {
super();
@@ -116,11 +106,9 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {
async initialize(params: {
watchTestDirs?: boolean;
populateDependenciesOnList?: boolean;
- recoverFromStepErrors?: boolean;
}) {
this._watchTestDirs = !!params.watchTestDirs;
this._populateDependenciesOnList = !!params.populateDependenciesOnList;
- this._recoverFromStepErrors = !!params.recoverFromStepErrors;
}
resizeTerminal(params: { cols: number, rows: number }) {
@@ -348,7 +336,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {
...createRunTestsTasks(config),
];
const testRun = new TestRun(config, reporter);
- testRun.failureTracker.setRecoverFromStepErrorHandler(this._recoverFromStepError.bind(this));
const run = runTasks(testRun, tasks, 0, stop).then(async status => {
this._testRun = undefined;
return status;
@@ -357,26 +344,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {
return { status: await run };
}
- private async _recoverFromStepError(stepId: string, error: reporterTypes.TestError): Promise<RecoverFromStepErrorResult> {
- if (!this._recoverFromStepErrors)
- return { stepId, status: 'failed' };
- const recoveryPromise = new ManualPromise<RecoverFromStepErrorResult>();
- this._resumeAfterStepErrors.set(stepId, recoveryPromise);
- if (!error?.message || !error?.location)
- return { stepId, status: 'failed' };
- this.emit(TestRunnerEvent.RecoverFromStepError, stepId, error.message, error.location);
- const recoveredResult = await recoveryPromise;
- if (recoveredResult.stepId !== stepId)
- return { stepId, status: 'failed' };
- return recoveredResult;
- }
-
- async resumeAfterStepError(params: RecoverFromStepErrorResult): Promise<void> {
- const recoveryPromise = this._resumeAfterStepErrors.get(params.stepId);
- if (recoveryPromise)
- recoveryPromise.resolve(params);
- }
-
async watch(fileNames: string[]) {
this._watchedTestDependencies = new Set();
for (const fileName of fileNames) {
@@ -404,7 +371,6 @@ export class TestRunner extends EventEmitter<TestRunnerEventMap> {
async stopTests() {
this._testRun?.stop?.resolve();
await this._testRun?.run;
- this._resumeAfterStepErrors.clear();
}
async closeGracefully() {
diff --git a/packages/playwright/src/runner/testServer.ts b/packages/playwright/src/runner/testServer.ts
index 9461e20e05..4f8758623a 100644
--- a/packages/playwright/src/runner/testServer.ts
+++ b/packages/playwright/src/runner/testServer.ts
@@ -31,7 +31,7 @@ import type { HttpServer, Transport } from 'playwright-core/lib/utils';
import type * as reporterTypes from '../../types/testReporter';
import type { ConfigLocation } from '../common/config';
import type { ConfigCLIOverrides } from '../common/ipc';
-import type { RecoverFromStepErrorResult, ReportEntry, TestServerInterface, TestServerInterfaceEventEmitters } from '../isomorphic/testServerInterface';
+import type { ReportEntry, TestServerInterface, TestServerInterfaceEventEmitters } from '../isomorphic/testServerInterface';
import type { ReporterV2 } from '../reporters/reporterV2';
const originalDebugLog = debug.log;
@@ -63,12 +63,10 @@ class TestServer {
export const TestRunnerEvent = {
TestFilesChanged: 'testFilesChanged',
- RecoverFromStepError: 'recoverFromStepError',
} as const;
export type TestRunnerEventMap = {
[TestRunnerEvent.TestFilesChanged]: [testFiles: string[]];
- [TestRunnerEvent.RecoverFromStepError]: [stepId: string, message: string, location: reporterTypes.Location];
};
export type ListTestsParams = {
@@ -117,7 +115,6 @@ export class TestServerDispatcher implements TestServerInterface {
this._dispatchEvent = (method, params) => this.transport.sendEvent?.(method, params);
this._testRunner.on(TestRunnerEvent.TestFilesChanged, testFiles => this._dispatchEvent('testFilesChanged', { testFiles }));
- this._testRunner.on(TestRunnerEvent.RecoverFromStepError, (stepId, message, location) => this._dispatchEvent('recoverFromStepError', { stepId, message, location }));
}
private async _wireReporter(messageSink: (message: any) => void) {
@@ -140,7 +137,6 @@ export class TestServerDispatcher implements TestServerInterface {
await this._testRunner.initialize({
watchTestDirs: !!params.watchTestDirs,
populateDependenciesOnList: !!params.populateDependenciesOnList,
- recoverFromStepErrors: !!params.recoverFromStepErrors,
});
}
@@ -218,10 +214,6 @@ export class TestServerDispatcher implements TestServerInterface {
return { status };
}
- async resumeAfterStepError(params: RecoverFromStepErrorResult): Promise<void> {
- await this._testRunner.resumeAfterStepError(params);
- }
-
async watch(params: { fileNames: string[]; }) {
await this._testRunner.watch(params.fileNames);
}
diff --git a/packages/playwright/src/runner/watchMode.ts b/packages/playwright/src/runner/watchMode.ts
index 6b3c7b405d..7915405bd9 100644
--- a/packages/playwright/src/runner/watchMode.ts
+++ b/packages/playwright/src/runner/watchMode.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import fs from 'fs';
import path from 'path';
import readline from 'readline';
import { EventEmitter } from 'stream';
@@ -28,8 +27,6 @@ import { enquirer } from '../utilsBundle';
import { TestServerDispatcher } from './testServer';
import { TeleSuiteUpdater } from '../isomorphic/teleSuiteUpdater';
import { TestServerConnection } from '../isomorphic/testServerConnection';
-import { stripAnsiEscapes } from '../util';
-import { codeFrameColumns } from '../transform/babelBundle';
import type * as reporterTypes from '../../types/testReporter';
import type { ConfigLocation } from '../common/config';
@@ -131,27 +128,11 @@ export async function runWatchModeLoop(configLocation: ConfigLocation, initialOp
});
});
testServerConnection.onReport(report => teleSuiteUpdater.processTestReportEvent(report));
- testServerConnection.onRecoverFromStepError(({ stepId, message, location }) => {
- process.stdout.write(`\nTest error occurred.\n`);
- process.stdout.write('\n' + createErrorCodeframe(message, location) + '\n');
- process.stdout.write(`\n${colors.dim('Try recovering from the error. Press')} ${colors.bold('c')} ${colors.dim('to continue or')} ${colors.bold('t')} ${colors.dim('to throw the error')}\n`);
- readKeyPress(text => {
- if (text === 'c') {
- process.stdout.write(`\n${colors.dim('Continuing after recovery...')}\n`);
- testServerConnection.resumeAfterStepError({ stepId, status: 'recovered', value: undefined }).catch(() => {});
- } else if (text === 't') {
- process.stdout.write(`\n${colors.dim('Throwing error...')}\n`);
- testServerConnection.resumeAfterStepError({ stepId, status: 'failed' }).catch(() => {});
- }
- return text;
- });
- });
await testServerConnection.initialize({
interceptStdio: false,
watchTestDirs: true,
populateDependenciesOnList: true,
- recoverFromStepErrors: !process.env.PWTEST_RECOVERY_DISABLED,
});
await testServerConnection.runGlobalSetup({});
@@ -450,28 +431,3 @@ async function toggleShowBrowser() {
}
type Command = 'run' | 'failed' | 'repeat' | 'changed' | 'project' | 'file' | 'grep' | 'exit' | 'interrupted' | 'toggle-show-browser' | 'toggle-buffer-mode';
-
-function createErrorCodeframe(message: string, location: reporterTypes.Location) {
- let source: string;
- try {
- source = fs.readFileSync(location.file, 'utf-8') + '\n//';
- } catch (e) {
- return;
- }
-
- return codeFrameColumns(
- source,
- {
- start: {
- line: location.line,
- column: location.column,
- },
- },
- {
- highlightCode: true,
- linesAbove: 5,
- linesBelow: 5,
- message: stripAnsiEscapes(message).split('\n')[0] || undefined,
- }
- );
-}
diff --git a/packages/playwright/src/runner/workerHost.ts b/packages/playwright/src/runner/workerHost.ts
index 3879971ef0..9d69506330 100644
--- a/packages/playwright/src/runner/workerHost.ts
+++ b/packages/playwright/src/runner/workerHost.ts
@@ -25,7 +25,6 @@ import { artifactsFolderName } from '../isomorphic/folders';
import type { TestGroup } from './testGroups';
import type { RunPayload, SerializedConfig, WorkerInitParams } from '../common/ipc';
-import type { RecoverFromStepErrorResult } from '@testIsomorphic/testServerInterface';
let lastWorkerIndex = 0;
@@ -37,7 +36,7 @@ export class WorkerHost extends ProcessHost {
private _params: WorkerInitParams;
private _didFail = false;
- constructor(testGroup: TestGroup, parallelIndex: number, config: SerializedConfig, recoverFromStepErrors: boolean, extraEnv: Record<string, string | undefined>, outputDir: string) {
+ constructor(testGroup: TestGroup, parallelIndex: number, config: SerializedConfig, extraEnv: Record<string, string | undefined>, outputDir: string) {
const workerIndex = lastWorkerIndex++;
super(require.resolve('../worker/workerMain.js'), `worker-${workerIndex}`, {
...extraEnv,
@@ -55,7 +54,6 @@ export class WorkerHost extends ProcessHost {
projectId: testGroup.projectId,
config,
artifactsDir: path.join(outputDir, artifactsFolderName(workerIndex)),
- recoverFromStepErrors,
};
}
@@ -81,10 +79,6 @@ export class WorkerHost extends ProcessHost {
this.sendMessageNoReply({ method: 'runTestGroup', params: runPayload });
}
- resumeAfterStepError(result: RecoverFromStepErrorResult) {
- this.sendMessageNoReply({ method: 'resumeAfterStepError', params: result });
- }
-
hash() {
return this._hash;
}
diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.ts
index 4e7a0d4e2b..fa71ac1b15 100644
--- a/packages/playwright/src/worker/testInfo.ts
+++ b/packages/playwright/src/worker/testInfo.ts
@@ -17,10 +17,10 @@
import fs from 'fs';
import path from 'path';
-import { captureRawStack, monotonicTime, sanitizeForFilePath, stringifyStackFrames, currentZone, createGuid, escapeWithQuotes, ManualPromise } from 'playwright-core/lib/utils';
+import { captureRawStack, monotonicTime, sanitizeForFilePath, stringifyStackFrames, currentZone, createGuid, escapeWithQuotes } from 'playwright-core/lib/utils';
import { TimeoutManager, TimeoutManagerError, kMaxDeadline } from './timeoutManager';
-import { addSuffixToFilePath, filteredStackTrace, getContainedPath, normalizeAndSaveAttachment, sanitizeFilePathBeforeExtension, serializeError, trimLongString, windowsFilesystemFriendlyLength } from '../util';
+import { addSuffixToFilePath, filteredStackTrace, getContainedPath, normalizeAndSaveAttachment, sanitizeFilePathBeforeExtension, trimLongString, windowsFilesystemFriendlyLength } from '../util';
import { TestTracing } from './testTracing';
import { testInfoError } from './util';
import { wrapFunctionWithLocation } from '../transform/transform';
@@ -29,10 +29,9 @@ import type { RunnableDescription } from './timeoutManager';
import type { FullProject, TestInfo, TestStatus, TestStepInfo, TestAnnotation } from '../../types/test';
import type { FullConfig, Location } from '../../types/testReporter';
import type { FullConfigInternal, FullProjectInternal } from '../common/config';
-import type { AttachmentPayload, ResumeAfterStepErrorPayload, StepBeginPayload, StepEndPayload, StepRecoverFromErrorPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';
+import type { AttachmentPayload, StepBeginPayload, StepEndPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';
import type { TestCase } from '../common/test';
import type { StackFrame } from '@protocol/channels';
-import type { RecoverFromStepErrorResult } from '@testIsomorphic/testServerInterface';
export type TestStepCategory = 'expect' | 'fixture' | 'hook' | 'pw:api' | 'test.step' | 'test.attach';
@@ -50,7 +49,6 @@ interface TestStepData {
}
export interface TestStepInternal extends TestStepData {
- recoverFromStepError(error: Error): Promise<RecoverFromStepErrorResult>;
complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void;
info: TestStepInfoImpl;
attachmentIndices: number[];
@@ -68,7 +66,6 @@ type SnapshotNames = {
export class TestInfoImpl implements TestInfo {
private _onStepBegin: (payload: StepBeginPayload) => void;
- private _onStepRecoverFromError: (payload: StepRecoverFromErrorPayload) => void;
private _onStepEnd: (payload: StepEndPayload) => void;
private _onAttach: (payload: AttachmentPayload) => void;
private _snapshotNames: SnapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };
@@ -122,7 +119,6 @@ export class TestInfoImpl implements TestInfo {
readonly snapshotDir: string;
errors: TestInfoErrorImpl[] = [];
readonly _attachmentsPush: (...items: TestInfo['attachments']) => number;
- private _recoverFromStepErrorResults: Map<string, ManualPromise<ResumeAfterStepErrorPayload>> | undefined;
get error(): TestInfoErrorImpl | undefined {
return this.errors[0];
@@ -162,13 +158,11 @@ export class TestInfoImpl implements TestInfo {
test: TestCase | undefined,
retry: number,
onStepBegin: (payload: StepBeginPayload) => void,
- onStepRecoverFromError: (payload: StepRecoverFromErrorPayload) => void,
onStepEnd: (payload: StepEndPayload) => void,
onAttach: (payload: AttachmentPayload) => void,
) {
this.testId = test?.id ?? '';
this._onStepBegin = onStepBegin;
- this._onStepRecoverFromError = onStepRecoverFromError;
this._onStepEnd = onStepEnd;
this._onAttach = onAttach;
this._startTime = monotonicTime();
@@ -192,7 +186,6 @@ export class TestInfoImpl implements TestInfo {
this.tags = test?.tags ?? [];
this.fn = test?.fn ?? (() => {});
this.expectedStatus = test?.expectedStatus ?? 'skipped';
- this._recoverFromStepErrorResults = workerParams.recoverFromStepErrors ? new Map() : undefined;
this._timeoutManager = new TimeoutManager(this.project.timeout);
if (configInternal.configCLIOverrides.debug)
@@ -304,22 +297,6 @@ export class TestInfoImpl implements TestInfo {
steps: [],
attachmentIndices: [],
info: new TestStepInfoImpl(this, stepId, data.title, parentStep?.info),
- recoverFromStepError: async (error: Error) => {
- if (!this._recoverFromStepErrorResults)
- return { stepId, status: 'failed' };
- const payload: StepRecoverFromErrorPayload = {
- testId: this.testId,
- stepId,
- error: serializeError(error),
- };
- this._onStepRecoverFromError(payload);
- const recoveryPromise = new ManualPromise<RecoverFromStepErrorResult>();
- this._recoverFromStepErrorResults.set(stepId, recoveryPromise);
- const recoveryResult = await recoveryPromise;
- if (recoveryResult.stepId !== stepId)
- return { stepId, status: 'failed' };
- return recoveryResult;
- },
complete: result => {
if (step.endWallTime)
return;
@@ -396,12 +373,6 @@ export class TestInfoImpl implements TestInfo {
return step;
}
- resumeAfterStepError(result: ResumeAfterStepErrorPayload) {
- const recoveryPromise = this._recoverFromStepErrorResults?.get(result.stepId);
- if (recoveryPromise)
- recoveryPromise.resolve(result);
- }
-
_interrupt() {
// Mark as interrupted so we can ignore TimeoutError thrown by interrupt() call.
this._wasInterrupted = true;
diff --git a/packages/playwright/src/worker/workerMain.ts b/packages/playwright/src/worker/workerMain.ts
index 0cfe0f65db..e4eb1b82ad 100644
--- a/packages/playwright/src/worker/workerMain.ts
+++ b/packages/playwright/src/worker/workerMain.ts
@@ -33,7 +33,7 @@ import { loadTestFile } from '../common/testLoader';
import type { TimeSlot } from './timeoutManager';
import type { Location } from '../../types/testReporter';
import type { FullConfigInternal, FullProjectInternal } from '../common/config';
-import type { DonePayload, ResumeAfterStepErrorPayload, RunPayload, TeardownErrorsPayload, TestBeginPayload, TestEndPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';
+import type { DonePayload, RunPayload, TeardownErrorsPayload, TestBeginPayload, TestEndPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';
import type { Suite, TestCase } from '../common/test';
import type { TestAnnotation } from '../../types/test';
@@ -115,7 +115,7 @@ export class WorkerMain extends ProcessRunner {
return;
}
// Ignore top-level errors, they are already inside TestInfo.errors.
- const fakeTestInfo = new TestInfoImpl(this._config, this._project, this._params, undefined, 0, () => {}, () => {}, () => {}, () => {});
+ const fakeTestInfo = new TestInfoImpl(this._config, this._project, this._params, undefined, 0, () => {}, () => {}, () => {});
const runnable = { type: 'teardown' } as const;
// We have to load the project to get the right deadline below.
await fakeTestInfo._runWithTimeout(runnable, () => this._loadIfNeeded()).catch(() => {});
@@ -261,14 +261,9 @@ export class WorkerMain extends ProcessRunner {
}
}
- resumeAfterStepError(params: ResumeAfterStepErrorPayload): void {
- this._currentTest?.resumeAfterStepError(params);
- }
-
private async _runTest(test: TestCase, retry: number, nextTest: TestCase | undefined) {
const testInfo = new TestInfoImpl(this._config, this._project, this._params, test, retry,
stepBeginPayload => this.dispatchEvent('stepBegin', stepBeginPayload),
- stepRecoverFromErrorPayload => this.dispatchEvent('stepRecoverFromError', stepRecoverFromErrorPayload),
stepEndPayload => this.dispatchEvent('stepEnd', stepEndPayload),
attachment => this.dispatchEvent('attach', attachment));