mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
better retry strategy for query service e2e (#5626)
* better retry API startegy * better retry API startegy
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
function beforeAllRewrite() {
|
||||
|
||||
const originalBeforeAll = global.beforeAll;
|
||||
|
||||
// tslint:disable-next-line
|
||||
global.beforeAll = function (beforeAllFunction, timeout) {
|
||||
const wrapClbk = async (done) => {
|
||||
try {
|
||||
await beforeAllFunction(done);
|
||||
} catch (error) {
|
||||
console.log('Error Before all second attempt in 10 sec');
|
||||
sleep(10000);
|
||||
try {
|
||||
await beforeAllFunction(done);
|
||||
} catch (e) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Error Before all second attempt fail all' + JSON.stringify(error));
|
||||
await expect(true).toBe(false);
|
||||
}
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
originalBeforeAll(wrapClbk, timeout);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function afterAllRewrite() {
|
||||
|
||||
const originalAfterAll = global.afterAll;
|
||||
|
||||
// tslint:disable-next-line
|
||||
global.afterAll = function (afterAllFunction, timeout) {
|
||||
const wrapClbk = async (done) => {
|
||||
try {
|
||||
await afterAllFunction(done);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Error After all' + JSON.stringify(error));
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
originalAfterAll(wrapClbk, timeout);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function beforeEachAllRewrite() {
|
||||
|
||||
const originalBeforeEach = global.beforeEach;
|
||||
|
||||
// tslint:disable-next-line
|
||||
global.beforeEach = function (beforeEachFunction, timeout) {
|
||||
const wrapClbk = async (done) => {
|
||||
try {
|
||||
await beforeEachFunction(done);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Error before Each' + JSON.stringify(error));
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
originalBeforeEach(wrapClbk, timeout);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function afterEachAllRewrite() {
|
||||
|
||||
const originalAfterEach = global.afterEach;
|
||||
|
||||
// tslint:disable-next-line
|
||||
global.afterEach = function (afterEachFunction, timeout) {
|
||||
const wrapClbk = async (done) => {
|
||||
try {
|
||||
await afterEachFunction(done);
|
||||
} catch (error) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log('Error After each' + JSON.stringify(error));
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
originalAfterEach(wrapClbk, timeout);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function sleep(delay) {
|
||||
var start = new Date().getTime();
|
||||
while (new Date().getTime() < start + delay) ;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
beforeAllRewrite: beforeAllRewrite,
|
||||
afterAllRewrite: afterAllRewrite,
|
||||
beforeEachAllRewrite: beforeEachAllRewrite,
|
||||
afterEachAllRewrite: afterEachAllRewrite
|
||||
};
|
Reference in New Issue
Block a user