Author: dsvyatobatsko
Date: 2009-03-24 14:52:05 -0400 (Tue, 24 Mar 2009)
New Revision: 13162
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java
Log:
RF-6320
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxLog/ajaxLogAutoTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java 2009-03-24
18:50:37 UTC (rev 13161)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxLogTest.java 2009-03-24
18:52:05 UTC (rev 13162)
@@ -34,69 +34,46 @@
private final static String INIT_POPUP_MODE = "#{logBean.initPopupMode}";
- // @Test
- public void testAjaxLogLayout(Template template) {
- renderPage(template);
+ //@Test
+ public void testLogComponentWithPopupTrue(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, INIT_POPUP_MODE);
+ String inputElemId = tester.getClientId("input");
- String parentId = getParentId() + "_form:";
+ writeStatus("Check log component opens popup window by hotkey, ajax request
changes component content");
+ selenium.controlKeyDown();
+ selenium.shiftKeyDown();
+ selenium.keyDown(inputElemId, "\\76");
+ selenium.shiftKeyUp();
+ selenium.controlKeyUp();
- String inputElemId = parentId + "input";
- String logElemId = "logConsole";
+ selenium.windowFocus();
writeStatus("Type smth. All typing is being logged");
-
type(inputElemId, "typing");
- waitForAjaxCompletion();
- writeStatus("test that log element is present");
- AssertRendered(logElemId);
+ try {
+ selenium.selectWindow("logWindow");
+ selenium.windowFocus();
+ // at least dozen messages have to be logged
+ String body = selenium.getBodyText();
+ if (!body.contains("debug[")) {
+ Assert.fail("There is no debug messages here");
+ }
- writeStatus("test that clear button is present and has proper label");
+ // check clear button
+ selenium.click("//button");
- if
(selenium.isElementPresent("//div[@id='logConsole']/button")) {
- String clearBtnLabel =
selenium.getText("//div[@id='logConsole']/button");
- if (null == clearBtnLabel ||
!clearBtnLabel.trim().equalsIgnoreCase("Clear")) {
- Assert.fail("Clear button has obscure label");
+ body = selenium.getBodyText();
+ if (body.contains("debug[")) {
+ Assert.fail("log must be empty");
}
- } else {
- Assert.fail("Clear button is not rendered");
+ } finally {
+ selenium.selectWindow(null);
}
-
- writeStatus("at least dozen messages have to be logged");
- int logCount =
selenium.getXpathCount("//div[(a)id='logConsole']/div").intValue();
- if (logCount < 12) {
- Assert.fail("There are suspiciously few log messages here");
- }
-
- writeStatus("check clear button");
- selenium.click("//div[@id='logConsole']/button");
-
- logCount =
selenium.getXpathCount("//div[(a)id='logConsole']/div").intValue();
- if (logCount > 0) {
- Assert.fail("log must be empty");
- }
-
- writeStatus("test style attribute");
-
- // String style =
- // selenium.getAttribute("//div[@id='logConsole']/@style");
- int w =
selenium.getElementWidth("//div[(a)id='logConsole']").intValue();
- int h =
selenium.getElementHeight("//div[(a)id='logConsole']").intValue();
-
- if (800 != w || 300 != h) {
- Assert.fail("Style does not affect ajax log component");
- }
}
@Test
- public void testLogComponentWithPopupTrue(Template template) {
- AutoTester tester = getAutoTester(this);
- tester.renderPage(template, INIT_POPUP_MODE);
- writeStatus("Check log component opens popup window by hotkey, ajax request
changes component content");
- // TODO: implement test
- }
-
- @Test
public void testLogComponentWithPopupFalse(Template template) {
AutoTester tester = getAutoTester(this);
tester.renderPage(template, RESET_METHOD);
Show replies by date