Author: vrockai
Date: 2009-04-09 08:13:26 -0400 (Thu, 09 Apr 2009)
New Revision: 13200
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalAjaxSamplesTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalSamplesTestCase.java
Log:
[selenium] - nearly all javadoc
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalAjaxSamplesTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalAjaxSamplesTestCase.java 2009-04-09
10:58:01 UTC (rev 13199)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalAjaxSamplesTestCase.java 2009-04-09
12:13:26 UTC (rev 13200)
@@ -6,11 +6,16 @@
import static org.testng.Assert.*;
+/**
+ * The Class PortalAjaxSamplesTestCase is used for testing of ajax line of portlets from
portal-basic-samples.sar.
+ */
@Test(groups = { "test_samples" }, enabled = true)
public class PortalAjaxSamplesTestCase extends JBossPortalSeleniumTestCase {
+ /** The AJAX_ timeout. */
public static long AJAX_TIMEOUT = 4500;
+ /** prefix for locator properties = samples.ajax.*/
public static String casePfx = "samples.ajax.";
private final String SES_LNK_INVALIDATE =
getProp(casePfx+"ses.lnk.invalidate","link=invalidate");
@@ -109,15 +114,19 @@
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ protected void loginBeforeTest() {
selenium.open("/portal/portal/default/default");
waitFor(AJAX_TIMEOUT);
}
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
+ protected void logoutAfterTest() {
}
+
+ /**
+ * Cache test. Test clicks on action and render links in both portlets and assert the
change of render call count values accordingly.
+ */
@Test(enabled = true)
public void cacheTest() {
selenium.click(CACHE_LNK);
@@ -146,6 +155,15 @@
assertEquals("2", selenium.getText(CACHE_DIV_2_RENDER));
}
+ /**
+ * Charset test.
+ * <ul>
+ * <li>set the testing range and check</li>
+ * <li>change the testing range and check</li>
+ * <li>change text in textarea to incorrect and check</li>
+ * <li>change text in textarea to correct and check</li>
+ * </ul>
+ */
@Test(enabled = true)
public void charsetTest() {
selenium.click(CHAR_LNK);
@@ -176,6 +194,9 @@
assertTrue(selenium.isTextPresent("Test result: The input matched the expected
result"));
}
+ /**
+ * Encoding test. Test fills in inputs for "text to pass" and submit them to
render and action phase. The text in textareas is asserted accordingly.
+ */
@Test(enabled = true)
public void encodingTest() {
selenium.click(ENC_LNK);
@@ -194,6 +215,9 @@
assertEquals("action", selenium.getValue(ENC_TEXTAREA2));
}
+ /**
+ * Event test. The tests changes the colors for text and asserts that color was really
changed.
+ */
@Test(enabled = true)
public void eventTest() {
selenium.click(EVT_LNK);
@@ -212,6 +236,9 @@
assertTrue(selenium.isElementPresent(EVT_DIV_BLACK));
}
+ /**
+ * Exception test. After accessing the portlet, the string
"javax.portlet.PortletException" is asserted to appear on the screen.
+ */
@Test(enabled = true)
public void exceptionTest() {
selenium.click(EXC_LNK);
@@ -221,6 +248,9 @@
assertTrue(selenium.isTextPresent("javax.portlet.PortletException"));
}
+ /**
+ * File system content test. After accessing the portlet, the string "Bar
content" is asserted to appear on the screen.
+ */
@Test(enabled = true)
public void headerTest() {
selenium.click(HEAD_LNK);
@@ -230,6 +260,9 @@
assertEquals("hello from the injected java script!", selenium.getAlert());
}
+ /**
+ * Javascript test. Selects some values from the list and after refresh asserts that
nothing was selected.
+ */
@Test(enabled = true)
public void javascriptTest() {
selenium.click(JS_LNK);
@@ -261,6 +294,9 @@
assertFalse(selenium.isSomethingSelected(JS_SEL_LETTER));
}
+ /**
+ * Missing instance test. The page is opened and it is asserted, that no portlet is on
the screen.
+ */
@Test(enabled = true)
public void missingInstanceTest() {
selenium.click(MINS_LNK);
@@ -268,6 +304,9 @@
assertEquals("", selenium.getText(MINS_DIV_CON));
}
+ /**
+ * Missing portlet test. The page is opened and it is asserted, that no portlet is on
the screen.
+ */
@Test(enabled = true)
public void missingPortletTest() {
selenium.click(MPOR_LNK);
@@ -275,6 +314,9 @@
assertEquals("", selenium.getText(MPOR_DIV_CON));
}
+ /**
+ * Mode test. The page is opened and it is asserted, that only a text "view"
is present in portlet content.
+ */
@Test(enabled = true)
public void modeTest() {
selenium.click(MOD_LNK);
@@ -282,6 +324,9 @@
assertEquals("View", selenium.getText(MOD_DIV_CON));
}
+ /**
+ * Page event test. The test clicks on "normal" button for each portlet on the
screen and asserts, that every other portlet in the column is minimalised.
+ */
@Test(enabled = true)
public void pageEventTest() {
final String portletText = "This is a simple showcase of Portal Node Event
Listener. For this portal page it ensures that in every column, only one portlet window is
in NORMAL state. Try to change the window state of other portlets and see what happens. To
learn more, read InterPortlet Communication (IPC) chapter in JBoss Portal Reference
Guide.";
@@ -332,6 +377,9 @@
}
+ /**
+ * Public parameters test. Test is adding values for each parameter and asserting that
they appear in valid inputs. Then it removes all values and asserts that they not appear
in valid inputs.
+ */
@Test(enabled = true)
public void publicParametersTest() {
selenium.click(PUB_LNK);
@@ -395,12 +443,19 @@
assertEquals("", selenium.getValue(PUB_DIV_3_BAR));
}
+ /**
+ * Secure test. Test is disabled. More information needed.
+ */
+ //TODO enable test - more information needed
@Test(enabled = false)
public void secureTest() {
}
+ /**
+ * Session test. Test adds parameters to portlet and application scope and asserts that
they appear in attributes tables accordingly.
+ */
@Test(enabled = true)
public void sessionTest() {
selenium.click(SES_LNK);
@@ -414,8 +469,6 @@
assertTrue(r>0);
assertEquals(findTableRow(SES_TAB_PSCOPE, "scopeval1", 1), r);
- //assertEquals("scope1",
selenium.getText("//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[1]/tbody/tr[2]/td[1]"));
- //assertEquals("scopeval1",
selenium.getText("//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[1]/tbody/tr[2]/td[2]"));
selenium.type(SES_INP_NAM, "app1");
selenium.type(SES_INP_VAL, "appval1");
selenium.click(SES_SUB_ASCOPE);
@@ -425,8 +478,6 @@
assertTrue(r>0);
assertEquals(findTableRow(SES_TAB_ASCOPE, "appval1", 1), r);
- //assertEquals("app1",
selenium.getText("//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[2]/tbody/tr[2]/td[1]"));
- //assertEquals("appval1",
selenium.getText("//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[2]/tbody/tr[2]/td[2]"));
selenium.click(SES_LNK_INVALIDATE);
waitFor(AJAX_TIMEOUT);
@@ -434,12 +485,19 @@
assertFalse(selenium.isTextPresent("Session id"));
}
+ /**
+ * Url portlet test.
+ */
+ //TODO enable test - more information needed
@Test(enabled = false)
public void urlPortletTest() {
}
+ /**
+ * Window id test. The page is opened and it is asserted, that only a text "Window
ID is equals to /default/Test/Window id test/WindowIDPortletWindow" is present in
portlet content.
+ */
@Test(enabled = true)
public void windowIdTest() {
selenium.click(WIN_LNK);
@@ -447,6 +505,9 @@
assertEquals("Window ID is equals to /default/TestWithAjax/Window id
test/WindowIDPortletWindow", selenium.getText(WIN_DIV_CON));
}
+ /**
+ * Serve resource demo test. Tests that repeat input really rewrites the text on screen,
and clicks on all product links and assert that right addresses have appeared on screen.
+ */
@Test(enabled = true)
public void serveResourceDemoTest() {
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalSamplesTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalSamplesTestCase.java 2009-04-09
10:58:01 UTC (rev 13199)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalSamplesTestCase.java 2009-04-09
12:13:26 UTC (rev 13200)
@@ -5,11 +5,17 @@
import org.testng.annotations.Test;
import static org.testng.Assert.*;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PortalSamplesTestCase.
+ */
@Test(groups = { "test_samples" }, enabled = true)
public class PortalSamplesTestCase extends JBossPortalSeleniumTestCase {
+ /** The AJAX timeout. */
public static long AJAX_TIMEOUT = 4500;
+ /** prefix for locator properties = samples.*/
public static String casePfx = "samples.";
private final String SES_LNK_INVALIDATE = getProp(casePfx +
"ses.lnk.invalidate", "link=invalidate");
@@ -116,17 +122,26 @@
private final String CACHE_2RENDER = getProp(casePfx + "cache.2render",
"//div[@id='regionB']/div[2]/table/tbody/tr[2]/td[2]/div/div[2]/div");
private final String CACHE_1RENDER = getProp(casePfx + "cache.1render",
"//div[@id='regionB']/div[1]/table/tbody/tr[2]/td[2]/div/div[2]/div");
+ /**
+ * Login before test.
+ */
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ protected void loginBeforeTest() {
selenium.open("/portal/portal/default/default");
selenium.waitForPageToLoad(PAGE_LOAD);
}
+ /**
+ * Logout after test.
+ */
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
+ protected void logoutAfterTest() {
}
+ /**
+ * Cache test. Test clicks on action and render links in both portlets and assert the
change of render call count values accordingly.
+ */
@Test(enabled = true)
public void cacheTest() {
selenium.click(CACHE_LNK);
@@ -155,6 +170,15 @@
assertEquals("4", selenium.getText(CACHE_2RENDER));
}
+ /**
+ * Charset test.
+ * <ul>
+ * <li>set the testing range and check</li>
+ * <li>change the testing range and check</li>
+ * <li>change text in textarea to incorrect and check</li>
+ * <li>change text in textarea to correct and check</li>
+ * </ul>
+ */
@Test(enabled = true)
public void charsetTest() {
selenium.click(CHAR_LNK);
@@ -163,28 +187,41 @@
selenium.type(CHAR_INP_TO, "75");
selenium.click(CHAR_SUB_CHANGE);
selenium.waitForPageToLoad(PAGE_LOAD);
+
assertEquals("ABCDEFGHIJ", selenium.getText(CHAR_TEXTAREA));
+
selenium.click(CHAR_LNK_TEXTAREA_CHECK);
selenium.waitForPageToLoad(PAGE_LOAD);
+
assertTrue(selenium.isTextPresent("Test result: The input matched the expected
result"));
assertEquals("ABCDEFGHIJ", selenium.getValue(CHAR_INP_TEXT));
+
selenium.click(CHAR_INP_TEXT_SUB_CHECK);
selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.type(CHAR_INP_FROM, "55");
selenium.type(CHAR_INP_TO, "65");
selenium.click(CHAR_SUB_CHANGE);
selenium.waitForPageToLoad(PAGE_LOAD);
+
assertEquals("789:;<=>?@", selenium.getValue(CHAR_INP_TEXT));
+
selenium.type(CHAR_TEXTAREA, "789:;<=>?@4");
selenium.click(CHAR_LNK_TEXTAREA_CHECK);
selenium.waitForPageToLoad(PAGE_LOAD);
+
assertTrue(selenium.isTextPresent("Test result: The input did not matched the
expected result"));
+
selenium.type(CHAR_INP_TEXT, "789:;<=>?@f");
selenium.click(CHAR_ALL_SUB_CHECK);
selenium.waitForPageToLoad(PAGE_LOAD);
+
assertTrue(selenium.isTextPresent("Test result: The input matched the expected
result"));
}
+ /**
+ * Encoding test. Test fills in inputs for "text to pass" and submit them to
render and action phase. The text in textareas is asserted accordingly.
+ */
@Test(enabled = true)
public void encodingTest() {
selenium.click(ENC_LNK);
@@ -203,6 +240,9 @@
assertEquals("action", selenium.getValue(ENC_TEXTAREA2));
}
+ /**
+ * Event test. The tests changes the colors for text and asserts that color was really
changed.
+ */
@Test(enabled = true)
public void eventTest() {
selenium.click(EVT_LNK);
@@ -221,6 +261,9 @@
assertTrue(selenium.isElementPresent(EVT_DIV_BLACK));
}
+ /**
+ * Exception test. After accessing the portlet, the string
"javax.portlet.PortletException" is asserted to appear on the screen.
+ */
@Test(enabled = true)
public void exceptionTest() {
selenium.click(EXC_LNK);
@@ -230,6 +273,9 @@
assertTrue(selenium.isTextPresent("javax.portlet.PortletException"));
}
+ /**
+ * File system content test. After accessing the portlet, the string "Bar
content" is asserted to appear on the screen.
+ */
@Test(enabled = true)
public void fileSystemContentTest() {
selenium.click(FS_LNK);
@@ -237,6 +283,9 @@
assertTrue(selenium.isTextPresent("Bar content"));
}
+ /**
+ * Header test. Clicks on "call injected javascript" button and asserts that
the correct alert message was popped up.
+ */
@Test(enabled = true)
public void headerTest() {
selenium.click(HEAD_LNK);
@@ -246,6 +295,9 @@
assertEquals("hello from the injected java script!", selenium.getAlert());
}
+ /**
+ * Javascript test. Selects some values from the list and after refresh asserts that
nothing was selected.
+ */
@Test(enabled = true)
public void javascriptTest() {
selenium.click(JS_LNK);
@@ -277,6 +329,9 @@
assertFalse(selenium.isSomethingSelected(JS_SEL_LETTER));
}
+ /**
+ * Missing instance test. The page is opened and it is asserted, that no portlet is on
the screen.
+ */
@Test(enabled = true)
public void missingInstanceTest() {
selenium.click(MINS_LNK);
@@ -284,6 +339,9 @@
assertEquals("", selenium.getText(MINS_DIV_CON));
}
+ /**
+ * Missing portlet test. The page is opened and it is asserted, that no portlet is on
the screen.
+ */
@Test(enabled = true)
public void missingPortletTest() {
selenium.click(MPOR_LNK);
@@ -291,6 +349,9 @@
assertEquals("", selenium.getText(MPOR_DIV_CON));
}
+ /**
+ * Mode test. The page is opened and it is asserted, that only a text "view"
is present in portlet content.
+ */
@Test(enabled = true)
public void modeTest() {
selenium.click(MOD_LNK);
@@ -298,6 +359,9 @@
assertEquals("View", selenium.getText(MOD_DIV_CON));
}
+ /**
+ * Page event test. The test clicks on "normal" button for each portlet on the
screen and asserts, that every other portlet in the column is minimalised.
+ */
@Test(enabled = true)
public void pageEventTest() {
final String portletText = "This is a simple showcase of Portal Node Event
Listener. For this portal page it ensures that in every column, only one portlet window is
in NORMAL state. Try to change the window state of other portlets and see what happens. To
learn more, read InterPortlet Communication (IPC) chapter in JBoss Portal Reference
Guide.";
@@ -348,6 +412,9 @@
}
+ /**
+ * Public parameters test. Test is adding values for each parameter and asserting that
they appear in valid inputs. Then it removes all values and asserts that they not appear
in valid inputs.
+ */
@Test(enabled = true)
public void publicParametersTest() {
selenium.click(PUB_LNK);
@@ -411,11 +478,18 @@
assertEquals("", selenium.getValue(PUB_DIV_3_BAR));
}
+ /**
+ * Secure test. Test is disabled. More information needed.
+ */
+ //TODO enable test - more information needed
@Test(enabled = false)
public void secureTest() {
}
+ /**
+ * Session test. Test adds parameters to portlet and application scope and asserts that
they appear in attributes tables accordingly.
+ */
@Test(enabled = true)
public void sessionTest() {
selenium.click(SES_LNK);
@@ -429,12 +503,6 @@
assertTrue(r > 0);
assertEquals(findTableRow(SES_TAB_PSCOPE, "scopeval1", 1), r);
- // assertEquals("scope1", selenium.getText(
- //
"//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[1]/tbody/tr[2]/td[1]"
- // ));
- // assertEquals("scopeval1", selenium.getText(
- //
"//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[1]/tbody/tr[2]/td[2]"
- // ));
selenium.type(SES_INP_NAM, "app1");
selenium.type(SES_INP_VAL, "appval1");
selenium.click(SES_SUB_ASCOPE);
@@ -444,24 +512,24 @@
assertTrue(r > 0);
assertEquals(findTableRow(SES_TAB_ASCOPE, "appval1", 1), r);
- // assertEquals("app1", selenium.getText(
- //
"//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[2]/tbody/tr[2]/td[1]"
- // ));
- // assertEquals("appval1", selenium.getText(
- //
"//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div/table[2]/tbody/tr[2]/td[2]"
- // ));
-
selenium.click(SES_LNK_INVALIDATE);
selenium.waitForPageToLoad(PAGE_LOAD);
assertFalse(selenium.isTextPresent("Session id"));
}
+ /**
+ * Url portlet test.
+ */
+ //TODO enable test - more information needed
@Test(enabled = false)
public void urlPortletTest() {
}
+ /**
+ * Window id test. The page is opened and it is asserted, that only a text "Window
ID is equals to /default/Test/Window id test/WindowIDPortletWindow" is present in
portlet content.
+ */
@Test(enabled = true)
public void windowIdTest() {
selenium.click(WIN_LNK);
@@ -469,9 +537,11 @@
assertEquals("Window ID is equals to /default/Test/Window id
test/WindowIDPortletWindow", selenium.getText(WIN_DIV_CON));
}
+ /**
+ * Serve resource demo test. Tests that repeat input really rewrites the text on screen,
and clicks on all product links and assert that right addresses have appeared on screen.
+ */
@Test(enabled = true)
public void serveResourceDemoTest() {
-
selenium.click(RES_LNK);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(RES_INP, "valtest");