From d14630f636f0829421c28dd51dabc9e8880c5df1 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 26 Jul 2018 08:59:34 -0400 Subject: [PATCH] use setInterval to wait for deploy complete --- test_apps/test_app/test/ens_spec.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test_apps/test_app/test/ens_spec.js b/test_apps/test_app/test/ens_spec.js index 200f2634..0b2d3cab 100644 --- a/test_apps/test_app/test/ens_spec.js +++ b/test_apps/test_app/test/ens_spec.js @@ -17,22 +17,28 @@ config({ "args": ["$ENSRegistry", rootNode], "onDeploy": [ `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => { - ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send(); - Resolver.methods.setAddr('${rootNode}', '${address}').send(); - })` + ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send(); + Resolver.methods.setAddr('${rootNode}', '${address}').send().then(() => { + global.ensTestReady = true; + }); + });` ] } } }); contract("ENS", function () { - this.timeout(0); + this.timeout(1000); before(function (done) { // Wait for onDeploy to finish - setTimeout(function () { + const wait = setInterval(() => { + if (!global.ensTestReady) { + return; + } + clearInterval(wait); done(); - }, 500); + }); }); it("should have registered embark.eth", async function () {