searls / jasmine-maven-plugin

Maven plugin to execute Jasmine Specs. Creates your HTML runners for you, runs headlessly, outputs JUnit XML
http://searls.github.io/jasmine-maven-plugin
Other
290 stars 163 forks source link

htmlunit fails on querySelector #150

Closed robustican closed 11 years ago

robustican commented 11 years ago

The error we're seeing is

TypeError: Cannot find function querySelector in object [object HTMLDocument]

I've tried specifying htmlunit version 2.10 (as is specified at https://github.com/searls/jasmine-maven-plugin/issues/135) and using FIREFOX_3_6 as the browser version but we don't seem to be able to make it work.

I'm hoping that this stuff just works in the 1.3.1 release as htmlunit claims to support querySelector and querySelectorAll

klieber commented 11 years ago

@robustican Would you be able to provide a sample project that recreates the problem? I would assume this is probably not really a plugin issue and is strickly HtmlUnit related but I'd like to see exactly what you're doing. Thanks.

klieber commented 11 years ago

Sorry I accidentally closed this. Octodroid really needs a confirmation for the close button.

robustican commented 11 years ago

No problem. I agree, this probably has nothing to do with plugin except what javascript rendering library it uses. I put up a test project here - https://github.com/robustican/htmlunittest/

The problem shows up when the call to d3.select() is made at the bottom of src/test/js/unitTest.js

I know this is a long shot but is there a hack to use an alternate javascript renderer like phantom instead of htmlunit?

klieber commented 11 years ago

Not yet, but we're working on it. Keep an eye on #146 and milestone 1.3.1.1.

klieber commented 11 years ago

@robustican This should be fixed in the latest release of the plugin. We upgraded to a new version of Selenium/HtmlUnit and I just tried it with your example project and it worked fine. Here's the new config:

<plugin>
  <groupId>com.github.searls</groupId>
  <artifactId>jasmine-maven-plugin</artifactId>
  <version>1.3.1.0</version>
  <executions>
    <execution>
      <goals>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <sourceIncludes>
      <include>**/jquery*</include>
      <include>**/jasmine*</include>
      <include>**/*.js</include>
    </sourceIncludes>
    <jsSrcDir>src/main/js</jsSrcDir>
    <jsTestSrcDir>src/test/js</jsTestSrcDir>
  </configuration>
</plugin>

Also, if you run into further issues there is an even newer version of HtmlUnit out that has much better CSS3 support so you may want to override the plugin's version of HtmlUnit as suggested in #154.

robustican commented 11 years ago

Thanks for your help on this. Like the rest of the community, now looking forward to the 1.3.1.1 release and the phantom integration. I'm gonna download the code and browse issues to see if there's anything I can do to contribute.