fix: execution too fast causes 'socket hang up'

This commit is contained in:
tiddlygit-test 2021-04-23 00:54:15 +08:00
parent e43e4a7f16
commit d3dfb7ef78
2 changed files with 17 additions and 15 deletions

View file

@ -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);

View file

@ -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();
});