-
Notifications
You must be signed in to change notification settings - Fork 75
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
Test examples #658
Test examples #658
Conversation
Test the lines example. Add screenshot capabilities. This requires ImageMagick and expects the test to be run on the same computer or VM as the karma test server.
Example tests must have the examples built first. This required upgrading the node-fs-extra package.
Our examples use bootswatch, which is dependent on fonts.googleapi.com, so these tests require web access. Furthermore, the tests are brittle in that Firefox sometimes hasn't fully loaded the fonts when everything else is ready. It would be better if we used something like google-fonts-offline and rebuilt the bootswatch sass files to point to local versions of these files. |
In the future, as we add example tests, we'll probably want to reference local map tiles rather than ones from openstreetmap. This could be redirected to the karma server via a hosts entry in travis, for instance, but that doesn't conveniently extend to local testing. |
Current coverage is 88.86% (diff: 100%)
@@ line-rendering #658 diff @@
================================================
Files 84 84
Lines 8497 8497
Methods 0 0
Messages 0 0
Branches 0 0
================================================
- Hits 7660 7551 -109
- Misses 837 946 +109
Partials 0 0
|
+1. care to create an issue for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me 👍 but I would like to try out the branch and then will have a deeper look at it.
@@ -109,6 +109,12 @@ test command or set this parameter in CMake. | |||
build correctly. Try running ``ccmake /path/to/geojs`` for a full | |||
list of configuration options. | |||
|
|||
Examples should be tested by creating an entry in the ``tests/example-cases/`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
By using a proxy-auto-config file and some cleverness in the karma middleware, we can avoid external web access during the example tests. For now, I'll leave the reference to google fonts. |
This removes the network dependency to openstreetmap.org in the tests. As additional examples are added, the tiles.tgz file will need to be updated.
…t function for screen tests.
@manthey I am running into a minor issue: (via Google search I found an issue related to karma config but haven't tried it yet). Any thoughts? before I spent more time on it? Time: 1790ms |
The "FirefoxWithProxy" is defined in karma-base.js and uses the tests/data/proxy-for-tests.pac file. These worked in a Docker container without any issue, so I'm suspect your issue has something to do with either not building something or not having the correct dependencies installed. |
Can you run the ffheadless tests (that is, do the Firefox tests run that don't require a proxy)? |
Let me do a clean build, it is possible that my environment is corrupt because of my recent experimentation |
Much better but still seeing some issues webpack: bundle is now VALID. |
Do you have |
I thought I did but it looks like I didn't. Running again, thanks. |
@manthey and i spent some quality time together and for some reason it looks like the test is timing out even though it actually is producing the right image. I will file a bug so that I can get back to it in the future if still relevant. Other than that it LGTM (pending lines branch). |
Ref: #659 |
This adds tests for the lines example and a framework for testing examples in general (issue #329).
It renders the example to a browser, then takes a screenshot of the iframe that contains the example. The browser must be on the same machine as the karma test server for this to work.