-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests start executing before page is loaded #1403
Comments
Guys should we wait event \cc @karma-runner/contributors |
Yes please :-) 👍 |
Yes please |
+1 Or karma can be configured to not start automatically. |
+1 |
2 similar comments
+1 |
+1 |
Have you tried to add something like beforeAll((done) => {
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM fully loaded and parsed");
done();
});
}); |
Also: if you are using an asynchronous framework like angular, then you need to schedule your tests after the framework initializes, which of course is framework dependent (not DOM load dependent really). |
I am using karma-jasmine: 0.3.5. I have tests that run perfectly from a HTML runner that loads jasmine 2.2 but when I run them through karma using karma-jasmine they fail. I have investigated the problem and it seems that the tests start executing before the DOM is ready (which is not the case when run from a HTML runner). After updating the createStartFn function in the adapter.js file to the code below which waits for the DOM ready the tests started passsing.
Look at the discussion about the issue here
The text was updated successfully, but these errors were encountered: