Now using aria attribute to identify selected rows in celltables.

This commit is contained in:
Papick Garcia Taboada committed 2016-02-24 17:11:25 +01:00
1 parent de5dc5b517
commit d784b05e50
7 files changed
+163 -7

No files matched your search

@@ -6,6 +6,10 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
<mapEntry key="[debug]" value="org.eclipse.jdt.junit.launchconfig"/>
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
</mapAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.sap.sailing.selenium.test"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
@@ -0,0 +1,21 @@
package com.sap.sailing.selenium.pages.common;
import org.openqa.selenium.WebElement;
/**
* Simple attribute helper.
*/
public class AttributeHelper {
/**
* Checks if the given attribute name is "enabled". This convenience method accepts "true" and "1" as values for
* "enabled", all other values are considered as "disabled".
*
* @param element
* @param attributeName
* @return
*/
public static boolean isEnabled(WebElement element, String attributeName) {
String attributeValue = element.getAttribute(attributeName);
return "true".equalsIgnoreCase(attributeValue) || "1".equalsIgnoreCase(attributeValue);
}
}
@@ -52,11 +52,7 @@ public abstract class CellTablePO<T extends DataEntryPO> extends PageArea {
private static final String SORTING_INDICATOR_XPATH = ".//div/div/img";
private static final String LOADING_ANIMATION_XPATH = "./td/div/div/div/img";
protected static final String SELECTED_ROW_CSS_CLASS = "GJIHYJ4DP0"; //$NON-NLS-1$
// Use the following line for testing with Super-Dev-Mode (SDM):
// protected static final String SELECTED_ROW_CSS_CLASS = "com-sap-sailing-gwt-ui-adminconsole-AdminConsoleTableResources-AdminConsoleTableStyle-cellTableSelectedRow"; //$NON-NLS-1$
private static final String LOADING_ANIMATION_IMAGE = "data:image/gif;base64," + //$NON-NLS-1$
"R0lGODlhKwALAPEAAP///0tKSqampktKSiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGx" + //$NON-NLS-1$
"vYWQuaW5mbwAh+QQJCgAAACwAAAAAKwALAAACMoSOCMuW2diD88UKG95W88uF4DaGWFmhZid93pq+pwxnLUnXh8" + //$NON-NLS-1$
@@ -75,6 +71,7 @@ public abstract class CellTablePO<T extends DataEntryPO> extends PageArea {
"iVBORw0KGgoAAAANSUhEUgAAAAsAAAAHCAYAAADebrddAAAAiklEQVR42mPIrewMya3oup5X2XkeiC/nVXRezgV" + //$NON-NLS-1$
"iEDu3vPMskH0BROeVdqkyJNTXcwAlDgDxfwxcAaWrOpsYYCC/qlUcKPgMLlnZBcWd/4E272BAB0DdjkDJf2AFFR" + //$NON-NLS-1$
"BTgfTj4uIeEQZsAKigHmE6EJd32DDgA0DF20FOyK/sqmIgBEDWAhVPwyYHAJAqZIiNwsHKAAAAAElFTkSuQmCC\")"; //$NON-NLS-1$
public static final String ARIA_ROLE_SELECTED = "aria-selected";
// @FindBy(how = ByTagName.class, using = HEAD_TAG_NAME)
// private WebElement head;
@@ -15,7 +15,7 @@ import org.openqa.selenium.interactions.Keyboard;
import org.openqa.selenium.interactions.Mouse;
import com.sap.sailing.selenium.core.FindBy;
import com.sap.sailing.selenium.pages.common.CSSHelper;
import com.sap.sailing.selenium.pages.common.AttributeHelper;
public class DataEntryPO extends CellTableRowPO {
protected static final String CELL_TAG_NAME = "td"; //$NON-NLS-1$
@@ -58,7 +58,7 @@ public class DataEntryPO extends CellTableRowPO {
}
public boolean isSelected() {
return CSSHelper.hasCSSClass((WebElement) this.context, CellTablePO.SELECTED_ROW_CSS_CLASS);
return AttributeHelper.isEnabled((WebElement) this.context, CellTablePO.ARIA_ROLE_SELECTED);
}
public void select() {