mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-19 11:02:58 +00:00
Add helper for waiting for evaluated string
This commit is contained in:
parent
0a29d92aed
commit
c7902a6e29
@ -75,11 +75,8 @@ describe('Darkwire', () => {
|
||||
browser.click('span#send-message-btn', done);
|
||||
});
|
||||
|
||||
it('should send message', () => {
|
||||
browser.tabs.current = 0;
|
||||
browser.wait('1s', () => {
|
||||
browser.assert.text('.messageBody', /Hello world/);
|
||||
});
|
||||
it('should send message', (done) => {
|
||||
helpers.zombie.waitFor(browser, '$(".messageBody").text() === "Hello world"', done);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -44,6 +44,16 @@ var helpers = {
|
||||
return [1,2,3,4];
|
||||
}
|
||||
};
|
||||
},
|
||||
zombie: {
|
||||
waitFor: (browser, str, cb) => {
|
||||
let int = setInterval(() => {
|
||||
if (browser.evaluate(str)) {
|
||||
clearInterval(int);
|
||||
cb();
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user