/*
 * (C) Copyright 2015 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import io.github.bonigarcia.wdm.Architecture;
import io.github.bonigarcia.wdm.PhantomJsDriverManager;

import java.nio.file.Paths;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;

/**
 * Test with Google Chrome browser.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.0.0
 */
public class PhantomJsTest extends ManagerTest {

	@BeforeClass
	public static void setupClass() {
		PhantomJsDriverManager.getInstance().setup((Architecture) null);
	}

	@Before
	public void setupTest() {
		PhantomJSDriverService service = new PhantomJSDriverService.Builder()
			.usingAnyFreePort()
			.usingPhantomJSExecutable(
				Paths.get(System.getProperty("phantomjs.binary.path")).toFile())
			.usingCommandLineArguments(new String[]{
				"--ignore-ssl-errors=true", "--ssl-protocol=tlsv1", "--web-security=false",
				"--webdriver-loglevel=INFO"})
			.build();
		DesiredCapabilities desireCaps = new DesiredCapabilities();
		driver = new PhantomJSDriver(service, desireCaps);
	}

	@After
	public void teardown() {
		if (driver != null) {
			driver.quit();
		}
	}

	@Test
	public void testChrome() {
		browseWikipedia();
	}

}

@@ -20,9 +20,9 @@
  201
-5
+6
  Bon
@@ -641,111 +641,8 @@
 t;%0A%0A
-import io.github.bonigarcia.wdm.Architecture;%0Aimport io.github.bonigarcia.wdm.PhantomJsDriverManager;%0A%0A
 impo
@@ -939,16 +939,73 @@
 ities;%0A%0A
+import io.github.bonigarcia.wdm.PhantomJsDriverManager;%0A%0A
 /**%0A * T
@@ -1098,11 +1098,11 @@
 e 1.
-0.0
+3.2
 %0A */
@@ -1250,27 +1250,8 @@
 tup(
-(Architecture) null
 );%0A%09
@@ -1360,24 +1360,25 @@
 uilder()%0A%09%09%09
+%09
 .usingAnyFre
@@ -1385,16 +1385,17 @@
 ePort()%0A
+%09
 %09%09%09.usin
@@ -1416,16 +1416,18 @@
 utable(%0A
+%09%09
 %09%09%09%09Path
@@ -1476,16 +1476,25 @@
 .path%22))
+%0A%09%09%09%09%09%09%09%09
 .toFile(
@@ -1496,16 +1496,17 @@
 File())%0A
+%09
 %09%09%09.usin
@@ -1539,18 +1539,21 @@
 String%5B%5D
+ 
 %7B%0A
+%09%09
 %09%09%09%09%22--i
@@ -1599,17 +1599,23 @@
 =tlsv1%22,
- 
+%0A%09%09%09%09%09%09
 %22--web-s
@@ -1629,21 +1629,17 @@
 =false%22,
-%0A%09%09%09%09
+ 
 %22--webdr
@@ -1661,11 +1661,13 @@
 NFO%22
+ 
 %7D)%0A
+%09
 %09%09%09.

Improve PhantomJsTest