IDEMPIERE-92 Implement Selenium testing framework. Added phantomjs (phantomjs.org) support.

This commit is contained in:
Heng Sin Low 2013-05-26 10:02:58 +08:00
parent 8dc72ff920
commit 38b904b269
5 changed files with 29 additions and 2 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/phantomjsdriver-1.0.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/selenium-server-standalone-2.31.0.jar" sourcepath="lib/selenium-server-2.31.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/fitlibraryweb-2.0.jar" sourcepath="lib/fitlibraryweb-2.0-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.16.jar"/>

View File

@ -18,7 +18,8 @@ Bundle-ClassPath: .,
lib/fitnesse.jar,
lib/log4j-1.2.16.jar,
lib/fitlibraryweb-2.0.jar,
lib/selenium-server-standalone-2.31.0.jar
lib/selenium-server-standalone-2.31.0.jar,
lib/phantomjsdriver-1.0.3.jar
Web-ContextPath: fitnesse
Export-Package: fit,
fit.decorator,
@ -300,6 +301,7 @@ Export-Package: fit,
org.openqa.selenium.logging.profiler,
org.openqa.selenium.net,
org.openqa.selenium.os,
org.openqa.selenium.phantomjs,
org.openqa.selenium.remote,
org.openqa.selenium.remote.html5,
org.openqa.selenium.remote.internal,

View File

@ -7,4 +7,5 @@ bin.includes = META-INF/,\
lib/log4j-1.2.16.jar,\
lib/fitlibraryweb-2.0.jar,\
WEB-INF/,\
lib/selenium-server-standalone-2.31.0.jar
lib/selenium-server-standalone-2.31.0.jar,\
lib/phantomjsdriver-1.0.3.jar

View File

@ -301,6 +301,7 @@ Import-Package: fit,
org.openqa.selenium.logging.profiler,
org.openqa.selenium.net,
org.openqa.selenium.os,
org.openqa.selenium.phantomjs,
org.openqa.selenium.remote,
org.openqa.selenium.remote.html5,
org.openqa.selenium.remote.internal,

View File

@ -8,8 +8,11 @@ import java.util.List;
import org.idempiere.ui.zk.selenium.Widget;
import org.idempiere.ui.zk.selenium.Zk;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import fitlibrary.annotation.SimpleAction;
import fitlibrary.spider.AbstractSpiderFixture;
@ -272,6 +275,25 @@ public class ZkFixture extends SpiderFixture {
@Override
public WebDriver webDriver() {
if (webDriver == null) {
String driver = getDynamicVariable(WEB_DRIVER_VARIABLE_NAME,"htmlunit").toString();
if ("phantomjs".equals(driver)) {
webDriver = phantomjsDriver();
return webDriver;
}
}
return super.webDriver();
}
private WebDriver phantomjsDriver() {
return new PhantomJSDriver(new DesiredCapabilities());
}
class ZkFinder implements Finder {
@Override