You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by ms...@apache.org on 2014/09/16 10:29:45 UTC
[2/3] git commit: Removed overzealous optimization from driver. The
optimization avoided clicking the setup & execution links if the test results
were already visible. However, in some test scenarios,
the execution link must be clicked, even if a results
Removed overzealous optimization from driver. The optimization avoided
clicking the setup & execution links if the test results were already
visible. However, in some test scenarios, the execution link must be
clicked, even if a results message is already displayed, because the
results may change based on a parameter set through the link, for example.
The test driver now strictly adheres to the following sequence for each
test case:
1) Access page
2) Click setup link (see: TestSetupLink.java), if present
3) Click execution link (see: TestLink.java or TestButton.java), if present
4) Collect test results
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/d77c81c7
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/d77c81c7
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/d77c81c7
Branch: refs/heads/master
Commit: d77c81c771c7708626a6f29eaf3e707aefcf4c91
Parents: 8c66fd1
Author: Scott Nicklous <ms...@apache.org>
Authored: Tue Sep 16 09:54:20 2014 +0200
Committer: Scott Nicklous <ms...@apache.org>
Committed: Tue Sep 16 10:26:42 2014 +0200
----------------------------------------------------------------------
.../portlet/tck/driver/TCKSimpleTestDriver.java | 52 ++++++--------------
1 file changed, 16 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d77c81c7/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
index b5b412d..5a92470 100644
--- a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
+++ b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
@@ -257,20 +257,10 @@ public class TCKSimpleTestDriver {
if (wels.isEmpty()) {
wels = accessPage();
}
-
- // Test case results or links are on the page. check for results first.
- List<WebElement> tcels = null;
- for (WebElement wel : wels) {
- tcels = wel.findElements(By.id(resultId));
- if (debug) System.out.println(" Results found: " + !tcels.isEmpty());
- if (!tcels.isEmpty()) break;
- }
-
- // if results aren't there, see if there is a link to be clicked
- if (tcels.isEmpty()) {
- wels = processClickable(wels);
- if (debug) System.out.println(" After processing clickable, results found: " + !wels.isEmpty());
- }
+
+ // process links if present
+ wels = processClickable(wels);
+ if (debug) System.out.println(" After processing clickable, results found: " + !wels.isEmpty());
checkResults(wels);
@@ -407,6 +397,7 @@ public class TCKSimpleTestDriver {
if(debug) System.out.println(" xpath string: ===" + expr + "===");
wdw.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(expr)));
+ wels = driver.findElements(By.name(tcName));
if (debug) {
System.out.println(" Found elements: " + (!wels.isEmpty()));
List<WebElement> xels = driver.findElements(By.xpath(expr));
@@ -414,16 +405,6 @@ public class TCKSimpleTestDriver {
System.out.println(" Element: " + w.getTagName() + ", id=" + w.getAttribute("id"));
}
}
-
- // check if results already found. if so, we're done.
- wels = driver.findElements(By.name(tcName));
- for (WebElement w : wels) {
- tcels = w.findElements(By.id(resultId));
- if (!tcels.isEmpty()) {
- if (debug) System.out.println(" Results available after setup.");
- return wels;
- }
- }
}
// Now click the action link, if present
@@ -432,21 +413,20 @@ public class TCKSimpleTestDriver {
if (!tcels.isEmpty()) break;
}
if (debug) System.out.println(" Clickable link found: " + ((tcels != null) && !tcels.isEmpty()));
-
- if ((tcels == null) || tcels.isEmpty()) {
- throw new Exception("Test case " + tcName + " failed. TCK error - Unknown TC content.");
- }
- WebElement wel = tcels.get(0);
- wel.click();
- WebDriverWait wdw = new WebDriverWait(driver, timeout);
- wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
- tcels = driver.findElements(By.name(tcName));
- if ((tcels == null) || tcels.isEmpty()) {
- throw new Exception("Test case " + tcName + " failed. No results after action link click.");
+ if (tcels != null && !tcels.isEmpty()) {
+ WebElement wel = tcels.get(0);
+ wel.click();
+ WebDriverWait wdw = new WebDriverWait(driver, timeout);
+ wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
+ wels = driver.findElements(By.name(tcName));
+ if ((wels == null) || wels.isEmpty()) {
+ throw new Exception("Test case " + tcName + " failed. No results after action link click.");
+ }
}
+
- return tcels;
+ return wels;
}
}