[WIP] Fix integration tests

This only fixes errors, not failures.
@antoviaque Yup, it is. I haven't find anything reliable, although I have an idea for a future task.

Basically, it's about adding a semaphore element to the webpage that counts the number of open AJAX requests. (After that, Selenium could just query it.)