chore: follow up to target close message
This commit is contained in:
parent
9d76c09ddb
commit
f8a30fb726
|
|
@ -184,7 +184,7 @@ export class Connection extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
close(cause?: Error) {
|
close(cause?: Error) {
|
||||||
this._closedError = cause || new TargetClosedError();
|
this._closedError = new TargetClosedError();
|
||||||
if (cause)
|
if (cause)
|
||||||
rewriteErrorMessage(this._closedError, this._closedError.message + '\nCaused by: ' + cause.toString());
|
rewriteErrorMessage(this._closedError, this._closedError.message + '\nCaused by: ' + cause.toString());
|
||||||
for (const callback of this._callbacks.values())
|
for (const callback of this._callbacks.values())
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import ws from 'ws';
|
import ws from 'ws';
|
||||||
import { androidTest as test, expect } from './androidTest';
|
import { androidTest as test, expect } from './androidTest';
|
||||||
|
import { kTargetClosedErrorMessage } from '../config/errors';
|
||||||
|
|
||||||
// Force a separate worker to avoid messing up with `androidDevice` fixture.
|
// Force a separate worker to avoid messing up with `androidDevice` fixture.
|
||||||
test.use({ launchOptions: {} });
|
test.use({ launchOptions: {} });
|
||||||
|
|
@ -95,7 +96,7 @@ test('android.launchServer BrowserServer.close() will disconnect the device', as
|
||||||
try {
|
try {
|
||||||
const device = await playwright._android.connect(browserServer.wsEndpoint());
|
const device = await playwright._android.connect(browserServer.wsEndpoint());
|
||||||
await browserServer.close();
|
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 {
|
} finally {
|
||||||
await browserServer.close();
|
await browserServer.close();
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +107,7 @@ test('android.launchServer BrowserServer.kill() will disconnect the device', as
|
||||||
try {
|
try {
|
||||||
const device = await playwright._android.connect(browserServer.wsEndpoint());
|
const device = await playwright._android.connect(browserServer.wsEndpoint());
|
||||||
await browserServer.kill();
|
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 {
|
} finally {
|
||||||
await browserServer.close();
|
await browserServer.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue