Author: lfryc(a)redhat.com
Date: 2009-12-15 04:38:17 -0500 (Tue, 15 Dec 2009)
New Revision: 16133
Modified:
branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/user-extensions/rfqa-extensions.js
Log:
* GENERAL
- moved loggingSeleniumListener.setSelenium(selenium) from @BeforeClass to @BeforeTest
- overwritten getJQueryCount(String locator) to optimalize (uncommented JS extension)
- added selenium.windowMaximaze() and selenium.windowFocus()
Modified:
branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
===================================================================
---
branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-12-15
09:20:46 UTC (rev 16132)
+++
branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-12-15
09:38:17 UTC (rev 16133)
@@ -95,6 +95,7 @@
protected void addTestListeners(ITestContext context) {
TestRunner runner = (TestRunner) context;
loggingTestListener = new SeleniumLoggingTestListener();
+ loggingTestListener.setSelenium(selenium);
runner.addTestListener(loggingTestListener);
}
@@ -129,8 +130,9 @@
selenium.start();
allowInitialXpath();
loadCustomLocationStrategies();
- // adding selenium-side logging facility
- loggingTestListener.setSelenium(selenium);
+
+ selenium.windowFocus();
+ selenium.windowMaximize();
}
/**
@@ -354,4 +356,11 @@
private int getRunnedTestCount(ITestContext context) {
return context.getPassedTests().size() + context.getSkippedTests().size() +
context.getFailedTests().size();
}
+
+ @Override
+ public int getJQueryCount(String locator) {
+ String evaluate = format("selenium.getJQueryCount(\"{0}\")",
locator.replaceFirst("^jquery=", ""));
+ String result = selenium.getEval(evaluate);
+ return Integer.parseInt(result);
+ }
}
Modified:
branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/user-extensions/rfqa-extensions.js
===================================================================
---
branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/user-extensions/rfqa-extensions.js 2009-12-15
09:20:46 UTC (rev 16132)
+++
branches/sandbox/rf-demo-ftest-iexplore/src/test/resources/user-extensions/rfqa-extensions.js 2009-12-15
09:38:17 UTC (rev 16133)
@@ -87,3 +87,9 @@
return jQuery.trim(elem.textContent || elem.innerText || "").endsWith(
match[3]);
}
+
+Selenium.prototype.getJQueryCount = function(jquery) {
+ var inDocument = this.browserbot.getDocument();
+ var found = $(inDocument).find(jquery);
+ return found.length;
+}
\ No newline at end of file
Show replies by date