[seam-commits] Seam SVN: r12326 - branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Mar 30 07:05:53 EDT 2010
Author: mgencur at redhat.com
Date: 2010-03-30 07:05:52 -0400 (Tue, 30 Mar 2010)
New Revision: 12326
Added:
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/InternetExplorerAjaxDriver.java
Modified:
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriver.java
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverFactory.java
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverTest.java
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebElement.java
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/DelegatedWebElement.java
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/FirefoxAjaxDriver.java
Log:
JBSEAM-4610 added iexlorer driver and licensing
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriver.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriver.java 2010-03-30 10:32:50 UTC (rev 12325)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriver.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.example.common.test.webdriver;
import org.openqa.selenium.By;
@@ -11,10 +32,8 @@
*/
public interface AjaxWebDriver extends WebDriver
{
-
- //@Override
public AjaxWebElement findElement(By by);
-
+
public void setWaitTime(int millis);
public boolean isElementPresent(By by);
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverFactory.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverFactory.java 2010-03-30 10:32:50 UTC (rev 12325)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverFactory.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.example.common.test.webdriver;
/**
@@ -17,6 +38,13 @@
{
return new FirefoxAjaxDriver();
}
+ },
+ iexplorer
+ {
+ public AjaxWebDriver getDriver()
+ {
+ return new InternetExplorerAjaxDriver();
+ }
};
public abstract AjaxWebDriver getDriver();
@@ -28,9 +56,13 @@
return Browser.firefox.getDriver();
}
+ if(browser.contains("explore")) {
+ return Browser.iexplorer.getDriver();
+ }
+
return Browser.valueOf(browser).getDriver();
}
-
+
public static final String availableBrowsers()
{
StringBuilder sb = new StringBuilder();
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverTest.java 2010-03-30 10:32:50 UTC (rev 12325)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebDriverTest.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.example.common.test.webdriver;
import static org.testng.Assert.fail;
@@ -19,11 +40,9 @@
protected String serverURL;
protected String contextPath;
protected String browser;
-
+
@BeforeMethod
- @Parameters(value = {
- "browser", "server.url", "context.path"
- })
+ @Parameters(value = { "browser", "server.url", "context.path" })
public void createDriver(String browser, String serverURL, String contextPath)
{
try
@@ -38,16 +57,16 @@
{
fail("Unable to instantiate browser of type: " + browser + ", available browsers are: " + AjaxWebDriverFactory.availableBrowsers());
}
-
+
this.serverURL = serverURL;
this.contextPath = contextPath;
this.browser = browser;
}
-
+
@AfterMethod
public void closeDriver()
{
driver.close();
}
-
+
}
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebElement.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebElement.java 2010-03-30 10:32:50 UTC (rev 12325)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/AjaxWebElement.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.example.common.test.webdriver;
import org.openqa.selenium.By;
@@ -11,17 +32,17 @@
*/
public interface AjaxWebElement extends WebElement
{
-
+
public static final int DEFAULT_WAIT_TIME = 3000;
-
- //@Override
+
+ // @Override
public AjaxWebElement findElement(By by);
-
+
public void setWaitTime(int millis);
-
+
public void clickAndWait();
public void clickAndWait(int millis);
-
+
public void clearAndSendKeys(CharSequence... keysToSend);
}
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/DelegatedWebElement.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/DelegatedWebElement.java 2010-03-30 10:32:50 UTC (rev 12325)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/DelegatedWebElement.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.example.common.test.webdriver;
import java.util.ArrayList;
@@ -3,5 +24,4 @@
import java.util.Collections;
import java.util.List;
-
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@@ -13,130 +33,158 @@
* @author kpiwko
*
*/
-public class DelegatedWebElement implements AjaxWebElement {
-
- private int waitTime;
- private WebElement element;
-
- public DelegatedWebElement(WebElement element) {
- this(element, DEFAULT_WAIT_TIME);
- }
-
- public DelegatedWebElement(WebElement element, int waitTime) {
- this.element = element;
- this.waitTime = waitTime;
- }
-
- //@Override
- public void clear() {
- element.clear();
- }
-
- //@Override
- public void clearAndSendKeys(CharSequence...keysToSend) {
- element.clear();
- element.sendKeys(keysToSend);
- }
-
- //@Override
- public void click() {
- element.click();
- }
-
- //@Override
- public void clickAndWait() {
- element.click();
- try {
- Thread.sleep(waitTime);
- } catch (InterruptedException e) {
- }
- }
-
- public void clickAndWait(int millis) {
- element.click();
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e) {
- }
- }
-
- //@Override
- public AjaxWebElement findElement(By by) {
- return new DelegatedWebElement(element.findElement(by));
- }
-
- //@Override
- public List<WebElement> findElements(By by) {
- List<WebElement> elements = new ArrayList<WebElement>();
- List<WebElement> original = element.findElements(by);
- if (original == null || original.size() == 0)
- return Collections.emptyList();
-
- for (WebElement e : original)
- elements.add(new DelegatedWebElement(e));
-
- return elements;
- }
-
- //@Override
- public String getAttribute(String name) {
- return element.getAttribute(name);
- }
-
- @Deprecated
- //@Override
- public String getElementName() {
- return element.getElementName();
- }
-
- //@Override
- public String getTagName() {
- return element.getTagName();
- }
-
- //@Override
- public String getText() {
- return element.getText();
- }
-
- //@Override
- public String getValue() {
- return element.getValue();
- }
-
- //@Override
- public boolean isEnabled() {
- return element.isEnabled();
- }
-
- //@Override
- public boolean isSelected() {
- return element.isSelected();
- }
-
- //@Override
- public void sendKeys(CharSequence... keysToSend) {
- element.sendKeys(keysToSend);
- }
-
- //@Override
- public void setSelected() {
- element.setSelected();
- }
-
- //@Override
- public void setWaitTime(int millis) {
- this.waitTime = millis;
- }
-
- //@Override
- public void submit() {
- element.submit();
- }
-
- //@Override
- public boolean toggle() {
- return element.toggle();
- }
-
+public class DelegatedWebElement implements AjaxWebElement
+{
+
+ private int waitTime;
+ private WebElement element;
+
+ public DelegatedWebElement(WebElement element)
+ {
+ this(element, DEFAULT_WAIT_TIME);
+ }
+
+ public DelegatedWebElement(WebElement element, int waitTime)
+ {
+ this.element = element;
+ this.waitTime = waitTime;
+ }
+
+ // @Override
+ public void clear()
+ {
+ element.clear();
+ }
+
+ // @Override
+ public void clearAndSendKeys(CharSequence... keysToSend)
+ {
+ element.clear();
+ element.sendKeys(keysToSend);
+ }
+
+ // @Override
+ public void click()
+ {
+ element.click();
+ }
+
+ // @Override
+ public void clickAndWait()
+ {
+ element.click();
+ try
+ {
+ Thread.sleep(waitTime);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ public void clickAndWait(int millis)
+ {
+ element.click();
+ try
+ {
+ Thread.sleep(millis);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ // @Override
+ public AjaxWebElement findElement(By by)
+ {
+ return new DelegatedWebElement(element.findElement(by));
+ }
+
+ // @Override
+ public List<WebElement> findElements(By by)
+ {
+ List<WebElement> elements = new ArrayList<WebElement>();
+ List<WebElement> original = element.findElements(by);
+ if (original == null || original.size() == 0)
+ return Collections.emptyList();
+
+ for (WebElement e : original)
+ elements.add(new DelegatedWebElement(e));
+
+ return elements;
+ }
+
+ // @Override
+ public String getAttribute(String name)
+ {
+ return element.getAttribute(name);
+ }
+
+ @Deprecated
+ // @Override
+ public String getElementName()
+ {
+ return element.getElementName();
+ }
+
+ // @Override
+ public String getTagName()
+ {
+ return element.getTagName();
+ }
+
+ // @Override
+ public String getText()
+ {
+ return element.getText();
+ }
+
+ // @Override
+ public String getValue()
+ {
+ return element.getValue();
+ }
+
+ // @Override
+ public boolean isEnabled()
+ {
+ return element.isEnabled();
+ }
+
+ // @Override
+ public boolean isSelected()
+ {
+ return element.isSelected();
+ }
+
+ // @Override
+ public void sendKeys(CharSequence... keysToSend)
+ {
+ element.sendKeys(keysToSend);
+ }
+
+ // @Override
+ public void setSelected()
+ {
+ element.setSelected();
+ }
+
+ // @Override
+ public void setWaitTime(int millis)
+ {
+ this.waitTime = millis;
+ }
+
+ // @Override
+ public void submit()
+ {
+ element.submit();
+ }
+
+ // @Override
+ public boolean toggle()
+ {
+ return element.toggle();
+ }
+
}
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/FirefoxAjaxDriver.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/FirefoxAjaxDriver.java 2010-03-30 10:32:50 UTC (rev 12325)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/FirefoxAjaxDriver.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.example.common.test.webdriver;
import org.openqa.selenium.By;
@@ -6,26 +27,26 @@
public class FirefoxAjaxDriver extends FirefoxDriver implements AjaxWebDriver
{
-
+
private int waitTime;
-
+
public FirefoxAjaxDriver()
{
this(AjaxWebElement.DEFAULT_WAIT_TIME);
}
-
+
public FirefoxAjaxDriver(int waitTime)
{
this.waitTime = waitTime;
}
-
- //@Override
+
+ // @Override
public AjaxWebElement findElement(By by)
{
return new DelegatedWebElement(super.findElement(by), waitTime);
}
-
- //@Override
+
+ // @Override
public void setWaitTime(int millis)
{
this.waitTime = millis;
Added: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/InternetExplorerAjaxDriver.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/InternetExplorerAjaxDriver.java (rev 0)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/webdriver/InternetExplorerAjaxDriver.java 2010-03-30 11:05:52 UTC (rev 12326)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.common.test.webdriver;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.ie.InternetExplorerDriver;
+
+public class InternetExplorerAjaxDriver extends InternetExplorerDriver implements AjaxWebDriver
+{
+
+ private int waitTime;
+
+ public InternetExplorerAjaxDriver()
+ {
+ this(AjaxWebElement.DEFAULT_WAIT_TIME);
+ }
+
+ public InternetExplorerAjaxDriver(int waitTime)
+ {
+ this.waitTime = waitTime;
+ }
+
+ public AjaxWebElement findElement(By by)
+ {
+ return new DelegatedWebElement(super.findElement(by), waitTime);
+ }
+
+ public void setWaitTime(int millis)
+ {
+ this.waitTime = millis;
+ }
+
+ public boolean isElementPresent(By by)
+ {
+ try
+ {
+ findElement(by);
+ return true;
+ }
+ catch (NoSuchElementException e)
+ {
+ return false;
+ }
+ }
+}
More information about the seam-commits
mailing list