Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: follow up to target close message
Pavel Feldmanf8a30fb726bc
diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.tsindex 61ce98a8a8..eef42b1843 100644--- a/packages/playwright-core/src/client/connection.ts+++ b/packages/playwright-core/src/client/connection.ts@@ -184,7 +184,7 @@ export class Connection extends EventEmitter {}close(cause?: Error) {- this._closedError = cause || new TargetClosedError();+ this._closedError = new TargetClosedError();if (cause)rewriteErrorMessage(this._closedError, this._closedError.message + '\nCaused by: ' + cause.toString());for (const callback of this._callbacks.values())diff --git a/tests/android/launch-server.spec.ts b/tests/android/launch-server.spec.tsindex 555b96e7fd..3593f668bc 100644--- a/tests/android/launch-server.spec.ts+++ b/tests/android/launch-server.spec.ts@@ -16,6 +16,7 @@import ws from 'ws';import { androidTest as test, expect } from './androidTest';+import { kTargetClosedErrorMessage } from '../config/errors';// Force a separate worker to avoid messing up with `androidDevice` fixture.test.use({ launchOptions: {} });@@ -95,7 +96,7 @@ test('android.launchServer BrowserServer.close() will disconnect the device', astry {const device = await playwright._android.connect(browserServer.wsEndpoint());await browserServer.close();- await expect(device.shell('echo 123')).rejects.toThrow('androidDevice.shell: Browser has been closed');+ await expect(device.shell('echo 123')).rejects.toThrow('androidDevice.shell: ' + kTargetClosedErrorMessage);} finally {await browserServer.close();}@@ -106,7 +107,7 @@ test('android.launchServer BrowserServer.kill() will disconnect the device', astry {const device = await playwright._android.connect(browserServer.wsEndpoint());await browserServer.kill();- await expect(device.shell('echo 123')).rejects.toThrow('androidDevice.shell: Browser has been closed');+ await expect(device.shell('echo 123')).rejects.toThrow('androidDevice.shell: ' + kTargetClosedErrorMessage);} finally {await browserServer.close();}