You need to use `waitsForDone()` on this promise or the following `expect()` will be executed before document is set.