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