Do not generate the DOM until the condition is right in order for the tests to pass