diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/AppAccess.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/AppAccess.test.js index dad817699933606a743480f8a35b520350957411..ea1ff0b2a2561ea61e1c50c7baeba135ec348b49 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/AppAccess.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/AppAccess.test.js @@ -20,22 +20,25 @@ const STRCOUNT = 1025; const EACHTIMEOUT = 500; describe('ActsAccountAppAccess', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }) beforeEach(async function (done) { console.debug("====>beforeEach enter===="); - sleep(EACHTIMEOUT); + await sleep(EACHTIMEOUT); done(); }) diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/AssociatedData.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/AssociatedData.test.js index e876bd5d10b7d7f16aa0a3f3260eabd4b1851497..d647af7b0b0f9ed6af1854e4301a10da862b91db 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/AssociatedData.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/AssociatedData.test.js @@ -19,22 +19,25 @@ const TIMEOUT = 5000; const EACHTIMEOUT = 500; describe('ActsAccountAssociatedData', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }) beforeEach(async function (done) { console.debug("====>beforeEach enter===="); - sleep(EACHTIMEOUT); + await sleep(EACHTIMEOUT); done(); }) diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/CreatManager.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/CreatManager.test.js index 9dd6182c6631a8eaa5780530bc33793384721e46..9ced61338b6d2c0b4cba4eadf816f37886da9b77 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/CreatManager.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/CreatManager.test.js @@ -18,15 +18,18 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' const TIMEOUT = 5000; describe('ActsCreatAppAccountManager', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/Credential.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/Credential.test.js index babfc997ac4946457eb5679387c725cee414cdcd..cf57142461da796fad9cf51db83f4fbd04d9052b 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/Credential.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/Credential.test.js @@ -19,22 +19,25 @@ const TIMEOUT = 5000; const EACHTIMEOUT = 500; describe('ActsAccountCredential', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }) beforeEach(async function (done) { console.debug("====>beforeEach enter===="); - sleep(EACHTIMEOUT); + await sleep(EACHTIMEOUT); done(); }) diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/DeleteAccount.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/DeleteAccount.test.js index f463d95ba46e3bce0fddf12037de6312a10792fa..254a3daa36ae0c10bb0fb6b59b29156b69c59736 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/DeleteAccount.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/DeleteAccount.test.js @@ -19,15 +19,18 @@ const NAMELIMIT = 512; const TIMEOUT = 5000; describe('ActsAccountDeleteAccount', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js index a4a695e11096969ad2edd15bc72b2f7e68ba7e0f..ea6f39de2e901aeda58e721352a6b7ace1844855 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js @@ -19,22 +19,25 @@ const TIMEOUT = 5000; const EACHTIMEOUT = 500; describe('ActsAccountSetGetExtraInfo', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }) beforeEach(async function (done) { console.debug("====>beforeEach enter===="); - sleep(EACHTIMEOUT); + await sleep(EACHTIMEOUT); done(); }) diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/NoPermission.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/NoPermission.test.js index 7080d8a60d8af3338320f5f262624c45e598f8d9..9af1c31915937ae94af2867a98ce5eecf75940d8 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/NoPermission.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/NoPermission.test.js @@ -19,15 +19,17 @@ const TIMEOUT = 5000; const ERR_APPACCOUNT_SERVICE_PERMISSION_DENIED = 4521993; describe('ActsAccountNoPermission', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } - beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js index 5027b8a185b7ee199e927745dd960937a0950755..82685f048445308d8768bc3b5c4680c8d92ed929 100644 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js @@ -30,22 +30,25 @@ const OWNERSELF = "com.example.actsaccounttest"; describe('ActsAccountOAuthToken', function () { function sleep(delay) { - var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) } beforeAll(async function (done) { console.debug("====>beforeAll start===="); - sleep(TIMEOUT); + await sleep(TIMEOUT); console.debug("====>beforeAll end===="); done(); }); beforeEach(async function (done) { console.debug("====>beforeAll enter===="); - sleep(EACHTIMEOUT); + await sleep(EACHTIMEOUT); done(); }); diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/test/OnOff.js b/account/appaccount/actsaccounttest/entry/src/main/js/test/OnOff.js index c2c32ab9dd9e7fa373cbeb3c7d8f08c1c3c08dad..8fbf7b6d0e9183fcc5c24146e90b42b58d3c8b56 100755 --- a/account/appaccount/actsaccounttest/entry/src/main/js/test/OnOff.js +++ b/account/appaccount/actsaccounttest/entry/src/main/js/test/OnOff.js @@ -20,6 +20,15 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' const TIMEOUT = 5000; 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) { console.debug("====>startAbility start===="); await featureAbility.startAbility( @@ -35,7 +44,8 @@ describe('ActsAccountChangeOnOff', async function () { }, }, ); - setTimeout(done(), TIMEOUT); + await sleep(TIMEOUT); + done(); }); /*