Permalink
Browse files

updates because of compatibility with Graphene (ARQGRA-273)

  • Loading branch information...
1 parent e156d95 commit 1b8076851bd8ebf98b0b6d584f07ec6c645d1613 @papousek papousek committed Mar 15, 2013
@@ -49,8 +49,6 @@
import org.richfaces.tests.metamer.ftest.webdriver.MetamerPage.WaitRequestType;
import org.richfaces.tests.metamer.ftest.webdriver.utils.StringEqualsWrapper;
import org.richfaces.tests.page.fragments.impl.Utils;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
-import org.richfaces.tests.page.fragments.impl.input.TextInputComponent;
import org.richfaces.tests.page.fragments.impl.input.TextInputComponent.ClearType;
import org.richfaces.tests.page.fragments.impl.input.TextInputComponentImpl;
import org.testng.SkipException;
@@ -48,7 +48,6 @@
import org.richfaces.tests.metamer.ftest.webdriver.MetamerPage.WaitRequestType;
import org.richfaces.tests.metamer.model.Capital;
import org.richfaces.tests.page.fragments.impl.Utils;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
import org.richfaces.tests.page.fragments.impl.input.inplace.EditingState.FinishEditingBy;
import org.richfaces.tests.page.fragments.impl.input.inplace.InplaceComponent.OpenBy;
import org.richfaces.tests.page.fragments.impl.input.inplace.InplaceComponent.State;
@@ -260,7 +259,7 @@ public void testItemClass() {
@Test
@RegressionTest("https://issues.jboss.org/browse/RF-9845")
public void testListClass() {
- testStyleClass(WebElementProxyUtils.createProxyForElement(listBy), BasicAttributes.listClass);
+ testStyleClass(driver.findElement(listBy), BasicAttributes.listClass);
}
@Test
@@ -41,7 +41,6 @@
import org.richfaces.tests.metamer.ftest.AbstractWebDriverTest;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
import org.testng.annotations.Test;
@@ -108,7 +107,7 @@ public void testHeight() {
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testItemClass() {
- testStyleClass(WebElementProxyUtils.createProxyForElement(itemBy) , itemClass);
+ testStyleClass(driver.findElement(itemBy) , itemClass);
}
@Test
@@ -154,20 +153,20 @@ public void testItemSeparatorNonExisting() {
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testItemStyle() {
- testStyle(WebElementProxyUtils.createProxyForElement(itemBy), itemStyle);
+ testStyle(driver.findElement(itemBy), itemStyle);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemclick() {
- Action click = new Actions(driver).click(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action click = new Actions(driver).click(driver.findElement(itemBy)).build();
testFireEvent(toolbarAttributes, ToolbarAttributes.onitemclick, click);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemdblclick() {
- Action dblClick = new Actions(driver).doubleClick(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action dblClick = new Actions(driver).doubleClick(driver.findElement(itemBy)).build();
testFireEvent(toolbarAttributes, ToolbarAttributes.onitemdblclick, dblClick);
}
@@ -178,7 +177,7 @@ public void testOnitemkeydown() {
// Action keyDown = new Actions(driver).keyDown(WebElementProxyUtils.createProxyForElement(itemBy), Keys.ALT).build();
// testFireEvent(toolbarAttributes, ToolbarAttributes.onitemkeydown, keyDown);
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.KEYDOWN, toolbarAttributes, ToolbarAttributes.onitemkeydown);
}
@@ -189,7 +188,7 @@ public void testOnitemkeypress() {
// Action keyPress = new Actions(driver).moveToElement(WebElementProxyUtils.createProxyForElement(itemBy)).sendKeys("a").build();
// testFireEvent(toolbarAttributes, ToolbarAttributes.onitemkeypress, keyPress);
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.KEYPRESS, toolbarAttributes, ToolbarAttributes.onitemkeypress);
}
@@ -200,21 +199,21 @@ public void testOnitemkeyup() {
// Action keyup = new Actions(driver).keyUp(WebElementProxyUtils.createProxyForElement(itemBy), Keys.ALT).build();
// testFireEvent(toolbarAttributes, ToolbarAttributes.onitemkeyup, keyup);
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.KEYUP, toolbarAttributes, ToolbarAttributes.onitemkeyup);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmousedown() {
- Action mouseDown = new Actions(driver).clickAndHold(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action mouseDown = new Actions(driver).clickAndHold(driver.findElement(itemBy)).build();
testFireEvent(toolbarAttributes, ToolbarAttributes.onitemmousedown, mouseDown);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmousemove() {
- Action mouseMove = new Actions(driver).moveToElement(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action mouseMove = new Actions(driver).moveToElement(driver.findElement(itemBy)).build();
testFireEvent(toolbarAttributes, ToolbarAttributes.onitemmousemove, mouseMove);
}
@@ -224,21 +223,21 @@ public void testOnitemmouseout() {
// TODO JJa 2013-03-11: Doesn't work for now with Action, rewrite if it changes
// Action mouseOut = new Actions(driver).moveToElement(WebElementProxyUtils.createProxyForElement(itemBy)).moveByOffset(-1, -1).build();
// testFireEvent(toolbarAttributes, ToolbarAttributes.onitemmouseout, mouseOut);
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.MOUSEOUT, toolbarAttributes, ToolbarAttributes.onitemmouseout);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmouseover() {
- Action mouseOver = new Actions(driver).moveToElement(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action mouseOver = new Actions(driver).moveToElement(driver.findElement(itemBy)).build();
testFireEvent(toolbarAttributes, ToolbarAttributes.onitemmouseover, mouseOver);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmouseup() {
- WebElement item = WebElementProxyUtils.createProxyForElement(itemBy);
+ WebElement item = driver.findElement(itemBy);
Action mouseUp = new Actions(driver).clickAndHold(item).release(item).build();
testFireEvent(toolbarAttributes, ToolbarAttributes.onitemmouseup, mouseUp);
}
@@ -46,7 +46,6 @@
import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.richToolbar.ToolbarPage;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
import org.testng.annotations.Test;
/**
@@ -103,15 +102,15 @@ public void testInitItems() {
@Use(field = "itemBy", value = "itemsBy")
@RegressionTest("https://issues.jboss.org/browse/RF-9976")
public void testItemClass() {
- testStyleClass(WebElementProxyUtils.createProxyForElement(itemBy) , itemClass);
+ testStyleClass(driver.findElement(itemBy) , itemClass);
}
@Test
@Use(field = "itemSeparator", value = "separators")
public void testItemSeparatorCorrect() {
toolbarGroupAttributes.set(ToolbarGroupAttributes.itemSeparator, itemSeparator);
- List<WebElement> separatorDivs = WebElementProxyUtils.createProxyForElements(By.cssSelector("div.rf-tb-sep-" + itemSeparator));
+ List<WebElement> separatorDivs = driver.findElements(By.cssSelector("div.rf-tb-sep-" + itemSeparator));
assertTrue(Graphene.element(page.separator.root).isPresent().apply(driver), "Item separator should be present on the page.");
assertEquals(page.separators.size(), 5, "Number of separators.");
@@ -158,7 +157,7 @@ public void testItemSeparatorNonExisting() {
@Use(field = "itemBy", value = "itemsBy")
@RegressionTest("https://issues.jboss.org/browse/RF-9976")
public void testItemStyle() {
- testStyle(WebElementProxyUtils.createProxyForElement(itemBy), itemStyle);
+ testStyle(driver.findElement(itemBy), itemStyle);
}
@Test
@@ -186,74 +185,74 @@ public void testLocation() {
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemclick() {
- Action click = new Actions(driver).click(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action click = new Actions(driver).click(driver.findElement(itemBy)).build();
testFireEvent(toolbarGroupAttributes, ToolbarGroupAttributes.onitemclick, click);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemdblclick() {
- Action dblClick = new Actions(driver).doubleClick(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action dblClick = new Actions(driver).doubleClick(driver.findElement(itemBy)).build();
testFireEvent(toolbarGroupAttributes, ToolbarGroupAttributes.onitemdblclick, dblClick);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemkeydown() {
// TODO JJa 2013-03-14: Doesn't work for now with Action, rewrite if it changes
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.KEYDOWN, toolbarGroupAttributes, ToolbarGroupAttributes.onitemkeydown);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemkeypress() {
// TODO JJa 2013-03-14: Doesn't work for now with Action, rewrite if it changes
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.KEYPRESS, toolbarGroupAttributes, ToolbarGroupAttributes.onitemkeypress);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemkeyup() {
// TODO JJa 2013-03-14: Doesn't work for now with Action, rewrite if it changes
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.KEYUP, toolbarGroupAttributes, ToolbarGroupAttributes.onitemkeyup);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmousedown() {
- Action mouseDown = new Actions(driver).clickAndHold(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action mouseDown = new Actions(driver).clickAndHold(driver.findElement(itemBy)).build();
testFireEvent(toolbarGroupAttributes, ToolbarGroupAttributes.onitemmousedown, mouseDown);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmousemove() {
- Action mouseMove = new Actions(driver).moveToElement(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action mouseMove = new Actions(driver).moveToElement(driver.findElement(itemBy)).build();
testFireEvent(toolbarGroupAttributes, ToolbarGroupAttributes.onitemmousemove, mouseMove);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmouseout() {
// TODO JJa 2013-03-14: Doesn't work for now with Action, rewrite if it changes
- testFireEventWithJS(WebElementProxyUtils.createProxyForElement(itemBy),
+ testFireEventWithJS(driver.findElement(itemBy),
Event.MOUSEOUT, toolbarGroupAttributes, ToolbarGroupAttributes.onitemmouseout);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmouseover() {
- Action mouseOver = new Actions(driver).moveToElement(WebElementProxyUtils.createProxyForElement(itemBy)).build();
+ Action mouseOver = new Actions(driver).moveToElement(driver.findElement(itemBy)).build();
testFireEvent(toolbarGroupAttributes, ToolbarGroupAttributes.onitemmouseover, mouseOver);
}
@Test
@Use(field = "itemBy", value = "itemsBy")
public void testOnitemmouseup() {
- WebElement item = WebElementProxyUtils.createProxyForElement(itemBy);
+ WebElement item = driver.findElement(itemBy);
Action mouseUp = new Actions(driver).clickAndHold(item).release(item).build();
testFireEvent(toolbarGroupAttributes, ToolbarGroupAttributes.onitemmouseup, mouseUp);
}
@@ -38,7 +38,6 @@
import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
import org.richfaces.tests.metamer.ftest.webdriver.MetamerPage.WaitRequestType;
import org.richfaces.tests.metamer.ftest.webdriver.utils.StringEqualsWrapper;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
import org.richfaces.tests.page.fragments.impl.Utils;
/**
@@ -118,7 +117,7 @@ public void reset(T attribute) {
protected void setProperty(String propertyName, Object value) {
String valueAsString = (value == null ? NULLSTRING : value.toString());
//element for all types of input elements
- WebElement foundElementProxy = WebElementProxyUtils.createProxyForElement(
+ WebElement foundElementProxy = driver.findElement(
getCssSelectorForProperty(propertyName));
//handle the property by the tagname of the input element
Graphene.waitAjax().until(ElementPresent.getInstance().element(foundElementProxy));
@@ -148,7 +147,7 @@ protected void setProperty(String propertyName, Object value) {
* @param value value to be set
*/
private void applyText(String propertyName, String value) {
- WebElement input = WebElementProxyUtils.createProxyForElement(
+ WebElement input = driver.findElement(
getCssSelectorForProperty(propertyName));
String text = input.getAttribute("value");
if (!value.equals(text)) {
@@ -243,7 +242,7 @@ private By getCssSelectorForProperty(String property) {
* @return
*/
private String getProperty(String propertyName) {
- WebElement foundElementProxy = WebElementProxyUtils.createProxyForElement(
+ WebElement foundElementProxy = driver.findElement(
getCssSelectorForProperty(propertyName));
//handle the property by the tagname of the input element
Tag tag = Tag.getTag(foundElementProxy);
@@ -365,8 +364,8 @@ public static Tag getTag(WebElement foundElement) {
for (Tag t : values()) {
if (t.tagname.equals(elementTag)) {
if (t.equals(radio) || t.equals(checkbox)) {
- List<WebElement> foundElements = WebElementProxyUtils
- .createProxyForElements(By.tagName("input"), foundElement);
+ List<WebElement> foundElements = foundElement
+ .findElements(By.tagName("input"));
String inputType = foundElements.get(0).getAttribute("type");
if ("radio".equals(inputType)) {
radio.radioElements = foundElements;
@@ -53,7 +53,6 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.WebDriverWait;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
/**
* @author <a href="mailto:jstefek@redhat.com">Jiri Stefek</a>
@@ -242,8 +241,8 @@ public static void waiting(long milis) {
private static class RequestTimeChangesWaitingInterceptor implements Interceptor {
protected String time1;
- private static final WebElement requestTime = WebElementProxyUtils
- .createProxyForElement(By.cssSelector("span[id='requestTime']"));
+ private static final WebElement requestTime = GrapheneContext.getProxy()
+ .findElement(By.cssSelector("span[id='requestTime']"));
protected void afterAction() {
Graphene.waitModel().until().element(requestTime).text().not().equalTo(time1);
@@ -260,15 +259,12 @@ protected String getTime() {
@Override
public Object intercept(InvocationContext context) throws Throwable {
- return invoke(context.getTarget(), context.getMethod(), context.getArguments());
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
beforeAction();
- Object o = method.invoke(proxy, args);
+ Object o = context.getMethod().invoke(context.getTarget(), context.getArguments());
afterAction();
return o;
}
+
}
private static class RequestTimeNotChangesWaitingInterceptor extends RequestTimeChangesWaitingInterceptor {
@@ -22,16 +22,15 @@
package org.richfaces.tests.page.fragments.impl.DataScroller;
import java.util.List;
+import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.Graphene;
-import org.jboss.arquillian.graphene.context.GrapheneContext;
import org.jboss.arquillian.graphene.spi.annotations.Root;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedCondition;
-import org.richfaces.tests.page.fragments.impl.WebElementProxyUtils;
public class RichFacesDataScroller implements DataScroller {
@@ -53,8 +52,9 @@
protected List<WebElement> numberedPages;
@FindBy(className = "rf-ds-act")
protected WebElement actPage;
- //
- private WebDriver driver = GrapheneContext.getProxy();
+
+ @Drone
+ private WebDriver driver;
private static final String CSS_PAGE_SELECTOR = "[id$='ds_%d']";
private static final String CLASS_DISABLED = "rf-ds-dis";
@@ -125,7 +125,7 @@ public boolean isVisible() {
}
private void switchTo(By by) {
- WebElementProxyUtils.createProxyForElement(by, root).click();
+ root.findElement(by).click();
}
@Override
Oops, something went wrong.

0 comments on commit 1b80768

Please sign in to comment.