I have defined several test cases in QUnit. The last of those test cases open a specific URL in a new window using window.open function and append the html content of body tag of the the newly opened page to the current page’s( on which tests are running) body tag.
Also, I need to execute that test case in the very end of execution of all other test cases. I am able to do this by setting the property QUnit.config.reorder to false.
The problem lies in the fact that I need to wait until the new page is loaded in the new window, before copying the body html(cause it takes time for the page to load). For this, I am using setTimeout to get the html content of the body tag after, say 3000ms, but in the mean time QUnit fails the test case because the assertion is present in the setTimeOut handler function.
1 Answer