Skip to content

Commit

Permalink
Merge pull request webmetrics#57 from andyclark/feature/alternative-p…
Browse files Browse the repository at this point in the history
…hantom-js-fetcher

Improved auto-fetch of PhantomJS if absent
  • Loading branch information
lightbody committed Jan 20, 2014
2 parents 7a27a03 + db2812a commit ea8cd74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
34 changes: 5 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,35 +138,6 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Fetch PhantomJS for us -->
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>0.2.1</version>
<executions>
<execution>
<id>fetch-phantom-js</id>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Fetch this version of PhantomJS -->
<version>1.9.2</version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<!-- Make downloaded PhantomJS available to tests -->
<systemPropertyVariables>
<phantomjs.binary.path>${phantomjs.binary}</phantomjs.binary.path>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down Expand Up @@ -300,6 +271,11 @@
<version>2013.10</version>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-phantom-driver</artifactId>
<version>1.1.1.Final</version>
</dependency>
</dependencies>

<reporting>
Expand Down
14 changes: 12 additions & 2 deletions src/test/java/net/lightbody/bmp/proxy/PhantomJSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.lightbody.bmp.core.har.HarEntry;

import org.hamcrest.CoreMatchers;
import org.jboss.arquillian.phantom.resolver.ResolvingPhantomJSDriverService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -44,7 +45,11 @@ public void basicBasic() throws Exception {

capabilities.setCapability(CapabilityType.PROXY, proxy);

PhantomJSDriver driver = new PhantomJSDriver(capabilities);
// ResolvingPhantomJSDriverService downloads PhantomJS if it's not found
PhantomJSDriver driver = new PhantomJSDriver(
ResolvingPhantomJSDriverService
.createDefaultService(capabilities),
capabilities);

try {
server.newHar("Yahoo");
Expand Down Expand Up @@ -78,7 +83,12 @@ public void basicSsl() throws Exception {
capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] {"--ignore-ssl-errors=true", "--ssl-protocol=any"});
capabilities.setCapability(CapabilityType.PROXY, proxy);

PhantomJSDriver driver = new PhantomJSDriver(capabilities);
// ResolvingPhantomJSDriverService downloads PhantomJS if it's not found
PhantomJSDriver driver = new PhantomJSDriver(
ResolvingPhantomJSDriverService
.createDefaultService(capabilities),
capabilities);

try {
server.newHar("Google");

Expand Down

0 comments on commit ea8cd74

Please sign in to comment.