[SOLVED] ChimpJS, how can I wait for .setValue() to complete?

Hello everyone,

I’m new to Meteor&React and all the tests concept.
I followed the documentation to use ChimpJS for my acceptance tests, everything works fine except for one thing.
When I use :

client.setValue("#input_data", “a very long text”);
instruction 2

sometimes this 2 instructions are executed correctly, and sometimes the instruction 2 is executed before the setValue function finish writing (this usually happens when I try to write a very long text to the input),
Is there any way to wait for setValue to finish execution ?

So, I solved this problem by doing something like this:
> client.setValue(selector, value);
> client.waitUntil(function () {
> var currentValue = client.getValue(selector);
> var valid = currentValue == this.value;
> if (!valid)
> client.setValue(selector, this.value);
> return valid;
> }.bind({value: value}), 10000, 2000);