Skip to content

Commit

Permalink
updating documentation for webDriverCapabilities changes
Browse files Browse the repository at this point in the history
  • Loading branch information
klieber committed Jan 9, 2014
1 parent 45edff1 commit 72c52bd
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,32 @@ public abstract class AbstractJasmineMojo extends AbstractMojo implements Jasmin
protected String webDriverClassName;

/**
* Web driver capabilities used to initialize a DesiredCapabilities instance when creating a web driver.
* <p/>
* This property will be ignored if org.openqa.selenium.htmlunit.HtmlUnitDriver is used; use the browserVersion
* property instead.
* <p/>
* For org.openqa.selenium.phantomjs.PhantomJSDriver, include "phantomjs.binary.path" if phantomJS is not in the
* system command path of the build machine.
* <p>Web driver capabilities used to initialize a DesiredCapabilities instance when creating a web driver.</p>
*
* <p>Capabilities value can be either a String, a List, or a Map.</p>
*
* <p>Example:</p>
* <pre>
* &lt;webDriverCapabilities&gt;
* &lt;capability&gt;
* &lt;name&gt;phantomjs.binary.path&lt;/name&gt;
* &lt;value&gt;/opt/phantomjs/bin/phantomjs&lt;/value&gt;
* &lt;/capability&gt;
* &lt;capability&gt;
* &lt;name&gt;phantomjs.cli.args&lt;/name&gt;
* &lt;list&gt;
* &lt;value&gt;--disk-cache=true&lt;/value&gt;
* &lt;value&gt;--max-disk-cache-size=256&lt;/value&gt;
* &lt;/list&gt;
* &lt;/capability&gt;
* &lt;capability&gt;
* &lt;name&gt;proxy&lt;/name&gt;
* &lt;map&gt;
* &lt;httpProxy&gt;myproxyserver.com:8000&lt;/httpProxy&gt;
* &lt;/map&gt;
* &lt;/capability&gt;
* &lt;/webDriverCapabilities&gt;
* </pre>
*
* @since 1.3.1.1
*/
Expand Down Expand Up @@ -274,6 +293,8 @@ public abstract class AbstractJasmineMojo extends AbstractMojo implements Jasmin
protected boolean keepServerAlive;

/**
* <p>Allows specifying which source files should be included and in what order.</p>
* <pre>
* &lt;sourceIncludes&gt;
* &lt;include&gt;vendor/&#42;&#42;/&#42;.js&lt;/include&gt;
* &lt;include&gt;myBootstrapFile.js&lt;/include&gt;
Expand Down
82 changes: 53 additions & 29 deletions src/site/markdown/phantomjs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Using with PhantomJS
===================================
====================
Starting with version `1.3.1.1` it is possible to configure the jasmine-maven-plugin to use [PhantomJS](http://phantomjs.org) instead of [HtmlUnit](http://htmlunit.sourceforge.net/) to execute your specs.

Here is an example configuration:
Expand All @@ -25,43 +25,66 @@ Here is an example configuration:
</plugins>
</build>
```
The above configuration assumes that the `phantomjs` binary is on your systems `PATH`.
The above configuration assumes that the `phantomjs` binary is on your systems `PATH`. If you would prefer, you can also specify the location of the binary using a configuration like this:

If you would prefer, you can also use [klieber's phantomjs-maven-plugin](https://github.com/klieber/phantomjs-maven-plugin) to pull down a version of phantomjs:
```
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>0.2.1</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<version>1.9.2</version>
</configuration>
</plugin>
<build>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>${jasmine-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<configuration>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
<webDriverCapabilities>
<capability>
<name>phantomjs.binary.path</name>
<value>/opt/phantomjs/bin/phantomjs</name>
</capability>
</webDriverCapabilities>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
```
If you use com.github.klieber.phantomjs-maven-plugin edit the jasmine-maven-plugin configuration to point to the phantomjs that gets installed dynamically:

```
<webDriverCapabilities>
<phantomjs.binary.path>${phantomjs.binary}</phantomjs.binary.path>
</webDriverCapabilities>
```
For more information on configuration options for PhantomJSDriver see its [documentation](https://github.com/detro/ghostdriver).

Automatically installing phantomjs
----------------------------------
One of the downsides of using phantomjs instead of HtmlUnit is it requires native binaries be present on the system you are running your build on. The [phantomjs-maven-plugin](https://klieber.github.io/phantomjs-maven-plugin) solves that problem by automatically pulling down phantomjs when needed.

If you would prefer, you can also specify the location of the binary using a configuration like this:
Here's an example using `phantomjs-maven-plugin` with the `jasmine-maven-plugin`:

```
<build>
<plugins>
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>${phantomjs-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<version>1.9.2</version>
</configuration>
</plugin>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>${jasmine-plugin-version}</version>
<version>${jasmine-maven-plugin-version}</version>
<executions>
<execution>
<goals>
Expand All @@ -70,7 +93,10 @@ If you would prefer, you can also specify the location of the binary using a con
<configuration>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
<webDriverCapabilities>
<phantomjs.binary.path>/opt/phantomjs/bin/phantomjs</phantomjs.binary.path>
<capability>
<name>phantomjs.binary.path</name>
<value>${phantomjs.binary}</name>
</capability>
</webDriverCapabilities>
</configuration>
</execution>
Expand All @@ -79,5 +105,3 @@ If you would prefer, you can also specify the location of the binary using a con
</plugins>
</build>
```

For more information on configuration options for PhantomJSDriver see its [documentation](https://github.com/detro/ghostdriver).

0 comments on commit 72c52bd

Please sign in to comment.