From a583e33e08a75222d1f1abdcb52b421a96900e0b Mon Sep 17 00:00:00 2001 From: Savka Oleg Date: Wed, 22 Sep 2021 16:18:54 +0300 Subject: [PATCH] CBS-2323 Add ability to define time to wait until performing Re-run failed test --- src/lib/cli-util.js | 1 + src/ox_reporters/reporter-xml.js | 1 + src/runners/oxygen/index.js | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/cli-util.js b/src/lib/cli-util.js index 3c658d5a..0afcb87a 100644 --- a/src/lib/cli-util.js +++ b/src/lib/cli-util.js @@ -148,6 +148,7 @@ export function getConfigurations(target, argv) { appiumUrl : 'http://localhost:4723/wd/hub', reopenSession: false, reRunOnFailed: false, + reRunOnFailedWaitUntil: false, iterations : 1, debugPort: null, delay: null, diff --git a/src/ox_reporters/reporter-xml.js b/src/ox_reporters/reporter-xml.js index da55f762..130bc4b2 100644 --- a/src/ox_reporters/reporter-xml.js +++ b/src/ox_reporters/reporter-xml.js @@ -57,6 +57,7 @@ export default class XmlReporter extends FileReporterBase { appiumUrl: result.options.appiumUrl, reopenSession: result.options.reopenSession, reRunOnFailed: result.options.reRunOnFailed, + reRunOnFailedWaitUntil: result.options.reRunOnFailedWaitUntil, iterations: result.options.iterations, debugPort: result.options.debugPort, delay: result.options.delay, diff --git a/src/runners/oxygen/index.js b/src/runners/oxygen/index.js index 11b589fc..da432ca9 100644 --- a/src/runners/oxygen/index.js +++ b/src/runners/oxygen/index.js @@ -16,7 +16,7 @@ import { EventEmitter } from 'events'; import _ from 'lodash'; import { defer } from 'when'; import path from 'path'; - +import deasync from 'deasync'; import TestSuiteResult from '../../model/suite-result'; import TestCaseResult from '../../model/case-result'; import TestResult from '../../model/test-result'; @@ -445,6 +445,10 @@ export default class OxygenRunner extends EventEmitter { } if (caseResult.status === Status.FAILED && this._options.reRunOnFailed && reRunCount === 0) { + if (this._options.reRunOnFailedWaitUntil) { + deasync.sleep(this._options.reRunOnFailedWaitUntil * 1000); + } + reRunCount = 1; // failed on canceled status not close browser window await (this._worker && this._worker_DisposeModules('passed'));