Our app uses jQuery dialogs for modal popups. We're trying to write some unit tests for our javascript, and part of this is the creation of the dialogs. We're using Jasmine and the Jasmine Maven plugin. When running the tests in a browser, it all works fine. However, when we trying to run a headless execution of the tests (mvn jasmine:test
), the tests fail on the lines creating the dialog. There error looks something like this:
* TypeError: Cannot find function dialog in object [object Object].
The line this happens on is simply like this:
$(element).dialog(popupProperties);
If it helps, our pom.xml has this for the plugin:
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.2.0.0</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<preloadSources>
<source>${project.basedir}/src/main/webapp/resources/jquery.js</source>
<source>${project.basedir}/src/main/webapp/resources/jquery-ui.js</source>
<source>${project.basedir}/src/main/webapp/resources/angular.js</source>
<source>${project.basedir}/src/test/javascript/lib/angular-mocks.js</source>
<source>${project.basedir}/src/test/javascript/lib/jasmine-fixture.js</source>
</preloadSources>
<jsSrcDir>${project.basedir}/src/main/webapp/resources/</jsSrcDir>
<jsTestSrcDir>${project.basedir}/src/test/javascript/unit/</jsTestSrcDir>
</configuration>
</plugin>
Is there something we can do to get the headless execution working with the dialog stuff?