Skip to content
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

Better full page reload failures #37

Closed
supersonicclay opened this issue Dec 28, 2015 · 10 comments
Closed

Better full page reload failures #37

supersonicclay opened this issue Dec 28, 2015 · 10 comments

Comments

@supersonicclay
Copy link
Contributor

If some tests accidentally do a full page refresh, karma-dots-reporter reports the error, but karma-mocha-reporter doesn't make the failure as clear.

With dots reporter:

..............................................................................
PhantomJS 1.9.8 (Windows 7 0.0.0) ERROR
  Some of your tests did a full page reload!
PhantomJS 1.9.8 (Windows 7 0.0.0): Executed 78 of 135 ERROR (0.2 secs / 0.2 secs)

With mocha reporter:

PhantomJS 1.9.8 (Windows 7 0.0.0) ERROR
  Some of your tests did a full page reload!
Finished in 0.222 secs / 0.217 secs
SUMMARY:
√ 78 tests completed

A better report would be:

PhantomJS 1.9.8 (Windows 7 0.0.0) ERROR
  Some of your tests did a full page reload!
Finished in 0.222 secs / 0.217 secs
SUMMARY:
√ 78 tests completed
× 57 test failed
@4kochi
Copy link
Collaborator

4kochi commented Dec 29, 2015

Can you please provide a test case which does the full page reload so that we can reproduce the behavior. That would help us a lot.

@supersonicclay
Copy link
Contributor Author

I would think a test like this would reproduce it. However, I've so far not been able to reproduce with your demo tests.

describe('thing', function() {
    it('should do stuff', function() {
        window.location.reload();
    });    
});

@supersonicclay
Copy link
Contributor Author

See this issue for more discussion of this karma error:

karma-runner/karma#1101

@supersonicclay
Copy link
Contributor Author

I was able to reproduce with this test:

describe('thing', function() {
    it('should do stuff', function() {
        window.location.reload();
        expect(1+1).toEqual(2);
    });    
});

output is this:

START:
29 12 2015 11:35:39.293:WARN [karma]: Port 9876 in use
29 12 2015 11:35:39.297:INFO [karma]: Karma v0.13.16 server started at http://localhost:9877/
29 12 2015 11:35:39.303:INFO [launcher]: Starting browser PhantomJS
29 12 2015 11:35:39.824:INFO [PhantomJS 1.9.8 (Windows 7 0.0.0)]: Connected on socket SPElEECVbW6K94
R5AAAA with id 12782191
thing
    √ should do stuff

Finished in 0.004 secs / 0.002 secs

SUMMARY:
√ 1 test completed
PhantomJS 1.9.8 (Windows 7 0.0.0) ERROR
Some of your tests did a full page reload!

Finished in 0.021 secs / 0.002 secs

SUMMARY:
√ 1 test completed
Warning: Task "karma:success" failed. Used --force, continuing.

Done, but with warnings.

@4kochi
Copy link
Collaborator

4kochi commented Dec 29, 2015

Thanks for the test case. I could easily reproduce the problem. But it is a bit tricky. Interestingly the onRunComplete method is called twice in this case, so the summary is printed twice. Also the test itself is successful for karma, so it is completed successful but the message with the full page reload is also printed.

I changed the handling in the onRunComplete method and hope the output is better now. Let me know if this acceptable for you.

START:
29 12 2015 21:19:55.379:INFO [karma]: Karma v0.13.16 server started at http://localhost:9876/
29 12 2015 21:19:55.385:INFO [launcher]: Starting browser PhantomJS
29 12 2015 21:19:57.008:INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket JdUrzi4k9z9lGV5pAAAA with id 72983911
  thing
    ✔ should do stuff
    ✔ should do other stuff

Finished in 0.005 secs / 0.001 secs

SUMMARY:
✔ 2 tests completed
PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  Some of your tests did a full page reload!

✖ Error while running the tests! Exit code: 1

Warning: Task "karma:reload" failed. Use --force to continue.

Aborted due to warnings.

@supersonicclay
Copy link
Contributor Author

Assuming the x and Error while running the tests are in red when colored I think that'd be great!

@4kochi
Copy link
Collaborator

4kochi commented Dec 30, 2015

Yes, they are.

@4kochi 4kochi closed this as completed in 081fb69 Dec 30, 2015
@4kochi
Copy link
Collaborator

4kochi commented Dec 30, 2015

Published as v1.1.5

@maruthi1255
Copy link

Please update fix for the following issue.

PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
Some of your tests did a full page reload

@4kochi
Copy link
Collaborator

4kochi commented Aug 26, 2016

The error comes from karma. It has nothing to to with the reporter. Maybe you should update to the latest version of karma and PhantomJS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants