From d3dfb7ef7828522305b095b310a43e34421c97f0 Mon Sep 17 00:00:00 2001 From: tiddlygit-test Date: Fri, 23 Apr 2021 00:54:15 +0800 Subject: [PATCH] fix: execution too fast causes 'socket hang up' --- features/stepDefinitions/electron.ts | 1 + features/supports/after.ts | 31 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/features/stepDefinitions/electron.ts b/features/stepDefinitions/electron.ts index 4d4cca16..935eb7c4 100644 --- a/features/stepDefinitions/electron.ts +++ b/features/stepDefinitions/electron.ts @@ -7,6 +7,7 @@ import { TiddlyGitWorld } from '../supports/world'; setWorldConstructor(TiddlyGitWorld); Given('the app is launched', async function (this: TiddlyGitWorld) { + await delay(100); await this.start(); const windowCount = await this.app?.client?.getWindowCount(); expect(windowCount).equal(1); diff --git a/features/supports/after.ts b/features/supports/after.ts index d9491800..acd2f965 100644 --- a/features/supports/after.ts +++ b/features/supports/after.ts @@ -13,20 +13,21 @@ Before(async function () { After(async function (this: TiddlyGitWorld, testCase) { // print logs if test failed - if (this.app !== undefined && testCase.result?.status === Status.FAILED) { - console.log('main:\n---\n'); - await this.app.client.getMainProcessLogs().then(function (logs) { - logs.forEach(function (log) { - console.log(log, '\n'); - }); - }); - console.log('renderer:\n---\n'); - await this.app.client.getRenderProcessLogs().then(function (logs) { - logs.forEach(function (log) { - console.log(JSON.stringify(log), '\n'); - }); - }); - console.log('\n'); - } + // if (this.app !== undefined && testCase.result?.status === Status.FAILED) { + // console.log('main:\n---\n'); + // // FIXME: TypeError: this.app.client.getMainProcessLogs is not a function + // await this.app.client.getMainProcessLogs().then(function (logs) { + // logs.forEach(function (log) { + // console.log(log, '\n'); + // }); + // }); + // console.log('renderer:\n---\n'); + // await this.app.client.getRenderProcessLogs().then(function (logs) { + // logs.forEach(function (log) { + // console.log(JSON.stringify(log), '\n'); + // }); + // }); + // console.log('\n'); + // } await this.close(); });