未验证 提交 d3521707 编写于 作者: O openharmony_ci 提交者: Gitee

!3450 modify sleep logic in app account xts

Merge pull request !3450 from jidong/dev
...@@ -20,22 +20,25 @@ const STRCOUNT = 1025; ...@@ -20,22 +20,25 @@ const STRCOUNT = 1025;
const EACHTIMEOUT = 500; const EACHTIMEOUT = 500;
describe('ActsAccountAppAccess', function () { describe('ActsAccountAppAccess', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}) })
beforeEach(async function (done) { beforeEach(async function (done) {
console.debug("====>beforeEach enter===="); console.debug("====>beforeEach enter====");
sleep(EACHTIMEOUT); await sleep(EACHTIMEOUT);
done(); done();
}) })
......
...@@ -19,22 +19,25 @@ const TIMEOUT = 5000; ...@@ -19,22 +19,25 @@ const TIMEOUT = 5000;
const EACHTIMEOUT = 500; const EACHTIMEOUT = 500;
describe('ActsAccountAssociatedData', function () { describe('ActsAccountAssociatedData', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}) })
beforeEach(async function (done) { beforeEach(async function (done) {
console.debug("====>beforeEach enter===="); console.debug("====>beforeEach enter====");
sleep(EACHTIMEOUT); await sleep(EACHTIMEOUT);
done(); done();
}) })
......
...@@ -18,15 +18,18 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' ...@@ -18,15 +18,18 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
const TIMEOUT = 5000; const TIMEOUT = 5000;
describe('ActsCreatAppAccountManager', function () { describe('ActsCreatAppAccountManager', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}); });
......
...@@ -19,22 +19,25 @@ const TIMEOUT = 5000; ...@@ -19,22 +19,25 @@ const TIMEOUT = 5000;
const EACHTIMEOUT = 500; const EACHTIMEOUT = 500;
describe('ActsAccountCredential', function () { describe('ActsAccountCredential', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}) })
beforeEach(async function (done) { beforeEach(async function (done) {
console.debug("====>beforeEach enter===="); console.debug("====>beforeEach enter====");
sleep(EACHTIMEOUT); await sleep(EACHTIMEOUT);
done(); done();
}) })
......
...@@ -19,15 +19,18 @@ const NAMELIMIT = 512; ...@@ -19,15 +19,18 @@ const NAMELIMIT = 512;
const TIMEOUT = 5000; const TIMEOUT = 5000;
describe('ActsAccountDeleteAccount', function () { describe('ActsAccountDeleteAccount', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}); });
......
...@@ -19,22 +19,25 @@ const TIMEOUT = 5000; ...@@ -19,22 +19,25 @@ const TIMEOUT = 5000;
const EACHTIMEOUT = 500; const EACHTIMEOUT = 500;
describe('ActsAccountSetGetExtraInfo', function () { describe('ActsAccountSetGetExtraInfo', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}) })
beforeEach(async function (done) { beforeEach(async function (done) {
console.debug("====>beforeEach enter===="); console.debug("====>beforeEach enter====");
sleep(EACHTIMEOUT); await sleep(EACHTIMEOUT);
done(); done();
}) })
......
...@@ -19,15 +19,17 @@ const TIMEOUT = 5000; ...@@ -19,15 +19,17 @@ const TIMEOUT = 5000;
const ERR_APPACCOUNT_SERVICE_PERMISSION_DENIED = 4521993; const ERR_APPACCOUNT_SERVICE_PERMISSION_DENIED = 4521993;
describe('ActsAccountNoPermission', function () { describe('ActsAccountNoPermission', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}); });
......
...@@ -30,22 +30,25 @@ const OWNERSELF = "com.example.actsaccounttest"; ...@@ -30,22 +30,25 @@ const OWNERSELF = "com.example.actsaccounttest";
describe('ActsAccountOAuthToken', function () { describe('ActsAccountOAuthToken', function () {
function sleep(delay) { function sleep(delay) {
var start = (new Date()).getTime(); return new Promise((resolve, reject) => {
while((new Date()).getTime() - start < delay) { setTimeout(() => {
continue; resolve()
} }, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
} }
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>beforeAll start===="); console.debug("====>beforeAll start====");
sleep(TIMEOUT); await sleep(TIMEOUT);
console.debug("====>beforeAll end===="); console.debug("====>beforeAll end====");
done(); done();
}); });
beforeEach(async function (done) { beforeEach(async function (done) {
console.debug("====>beforeAll enter===="); console.debug("====>beforeAll enter====");
sleep(EACHTIMEOUT); await sleep(EACHTIMEOUT);
done(); done();
}); });
......
...@@ -20,6 +20,15 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' ...@@ -20,6 +20,15 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
const TIMEOUT = 5000; const TIMEOUT = 5000;
describe('ActsAccountChangeOnOff', async function () { describe('ActsAccountChangeOnOff', async function () {
function sleep(delay) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
}
beforeAll(async function (done) { beforeAll(async function (done) {
console.debug("====>startAbility start===="); console.debug("====>startAbility start====");
await featureAbility.startAbility( await featureAbility.startAbility(
...@@ -35,7 +44,8 @@ describe('ActsAccountChangeOnOff', async function () { ...@@ -35,7 +44,8 @@ describe('ActsAccountChangeOnOff', async function () {
}, },
}, },
); );
setTimeout(done(), TIMEOUT); await sleep(TIMEOUT);
done();
}); });
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册