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

Make tests pass with Grunt #10

Closed
avand opened this issue May 29, 2014 · 4 comments
Closed

Make tests pass with Grunt #10

avand opened this issue May 29, 2014 · 4 comments
Labels

Comments

@avand
Copy link
Owner

avand commented May 29, 2014

Currently the tests fail from grunt because document.cookie doesn't work correctly when running on the file system (e.g., file://). There should be a work around.

http://stackoverflow.com/questions/23926982/how-do-i-run-qunit-tests-with-grunt-through-a-local-server-instead-of-the-file-s

@avand avand added the bug label May 29, 2014
avand added a commit that referenced this issue Jun 9, 2014
Now, running `grunt test` will run `connect` which serves to boot up
a web server on localhost:8000. The tests are now a bit more honest
because they're running on http:// instead of file://. This is really
important for things like `document.cookie`, which don't work as
expected on file://.

http://cloud.avandamiri.com/3c3q3B3a1P2a (StackOverflow)
https://www.npmjs.org/package/grunt-contrib-connect
https://github.com/gruntjs/grunt-contrib-connect
https://github.com/gruntjs/grunt-contrib-qunit#testing-via-http-or-https
@avand
Copy link
Owner Author

avand commented Jun 9, 2014

I was able to get grunt test set up to first start a connect web server with grunt-contrib-connect and then run the tests against http://localhost:8000. This fixes the issues with document.cookie. However, it introduces issues with window.location. It appears that when PhantomJS is driving the session, Location is unknown. Is this because we're running heedlessly?
I
was able to get the tests to pass by modifying the code, defining Location when undefined but then they fail in the browser. It seems to me that the in-browser tests are more valuable so I'll continue to use that as my primary testing ground and revisit this issue again later.

@skorecky
Copy link
Contributor

Not sure if it's possible, but maybe run these tests in isolation so grunt test only runs test that'd don't need cookie or location?

@avand
Copy link
Owner Author

avand commented Oct 21, 2014

That's a good idea. I would want to indicate that in the test output somewhere also. Something to the effect of, "x, y, and z tests skipped — please run them in a browser."

@avand avand added the v2 label Jul 15, 2016
@avand
Copy link
Owner Author

avand commented Jul 16, 2016

Decided to just do away with command line tests for now. I want to look into how it's possible to get the tests running in-browser with Selenium and then have BrowserStack or SauceLabs run them. But for now, it's fine to just see them in-browser.

@avand avand closed this as completed Jul 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants