fix: Cleanup after WebDriver errors
parent
30c22cff9f
commit
dc3cc1f282
|
@ -52,9 +52,9 @@ jobs:
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
node-version: [14.x, 16.x]
|
node-version: [14.x, 16.x]
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
exclude:
|
exclude:
|
||||||
- {os: windows-latest, node: 16.x}
|
- {os: windows-latest, node: 16.x}
|
||||||
- {os: macOS-latest, node: 16.x}
|
- {os: macOS-latest, node: 16.x}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
|
@ -50,8 +50,7 @@ export default class PlatformBrowser implements Platform {
|
||||||
this.silent = silent;
|
this.silent = silent;
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(ctx: Context, file: string): Promise<Result> {
|
async interact(ctx: Context, file: string, port: number): Promise<Result> {
|
||||||
const {child, port} = await start(this.driver, this.silent);
|
|
||||||
const client = await WebDriver.newSession({
|
const client = await WebDriver.newSession({
|
||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
port,
|
port,
|
||||||
|
@ -75,7 +74,17 @@ export default class PlatformBrowser implements Platform {
|
||||||
)) as Result;
|
)) as Result;
|
||||||
|
|
||||||
await client.deleteSession();
|
await client.deleteSession();
|
||||||
await stop(child);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async run(ctx: Context, file: string): Promise<Result> {
|
||||||
|
const {child, port} = await start(this.driver, this.silent);
|
||||||
|
try {
|
||||||
|
const result = await this.interact(ctx, file, port);
|
||||||
|
await stop(child);
|
||||||
|
return result;
|
||||||
|
} finally {
|
||||||
|
await stop(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue