add utils.wait_for_idle in js tests

and use it in execute_cell_then, since there is not always output.
remove superfluous then
Merge pull request #4953 from minrk/wait-for-idle

add utils.wait_for_idle in js tests