From f3cf0250a34959657ba0cb17a2a42291d907154c Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 4 Oct 2016 18:11:25 +0200 Subject: [PATCH] Wait for test contract in a polling loop. --- test-browser/compiling.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test-browser/compiling.js b/test-browser/compiling.js index a98a923144..e88a749f39 100644 --- a/test-browser/compiling.js +++ b/test-browser/compiling.js @@ -10,8 +10,20 @@ module.exports = { pragma solidity ^0.4.0; contract TestContract { function f() returns (uint) { return 8; } } `) - .pause(3000) - .assert.containsText('.contract .title', 'TestContract') + var waitForElementToContainText = function (element, text, done) { + browser.getText(element, function (t) { + if (t.value.indexOf(text) < 0) { + browser.pause(500) + waitForElementToContainText(element, text, done) + } else { + done() + } + }) + } + browser.perform(function (done) { + waitForElementToContainText('.contract .title', 'TestContract', done) + }) + browser.assert.containsText('.contract .title', 'TestContract') .click('.create .constructor .call') .waitForElementPresent('.instance .call[title="f"]') .click('.instance .call[title="f"]')