There seems to be an issue running JavaScript tests in Jasmine 2.0. Jasmine 1.3.1 seems fine.
A simple test (assuming I'm not missing something) shows the issue:
public void runOnFileSystem() throws Exception {
HtmlPage page = webClient.getPage("file:///" + new File("C:/js/jasmine-standalone-2.0.0/SpecRunner.html").getAbsolutePath());
webClient.waitForBackgroundJavaScript(2000);
HtmlSpan span = (HtmlSpan)page.getFirstByXPath("//span[contains(@class,'passed')]");
System.out.println(span.asXml());
}
...output is:
0 specs, 0 failures
...instead of:
5 specs, 0 failures
Tested with the latest snapshot (htmlunit-2.15-20140503.091259).
I've made the Jasmine team aware of the issue at https://github.com/pivotal/jasmine/issues/586
Here's rough patch with a working test for Jasmine 1.3.1 and failing for Jasmine 2.0.0
Rather than use the patch, I've created a repository with the patch, and further, a branch at https://github.com/tntim96/htmlunit/tree/Jasmine2.0.0-debugging to help locate the issue.
I'm adding debug statements to the Jasmine code, running 'src/test/resources/libraries/Jasmine/2.0.0/SpecRunner.html' and then executing 'debug.getMsg()' to isolate statements where HtmlUnit seems to be stopping.
I've forked and committed a fix here: https://github.com/tntim96/htmlunit-rhino-fork/commit/7adc35228140e9af24601830e95425666cbd80e9
Can you manually merge this so my username gets in the history? I tried creating a pull-request, but Github seemed to get confused with all the forks.
BTW - a few tests failed, but should (heh) be unrelated. My Mozilla Rhino fork runs fine - will try to see if there's any real issue.
Last edit: tntim96 2014-05-13
Another commit at https://github.com/tntim96/htmlunit-rhino-fork/commit/cb5202cee781ee47109afdaddc650abcd11e517e to fix the source names.
Re: a few tests failed, but should (heh) be unrelated. My Mozilla Rhino fork runs fine
My Mozilla Rhino fork has all tests passing with the change
What is the problem with pull requests? I have no idea how to preserve the username when doing it manually.
I already have a fork of Rhino, and GitHub doesn't seem to support multiple forks.
You can clone from your fork at https://github.com/HtmlUnit/htmlunit-rhino-fork.git, and then pull from an arbitrary URL (i.e. mine) with:
git.exe pull -v --progress "https://github.com/tntim96/htmlunit-rhino-fork.git" master
You can then review the commits and then push to origin as normal if all is OK.
If you can wait a day, I'll incorporate the changes in my original fork and see if I can create a working pull-request from there.
I've created a pull request at https://github.com/HtmlUnit/htmlunit-rhino-fork/pull/1, but it's picking up other changes from Mozilla's Rhino that are not in you fork. You may have to use the method I've described above unless you're happy merging in those other changes.
The cleaner pull-request on Mozilla's Rhino is here https://github.com/mozilla/rhino/pull/139. To get this right for you, I'd have to create that commit in a branch before the other changes (i.e. at the point where HtmlUnit forked).
Last edit: tntim96 2014-05-20
I've created an isolated pull request that works for HtmlUnit-Rhino and Mozilla-Rhino
HtmlUnit-Rhino
https://github.com/HtmlUnit/htmlunit-rhino-fork/pull/2
Mozilla-Rhino
https://github.com/mozilla/rhino/pull/140
Fixed in SVN. Thanks for isolating the root cause.