Author: ozizka(a)redhat.com
Date: 2009-04-24 15:01:32 -0400 (Fri, 24 Apr 2009)
New Revision: 335
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
EJTT: Updated methods covering operation history table -> fixing "Can't find
the ops history table element, searched ID: operationHistoryForm:dataTable"
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
---
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-24
18:39:53 UTC (rev 334)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-24
19:01:32 UTC (rev 335)
@@ -678,7 +678,8 @@
public OperationsHistoryTable getOperationsHistoryTable() throws
HtmlElementNotFoundException {
// Find the ops history table.
- String elemID = "operationHistoryForm:dataTable";
+ //String elemID = "operationHistoryForm:dataTable";
+ String elemID = "historiesForm:dataTable";
Element elem = client.getElement(elemID);
if( null == elem ){
throw new HtmlElementNotFoundException(
@@ -692,7 +693,7 @@
/**
- * Finds first button with given label inside this box.
+ * Finds first button with given label inside this tab box.
* @param label
* @return
* @throws org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException
@@ -1073,13 +1074,18 @@
+
+
+
+
/**
* Table which shows the result of an operation.
*/
public class OperationsHistoryTable extends ContentTable {
- public OperationsHistoryTable(HtmlTable element) {
+ public OperationsHistoryTable(HtmlTable element) throws HtmlElementNotFoundException {
super(element);
+ analyzeColumns();
}
/**
@@ -1092,7 +1098,9 @@
throw new HtmlElementNotFoundException(
"Operation table has no rows (no operations are listed).");
- String xPath = "tbody/tr[contains(@class, 'rich-table-firstrow')]";
+ //String xPath = "tbody/tr[contains(@class,
'rich-table-firstrow')]";
+ String xPath = "tbody/tr[contains(@class,
'operationStatusColumn')]";
+
HtmlTableRow tr = this.element.getFirstByXPath(xPath);
if( null == tr ){
throw new HtmlElementNotFoundException(
@@ -1101,9 +1109,17 @@
return tr;
}
- public OperationStatusType getLastOperationStatus() throws HtmlElementNotFoundException
{
+
+ public OperationStatusType getLastOperationStatus() throws
HtmlElementNotFoundException
+ {
+ // TODO: Ugly - we should get the cell, not whole row.
HtmlTableRow tr = getLastOperationRow();
- OperationStatusType status = OperationStatusType.fromStatusText( tr.getTextContent()
);
+ //OperationStatusType status = OperationStatusType.fromStatusText( tr.getTextContent()
);
+
+ int statusColIndex = this.getColumnIndexByName("Status");
+ String statusText =
this.getRows().get(0).getCell(statusColIndex).getTextContent().trim();
+ OperationStatusType status = OperationStatusType.fromStatusText( statusText );
+
if( null == status )
throw new HtmlElementNotFoundException(
"Operation status not recognized. Row text: "+tr.getTextContent(),
currentTest);
@@ -1113,6 +1129,7 @@
public boolean wasLastOperationSuccesful() throws HtmlElementNotFoundException
{
HtmlTableRow tr = getLastOperationRow();
+ // Kind of simple hack.
return tr.getTextContent().contains("Success");
}