Author: vrockai
Date: 2009-04-07 09:21:00 -0400 (Tue, 07 Apr 2009)
New Revision: 13170
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/CoordinationSamplesTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/EndToEndBeaPortlet.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
Log:
[selenium] - more javadoc for tests
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/CoordinationSamplesTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/CoordinationSamplesTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/CoordinationSamplesTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -10,9 +10,13 @@
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
/**
- * The Class Coordination Samples TestCase is responsible for testing of coordination
features of JBoss Portal using it's coordination samples page.
- * In default state the page is available on address <a
href="http://localhost:8080/portal/portal/default/Coordination+Samples">/portal/portal/default/Coordination+Samples</a>.
+ * The Class Coordination Samples TestCase is responsible for testing of
+ * coordination features of JBoss Portal using it's coordination samples page.
+ * In default state the page is available on address <a
+ * href="http://localhost:8080/portal/portal/default/Coordination+Samples"
+ * >/portal/portal/default/Coordination+Samples</a>.
*/
+//TODO - refactor to use property file
@Test(groups = { "coordination_samples" }, enabled = true)
public class CoordinationSamplesTestCase extends JBossPortalSeleniumTestCase {
@@ -90,30 +94,40 @@
}
/**
- * Default coordination test is responsible for testing default coordination on the
coordination samples page.
- * It has to work with the default page <a
href="http://localhost:8080/portal/portal/default/Coordination+Samples">/portal/portal/default/Coordination+Samples</a>.
- * <br/>
- * It starts with opening <a
href="http://localhost:8080/portal/portal/default/Coordination+Samples?zip=78759">http://localhost:8080/portal/portal/default/Coordination+Samples?zip=78759</a>
- * and checking that both variables on page have values asserted like this: <br/>
+ * Default coordination test is responsible for testing default coordination
+ * on the coordination samples page. It has to work with the default page <a
+ *
href="http://localhost:8080/portal/portal/default/Coordination+Samples">/
+ * portal/portal/default/Coordination+Samples</a>. <br/> It starts with
+ * opening <a href=
+ *
"http://localhost:8080/portal/portal/default/Coordination+Samples?zip=78759"
+ * >http://localhost:8080/portal/portal/default/Coordination+Samples?zip=
+ * 78759</a> and checking that both variables on page have values asserted
+ * like this: <br/>
* <table>
* <tr>
- * <td>Weather for (my_zipcode)</td><td>78759</td>
+ * <td>Weather for (my_zipcode)</td>
+ * <td>78759</td>
* </tr>
* <tr>
- * <td>Map for (your_zipcode)</td><td>78759</td>
+ * <td>Map for (your_zipcode)</td>
+ * <td>78759</td>
* </tr>
* </table>
* Then it fills up the <em>Page Parameter Portlet</em> with values:
* <table>
* <tr>
- * <td>Page parameter name</td><td>xyz</td>
+ * <td>Page parameter name</td>
+ * <td>xyz</td>
* </tr>
* <tr>
- * <td>Page parameter value</td><td>123</td>
+ * <td>Page parameter value</td>
+ * <td>123</td>
* </tr>
* </table>
*
- * clicks on submit button and assert the url is in format <a
href="http://localhost:8080//portal/portal/default/Coordination+Samples?xyz=123">/portal/portal/default/Coordination+Samples?xyz=123</a>
+ * clicks on submit button and assert the url is in format <a href=
+ *
"http://localhost:8080//portal/portal/default/Coordination+Samples?xyz=123"
+ * >/portal/portal/default/Coordination+Samples?xyz=123</a>
*/
@Test(enabled = true)
public void defaultCoordinationTest() {
@@ -136,7 +150,33 @@
/**
* Events explicit test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Events+-+Expl...
is demonstration of explicit event wiring.</p><ul><li>Click on "Add
to Cart" on the Catalog Portlet on the left half for
Snowboard.</li></ul><p> Assert that two Cart Portlets on
the left half<strong> have Snowboard in them.</strong></p><p
style="padding-left: 30px;"> Assert that two Cart Porlets on the right
<strong>have "Cart is
empty"</strong></p><ul><li>Click on "Add to Cart"
on the Catalog Portlet on the right half for Tent.</li></ul><p>
Assert that two Cart Portlets on the left half <strong>have no
"Tent"</strong> in them</p><p style="padding-left:
30px;"> Assert that two Cart Porlets on the <strong>right have
"Tent"</strong> in them.</p><p style="min-height: 8pt;
height: 8pt; padding: 0px;"> </p>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Events+-+Explicit</h3>
+ * <p>
+ * This is demonstration of explicit event wiring.
+ * </p>
+ * <ul>
+ * <li>Click on "Add to Cart" on the Catalog Portlet on the left half
for
+ * Snowboard.</li>
+ * </ul>
+ * <p>
+ * Assert that two Cart Portlets on the left half<strong> have Snowboard in
+ * them.</strong>
+ * </p>
+ * <p style="padding-left: 30px;"> Assert that two Cart Porlets on the
right
+ * <strong>have "Cart is empty"</strong></p>
+ * <ul>
+ * <li>Click on "Add to Cart" on the Catalog Portlet on the right half
for
+ * Tent.</li>
+ * </ul>
+ * <p>
+ * Assert that two Cart Portlets on the left half <strong>have no
+ * "Tent"</strong> in them
+ * </p>
+ * <p style="padding-left: 30px;"> Assert that two Cart Porlets on the
+ * <strong>right have "Tent"</strong> in them.</p><p
+ * style="min-height: 8pt; height: 8pt; padding:
0px;"> </p>
*/
@Test(enabled = true)
public void eventsExplicitTest() {
@@ -199,7 +239,35 @@
/**
* Events fallback test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Events+-+Fall...
is demonstration of mix of both explicit and implicit. (Is there a better way to describe
this?)</p><ul><li>Click on "Add to Cart" on the Catalog
Portlet on the left half for Snowboard.</li></ul><p> Assert
that two Cart Portlets on the left half<strong> have Snowboard in
them.</strong></p><p style="padding-left: 30px;"> Assert
that two Cart Porlets on the right <strong>have "Cart is
empty"</strong></p><ul><li>Click on "Add to Cart"
on the Catalog Portlet on the right half for Tent.</li></ul><p>
Assert that two Cart Portlets on the left half <strong>have
"Tent"</strong> in them</p><p style="padding-left:
30px;"> Assert that two Cart Porlets on the <strong>right have
"Tent"</strong> in them.</p><p style="min-height: 8pt;
height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt;
height: 8pt; padding: 0px;"> </p>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Events+-+Fallback</h3>
+ * <p>
+ * This is demonstration of mix of both explicit and implicit. (Is there a
+ * better way to describe this?)
+ * </p>
+ * <ul>
+ * <li>Click on "Add to Cart" on the Catalog Portlet on the left half
for
+ * Snowboard.</li>
+ * </ul>
+ * <p>
+ * Assert that two Cart Portlets on the left half<strong> have Snowboard in
+ * them.</strong>
+ * </p>
+ * <p style="padding-left: 30px;"> Assert that two Cart Porlets on the
right
+ * <strong>have "Cart is empty"</strong></p>
+ * <ul>
+ * <li>Click on "Add to Cart" on the Catalog Portlet on the right half
for
+ * Tent.</li>
+ * </ul>
+ * <p>
+ * Assert that two Cart Portlets on the left half <strong>have
+ * "Tent"</strong> in them
+ * </p>
+ * <p style="padding-left: 30px;"> Assert that two Cart Porlets on the
+ * <strong>right have "Tent"</strong> in them.</p><p
+ * style="min-height: 8pt; height: 8pt; padding:
0px;"> </p><p
+ * style="min-height: 8pt; height: 8pt; padding:
0px;"> </p>
*/
@Test(enabled = true)
public void eventsFallbackTest() {
@@ -262,7 +330,35 @@
/**
* Events implicit test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Events+-+Impl...
is implicit wiring which is the default wiring. Events are propagated based on their Qname
regarless of which portlet generated the event.</p><ul><li>Click on
"Add to Cart" on the Catalog Portlet on the left half for
Snowboard.</li></ul><p> Assert that two Cart Portlets on
the left half<strong> have Snowboard in them.</strong></p><p
style="padding-left: 30px;"> Assert that two Cart Porlets on the right
<strong>have Snowboard in them.</strong></p><ul><li>Click on
"Add to Cart" on the Catalog Portlet on the right half for
Tent.</li></ul><p> Assert that two Cart Portlets on the
left half <strong>have "Tent"</strong> in them</p><p
style="padding-left: 30px;"> Assert that two Cart Porlets on the
<strong>right have "Tent"</strong> in them.</p><p
style="min-height: 8pt; height: 8pt; padding:
0px;"> </p><h2><span><span style="color!
: #800000;">Parameters Binding:</span></span></h2>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Events+-+Implicit</h3>
+ * <p>
+ * This is implicit wiring which is the default wiring. Events are
+ * propagated based on their Qname regarless of which portlet generated the
+ * event.
+ * </p>
+ * <ul>
+ * <li>Click on "Add to Cart" on the Catalog Portlet on the left half
for
+ * Snowboard.</li>
+ * </ul>
+ * <p>
+ * Assert that two Cart Portlets on the left half<strong> have Snowboard in
+ * them.</strong>
+ * </p>
+ * <p style="padding-left: 30px;"> Assert that two Cart Porlets on the
right
+ * <strong>have Snowboard in them.</strong></p>
+ * <ul>
+ * <li>Click on "Add to Cart" on the Catalog Portlet on the right half
for
+ * Tent.</li>
+ * </ul>
+ * <p>
+ * Assert that two Cart Portlets on the left half <strong>have
+ * "Tent"</strong> in them
+ * </p>
+ * <p style="padding-left: 30px;"> Assert that two Cart Porlets on the
+ * <strong>right have "Tent"</strong> in them.</p><p
+ * style="min-height: 8pt; height: 8pt; padding:
0px;"> </p>
*/
@Test(enabled = true)
public void eventsImplicitTest() {
@@ -349,7 +445,31 @@
/**
* Parameter alias test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+...
style="min-height: 8pt; height: 8pt; padding:
0px;"> </p><ul><li><span>Hit the URL
</span><a class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Alias?binding1=Viliam">http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Alias?binding1=Viliam</a><span>.
Assert that </span><strong>"Viliam" is present</strong> in all
PublicParametersPortletWindow for foo* parameters</li><li><span>Hit the
URL </span><a class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Alias?binding2=Prabhat">http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Alias?binding2=Prabhat</a><span>.
Assert that </span><strong>"Prabhat" is present </strong>in
all PublicParametersPortletWindow for juu* parameters and <strong>Viliam is not
present</!
strong> in all PublicParametersPortletWindow for foo*
parameters</li><li>Add "footest" for foo1 in
PublicParametersPortletWindow1 and hit update. Assert that "footest" is present
in all PublicParametersPortletWindow</li><li>Click on Remove link from
PublicParametersPortletWindow4 for foo2. Assert that "footest" is removed from
all PublicParametersPortletWindow.</li><li>In Page Parameters Portlet, add any
parameter and value (xyz, 123) and verify that URL is changed (appended with ?xyz=123)
once you hit update.</li></ul>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Parameters+-+Alias</h3><p
+ * style="min-height: 8pt; height: 8pt; padding:
0px;"> </p>
+ * <ul>
+ * <li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Alias?binding1=Viliam"
+ * >http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-
+ * +Alias?binding1=Viliam</a><span>. Assert that
</span><strong>"Viliam" is
+ * present</strong> in all PublicParametersPortletWindow for foo* parameters
+ * </li>
+ * <li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Alias?binding2=Prabhat"
+ * >http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-
+ * +Alias?binding2=Prabhat</a><span>. Assert that
</span><strong>"Prabhat"
+ * is present </strong>in all PublicParametersPortletWindow for juu*
+ * parameters and <strong>Viliam is not present</strong> in all
+ * PublicParametersPortletWindow for foo* parameters</li>
+ * <li>Add "footest" for foo1 in PublicParametersPortletWindow1 and hit
+ * update. Assert that "footest" is present in all
+ * PublicParametersPortletWindow</li>
+ * <li>Click on Remove link from PublicParametersPortletWindow4 for foo2.
+ * Assert that "footest" is removed from all
PublicParametersPortletWindow.</li>
+ * <li>In Page Parameters Portlet, add any parameter and value (xyz, 123)
+ * and verify that URL is changed (appended with ?xyz=123) once you hit
+ * update.</li>
+ * </ul>
*/
@Test(enabled = true)
public void parameterAliasTest() {
@@ -476,7 +596,26 @@
/**
* Parameter explicit test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+...
the URL </span><a class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Explicit?binding1=Viliam">http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Explicit?binding1=Viliam</a><span>.
Assert that </span><strong>"Viliam" is present in Windows 1,2 and 3
but not in 4.</strong></li><li>Click on Remove link from Window 3 and
assert that "Viliam" is not present in any of
windows.</li><li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Explicit?binding2=Nepal">http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Explicit?binding2=Nepal</a><span>.
Assert that "Nepal" is present in Window1 for bar1, daa1 for Window2, bar2 for
Window3, daa2 for Window4.</span><br/></li><!
li>In Page Parameters Portlet, add any parameter and value (xyz, 123) and verify that
URL is changed (appended with ?xyz=123) once you hit update.</li></ul><p
style="min-height: 8pt; height: 8pt; padding: 0px;"> </p>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Parameters+-+Explicit</h3>
+ * <ul>
+ * <li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Explicit?binding1=Viliam"
+ * >http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-
+ * +Explicit?binding1=Viliam</a><span>. Assert that
</span><strong>"Viliam"
+ * is present in Windows 1,2 and 3 but not in 4.</strong></li>
+ * <li>Click on Remove link from Window 3 and assert that "Viliam" is
not
+ * present in any of windows.</li>
+ * <li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+Explicit?binding2=Nepal"
+ * >http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-
+ * +Explicit?binding2=Nepal</a><span>. Assert that "Nepal" is
present in
+ * Window1 for bar1, daa1 for Window2, bar2 for Window3, daa2 for
+ * Window4.</span><br/></li>
+ * <li>In Page Parameters Portlet, add any parameter and value (xyz, 123)
+ * and verify that URL is changed (appended with ?xyz=123) once you hit
+ * update.</li>
+ * </ul>
+ * <p style="min-height: 8pt; height: 8pt; padding:
0px;"> </p>
*/
@Test(enabled = true)
public void parameterExplicitTest() {
@@ -524,9 +663,9 @@
Assert.assertEquals(selenium.getValue(PAR_R2_FOO2), "");
Assert.assertEquals(selenium.getValue(PAR_R2_DAA2), "");
Assert.assertEquals(selenium.getValue(PAR_R2_BAR2), "");
-
+
clickAndWait(PAR_R1_FOO1_R);
-
+
Assert.assertEquals(selenium.getValue(PAR_L1_DAA1), "");
Assert.assertEquals(selenium.getValue(PAR_L1_BAR1), "");
Assert.assertEquals(selenium.getValue(PAR_L1_JUU1), "");
@@ -579,7 +718,29 @@
/**
* Parameter explicit alias test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+...
the URL </span><a class="jive-link-external-small"
href="http://host:8080/portal/portal/portal/default/Coordination+Samples/Parameters+-+Explicit%2BAlias?binding1=prabhat">http://host:8080/portal/portal/portal/default/Coordination+Samples/Parameters+-+Explicit%2BAlias?binding1=prabhat</a><span>.
Assert that </span><strong>"Prabhat" is present in Windows 1 for
foo1 and in Windows2 for bar1.<br/></strong></li><li>Click on
Remove link from Window 2 and assert that "Prabhat" is not present in any of
windows.</li><li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/portal/default/Coordination+Samples/Parameters+-+Explicit%2BAlias?binding2=Thomas">http://host:8080/portal/portal/portal/default/Coordination+Samples/Parameters+-+Explicit%2BAlias?binding2=Thomas</a><span>.
Assert that "Thomas" is present!
in Window2, Window3 and Window4 but not in Window1. Since foo parameter in Window is
part of binding1 and it's explicit binding, using binding2 does not have impact on foo
parameter for window1.</span><br/> </li><li>In Page Parameters
Portlet, add any parameter and value (xyz, 123) and verify that URL is changed (appended
with ?xyz=123) once you hit update.</li></ul><p style="min-height:
8pt; height: 8pt; padding: 0px;"> </p>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Parameters+-+Explicit%2BAlias</h3>
+ * <ul>
+ * <li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/portal/default/Coordination+Samples/Parameters+-+Explicit%2BAlias?binding1=prabhat"
+ * >http://host:8080/portal/portal/portal/default/Coordination+Samples/
+ * Parameters+-+Explicit%2BAlias?binding1=prabhat</a><span>. Assert that
+ * </span><strong>"Prabhat" is present in Windows 1 for foo1 and
in Windows2
+ * for bar1.<br/></strong></li>
+ * <li>Click on Remove link from Window 2 and assert that "Prabhat" is
not
+ * present in any of windows.</li>
+ * <li><span>Hit the URL </span><a
class="jive-link-external-small"
href="http://host:8080/portal/portal/portal/default/Coordination+Samples/Parameters+-+Explicit%2BAlias?binding2=Thomas"
+ * >http://host:8080/portal/portal/portal/default/Coordination+Samples/
+ * Parameters+-+Explicit%2BAlias?binding2=Thomas</a><span>. Assert that
+ * "Thomas" is present in Window2, Window3 and Window4 but not in Window1.
+ * Since foo parameter in Window is part of binding1 and it's explicit
+ * binding, using binding2 does not have impact on foo parameter for
+ * window1.</span><br/></li>
+ * <li>In Page Parameters Portlet, add any parameter and value (xyz, 123)
+ * and verify that URL is changed (appended with ?xyz=123) once you hit
+ * update.</li>
+ * </ul>
+ * <p style="min-height: 8pt; height: 8pt; padding:
0px;"> </p>
*/
@Test(enabled = true)
public void parameterExplicitAliasTest() {
@@ -627,9 +788,9 @@
Assert.assertEquals(selenium.getValue(PAR_R2_FOO2), "");
Assert.assertEquals(selenium.getValue(PAR_R2_DAA2), "");
Assert.assertEquals(selenium.getValue(PAR_R2_BAR2), "");
-
+
clickAndWait(PAR_R1_BAR1_R);
-
+
Assert.assertEquals(selenium.getValue(PAR_L1_DAA1), "");
Assert.assertEquals(selenium.getValue(PAR_L1_BAR1), "");
Assert.assertEquals(selenium.getValue(PAR_L1_JUU1), "");
@@ -682,7 +843,17 @@
/**
* Parameter implicit test.
*
- * <h3>For the page:
http://host:8080/portal/portal/default/Coordination+Samples/Parameters+-+...
"footest" for foo1 in PublicParametersPortletWindow1 and hit update. Assert that
"footest" is present in all
PublicParametersPortletWindow</li><li>Click on Remove link from
PublicParametersPortletWindow4 for foo2. Assert that "footest" is removed from
all PublicParametersPortletWindow</li><li>Need clarification for the
rest.</li></ul>
+ * <h3>For the page:
+ *
http://host:8080/portal/portal/default/Coordination+Samples
+ * /Parameters+-+Implicit</h3>
+ * <ul>
+ * <li>Add "footest" for foo1 in PublicParametersPortletWindow1 and hit
+ * update. Assert that "footest" is present in all
+ * PublicParametersPortletWindow</li>
+ * <li>Click on Remove link from PublicParametersPortletWindow4 for foo2.
+ * Assert that "footest" is removed from all
PublicParametersPortletWindow</li>
+ * <li>Need clarification for the rest.</li>
+ * </ul>
*/
@Test(enabled = true)
public void parameterImplicitTest() {
@@ -712,9 +883,9 @@
Assert.assertEquals(selenium.getValue(PAR_R2_FOO2), "footest");
Assert.assertEquals(selenium.getValue(PAR_R2_DAA2), "");
Assert.assertEquals(selenium.getValue(PAR_R2_BAR2), "");
-
+
clickAndWait(PAR_L1_FOO1_R);
-
+
Assert.assertEquals(selenium.getValue(PAR_L1_DAA1), "");
Assert.assertEquals(selenium.getValue(PAR_L1_BAR1), "");
Assert.assertEquals(selenium.getValue(PAR_L1_JUU1), "");
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -6,17 +6,21 @@
import org.testng.annotations.Test;
/**
+ * DashboardTestCase is responsible for testing configure dashboard functions.
+ * Each test is running with user "admin" logged in.
+ *
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "cms_dashboard" }, enabled = true, description =
"Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
-
private static final String MSG_POWER = "Powered by JBoss Enterprise Portal
Platform";
+ /** prefix for locator properties = dash. */
public String casePfx = "dash.";
- private final String LNK_POR_WEA_EDIT = getProp(casePfx + "lnk.por.wea.edit",
"//body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/div[2]/span/a");
+ private final String LNK_POR_WEA_EDIT = getProp(casePfx + "lnk.por.wea.edit",
+ "//body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/div[2]/span/a");
private final String SUB_LAYOUT_UPDATE = getProp(casePfx +
"sub.layout.update",
"//input[contains(@name,'dashboardLayoutForm:j_id12')]");
private final String SUB_PAGE_RENAME = getProp(casePfx + "sub.page.rename",
"//form[contains(@id,'renameForm')]/input[@type='submit']");
private final String INP_PAGE_RENAME = getProp(casePfx + "inp.page.rename",
"//input[contains(@id,'renameForm:newName')]");
@@ -41,13 +45,13 @@
private final String SUB_THEMESEL = getProp(casePfx + "sub.themesel",
"//form[contains(@id,'dashboardThemeForm')]/input[@type='submit']");
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ protected void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
}
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
+ protected void logoutAfterTest() {
}
@@ -60,6 +64,11 @@
}
}
+ /**
+ * Creates a page. In Dashboard configuration a new page named
+ * "DashTestPage" is created. The existence of the link (page) is then
+ * asserted on dashboard.s
+ */
@Test(enabled = true)
public void testCreatePage() {
selenium.click(LNK_DASHBOARD);
@@ -84,6 +93,12 @@
Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
}
+ /**
+ * Renaming of a page on dashboard. firstly a page named "DashToRenamePage"
+ * is created the same way as in {@link DashboardTestCase#testCreatePage()}.
+ * The page is then renamed to "DashRenamedPage".
+ */
+ // TODO final assertion is missing
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testRenamePage() {
@@ -121,6 +136,12 @@
}
+ /**
+ * Updating a theme on a page. On a page created in
+ * {@link DashboardTestCase#testCreatePage()} a theme is changed to
+ * "renaissance". It is asserted that it was not selected before and at the
+ * end it is asserted, that the renaissance value is selected.
+ */
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateTheme() {
// selenium.setSpeed("10000");
@@ -132,6 +153,8 @@
selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ Assert.assertFalse(selenium.getSelectedLabel(SEL_THEME).equals("renaissance"),
"Previously selected theme other then expected.");
+
selenium.select(SEL_THEME, "label=renaissance");
selenium.click(SUB_THEMESEL);
@@ -147,6 +170,12 @@
Assert.assertEquals(selenium.getSelectedLabel(SEL_THEME), "renaissance",
"Previously selected theme other then expected.");
}
+ /**
+ * Updating a layout on a page. On a page created in
+ * {@link DashboardTestCase#testCreatePage()} a theme is changed to
+ * "generic". It is asserted that it was not selected before and at the end
+ * it is asserted, that the renaissance value is selected.
+ */
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
// selenium.setSpeed("10000");
@@ -158,6 +187,8 @@
selenium.windowMaximize();
selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ Assert.assertFalse(selenium.getSelectedLabel(SEL_LAYOUT).equals("generic"),
"Previously selected layout other then expected.");
+
selenium.select(SEL_LAYOUT, "label=generic");
selenium.click(SUB_LAYOUT_UPDATE);
@@ -173,6 +204,11 @@
Assert.assertEquals(selenium.getSelectedLabel(SEL_LAYOUT), "generic",
"Previously selected layout other then expected.");
}
+ /**
+ * Adding a portlet to dashboard. Adding a "Who's online portlet" to
+ * dashboard (center). At the end some strings specific for the portlet are
+ * asserted to appear on a dashboard.
+ */
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testAddPortlet() {
// selenium.setSpeed("10000");
@@ -200,6 +236,17 @@
// selenium.setSpeed("0");
}
+ /**
+ * Moving with portlets on a dashboard. Firstly a page called "DashMovePage"
+ * is created the same way as in {@link DashboardTestCase#testCreatePage()}.
+ * Then two portlets ("Welcome portlet", "Who's online portlet"
in that
+ * order) are added to the page the same way as in
+ * {@link DashboardTestCase#testAddPortlet()}. Their positions are swapped
+ * at the end and the ordering of strings on a dashboard page is used for
+ * assertion.
+ *
+ */
+ // TODO assert the the ordering just after adding
@Test(enabled = true, dependsOnMethods = { "testCreatePage",
"testAddPortlet" })
public void testMovePortlet() {
final String pageName = "DashMovePage";
@@ -241,6 +288,12 @@
}
+ /**
+ * Reordering of portlets. After the portlets are moved in
+ * {@link DashboardTestCase#testMovePortlet()}, they are swaped to the
+ * previous position (reordered again) with this test. The ordering of
+ * strings on a dashboard page is used for assertion.
+ */
@Test(enabled = true, dependsOnMethods = { "testCreatePage",
"testMovePortlet" })
public void testReorder() {
final String pageName = "DashMovePage";
@@ -265,6 +318,12 @@
Assert.assertTrue(assertTextOrder("Current;Greetings"));
}
+ /**
+ * Deleting of a portlet. Portlet added in
+ * {@link DashboardTestCase#testAddPortlet()} is used in this test. The
+ * portlet is deleted and it is asserted that string specific for this
+ * portlet are not appearing on the dashboard anymore.
+ */
@Test(enabled = true, dependsOnMethods = { "testAddPortlet" })
public void testDeletePortlet() {
@@ -290,6 +349,12 @@
Assert.assertFalse(selenium.isTextPresent("[admin]"));
}
+ /**
+ * Adding of google portlet. Same as
+ * {@link DashboardTestCase#testAddPortlet()} but added portlet is of type
+ * "widget/google" (content type selector). "Band Culinaria" google
portlet
+ * is used in this test.
+ */
@Test(enabled = false, dependsOnMethods = { "testCreatePage" })
public void testAddGooglePortlet() {
selenium.click(LNK_DASHBOARD);
@@ -315,6 +380,20 @@
//
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
//
https://jira.jboss.org/jira/browse/JBPORTAL-2177
+ /**
+ * Dashboard rename page loses portlet state settings bug testing.
+ * From forum reference <a
href="http://www.jboss.com/index.html?module=bb&op=viewtopic&...;.
+ * Jira for this issue already created in <a
href="https://jira.jboss.org/jira/browse/JBPORTAL-2177">http...;.
+ * <pre>
+ * - in Configure Dashboard, create a new dashboard page; I called mine test1
+ * - in the left region, add the Weather portlet
+ * - return to the Dashboard, select the new tab/page (test1), you see Miami weather
(the default)
+ * - EDIT the weather portlet and enter a local zipcode, press OK, you see local
weather, so far so good
+ * - return to Configure Dashboard, rename the page (test1a)
+ * - return to the Dashboard, select the newly renamed tab
+ * - now you no longer see the local weather because renaming the page has lost the
portlet window-specific settings
+ * </pre>
+ */
@Test(enabled = true)
public void testBugResetPortletSetting() {
final String pageName = "page1";
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/EndToEndBeaPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/EndToEndBeaPortlet.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/EndToEndBeaPortlet.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -2,141 +2,108 @@
import java.text.MessageFormat;
+import org.jboss.portal.test.selenium.portal.AdminPortalTestCase;
+import org.jboss.portal.test.selenium.portal.PortletDefinitionsTestCase;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
+ * EndToEndBeaPortlet is reposnsible for end-to-end testing of adding a BEA
+ * portlet into a portal page.
+ *
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
-@Test(groups = {"end2end"}, enabled = true, description = "Creating of new
portal with content.")
+//TODO some refactoring of class fields needed
+@Test(groups = { "end2end" }, enabled = true, description = "Creating of
new portal with content.")
public class EndToEndBeaPortlet extends JBossPortalSeleniumTestCase {
-
+ /** prefix for locator properties = e2e.wsrp. */
public static String casePfx = "e2e.wsrp.";
private final String SUB_VIEW_PORTLETS =
"//input[contains(@id,'definition-form:view-portlets')]";
- public final String SEL_CONS_TYPE =
"//select[contains(@id,'definition-form:menu')]";
-
- private final String ADR_HOME =
getProp(casePfx+"adr.home","portal/auth/portal/default");
- private final String INP_CONSUMER_NAME =
getProp(casePfx+"inp.consumer.name","//input[contains(@id,'edit-cons-form:id')]");
- private final String SUBMIT_REFRESH_CANCEL =
getProp(casePfx+"submit.refresh.cancel","//a[contains(@id,'edit-cons-form:list-cons-link')]");
- private final String SUBMIT_PROD_SAVE =
getProp(casePfx+"submit.prod.save","//input[contains(@id,'producer-form:save-producer')]");
- private final String SUBMIT_CONSDEL_CONF =
getProp(casePfx+"submit.consdel.conf","//a[contains(@id,'confirm-delete-form:destroy-link')]");
-
- private final String SUBMIT_CONS_REGVAL =
getProp(casePfx+"submit.cons.regval","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String SUBMIT_REFRESHFINAL =
getProp(casePfx+"submit.refreshfinal","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
-
- private final String INPUT_CONS_REGVALUE =
getProp(casePfx+"input.cons.regvalue","//input[contains(@id,'edit-cons-form:existingProps:0:prop-value-input')]");
- private final String SUBMIT_REFRESHSAVE =
getProp(casePfx+"submit.refreshsave","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String INPUT_CONSWSDL =
getProp(casePfx+"input.conswsdl","//input[contains(@id,'edit-cons-form:wsdl')]");
- private final String INPUT_CACHEEXP =
getProp(casePfx+"input.cacheexp","//input[contains(@id,'edit-cons-form:cache')]");
- private final String SUBMIT_ADDPROP_INIT =
getProp(casePfx+"submit.addprop.init","//a[contains(@id,'producer-form:add-reg-prop')]");
- private final String SUBMIT_ADDPROP =
getProp(casePfx+"submit.addprop","//a[contains(@id,'producer-form:add-reg-prop')]");
- private final String INPUT_PROPHINT =
getProp(casePfx+"input.prophint","//input[contains(@id,'producer-form:reg-properties:0:hint')]");
- private final String INPUT_PROPLABEL =
getProp(casePfx+"input.proplabel","//input[contains(@id,'producer-form:reg-properties:0:label')]");
- private final String INPUT_PROPNAME =
getProp(casePfx+"input.propname","//input[contains(@id,'producer-form:reg-properties:0:name')]");
- private final String SUBMIT_CREATECONS =
getProp(casePfx+"submit.createcons","//input[contains(@id,'createConsumer:createConsumerButton')]");
- private final String INPUT_CREATECONS =
getProp(casePfx+"input.createcons","//input[contains(@id,'createConsumer:consumerName')]");
- private final String ID_LINK_PRODCONF =
getProp(casePfx+"id.link.prodconf","//a[contains(@id,'cons-temp-form:producer-link')]");
- private final String ID_LINK_CONSCONF =
getProp(casePfx+"id.link.consconf","//a[contains(@id,'producer-temp-form:consumersTab')]");
- private final String LINK_CONSUMER_HOME
=getProp(casePfx+"link.consumer.home","//a[contains(@id,'cons-temp-form1:list-cons-link')]");
-
- private final String
LINK_T_CONS_CON=getProp(casePfx+"link.t.cons.con","//a[contains(@id,''consumer-list-form:consumersList:{0}:configure'')]");
- private final String
LINK_T_CONS_REF=getProp(casePfx+"link.t.cons.ref","//a[contains(@id,''consumer-list-form:consumersList:{0}:refresh'')]");
- private final String
LINK_T_CONS_ACT=getProp(casePfx+"link.t.cons.act","//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
- private final String
LINK_T_CONS_DEA=getProp(casePfx+"link.t.cons.dea","//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
- private final String
LINK_T_CONS_REG=getProp(casePfx+"link.t.cons.reg","//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
- private final String
LINK_T_CONS_DER=getProp(casePfx+"link.t.cons.der","//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
- private final String
LINK_T_CONS_DEL=getProp(casePfx+"link.t.cons.del","//a[contains(@id,''consumer-list-form:consumersList:{0}:delete'')]");
-
- ///
-
- public final String SEL_PORTLET_TYPE =
getProp(casePfx+"sel.portlet.type","//select[contains(@id,'windowForm:instanceId')]");
- private final String SUB_LAYOUT_ADD_CENTER =
getProp(casePfx+"sub.layout.add.center","//input[contains(@id,'layoutForm:a_center')]");
- private final String INP_WINDOW_NAME =
getProp(casePfx+"inp.window.name","//input[contains(@id,'windowForm:windowName')]");
- private final String SUB_RENAME_PORTAL =
getProp(casePfx+"sub.rename.portal","//input[contains(@id,'renameForm:rename')]");
- private final String INP_RENAME_PORTAL =
getProp(casePfx+"inp.rename.portal","//input[contains(@id,'renameForm:newName')]");
- private final String SUB_DELETE_PORTAL_CONF =
getProp(casePfx+"sub.delete.portal.conf","//input[contains(@id,'delete-view:confirm-form:delete')]");
- private final String INP_SUBMIT_PAGECREATE =
getProp(casePfx+"inp.submit.pagecreate","//input[contains(@id,'create-page-form:create-page')]");
- private final String INP_PAGENAME =
getProp(casePfx+"inp.pagename","//input[contains(@id,'create-page-form:pageName')]");
- private final String INP_PORTALNAME =
getProp(casePfx+"inp.portalname","//input[contains(@id,'create-portal-form:name')]");
- private final String INP_SUBMIT_CREATEPORTAL =
getProp(casePfx+"inp.submit.createportal","//input[contains(@id,'create-portal-form:create-portal')]");
- private final String TAB_PORTALOBJ_ID =
getProp(casePfx+"tab.portalobj.id","Link=Admin");
- private final String LNK_PORTALS_ID =
getProp(casePfx+"lnk.portals.id","link=*Portal Objects*");
- private final String LNK_PORTAL_HOME =
getProp(casePfx+"lnk.portal.home","//a[contains(@id,'obj-temp-form:object-link-0')]");
- private final String TBL_PORTAL_ADMIN =
getProp(casePfx+"tbl.portal.admin","//table[contains(@id,'obj-nav-form:portal-datatable')]");
- private final String POR_TL_MAIN =
getProp(casePfx+"por.tl.main","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]");
- private final String POR_TL_SECURITY =
getProp(casePfx+"por.tl.security","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:security-link'')]");
- private final String POR_TL_PROPERTIES =
getProp(casePfx+"por.tl.properties","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:prop-link'')]");
- private final String POR_TL_THEME =
getProp(casePfx+"por.tl.theme","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:theme-link'')]");
- private final String POR_TL_RENAME =
getProp(casePfx+"por.tl.rename","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:rename'')]");
- private final String POR_TL_DELETE =
getProp(casePfx+"por.tl.delete","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:delete'')]");
- private final String POR_TL_MAKEDEF =
getProp(casePfx+"por.tl.makedef","//a[contains(@id,''obj-nav-form:portal-datatable:{0}:default-link'')]");
- private final String TBL_PORTALPAGE_ADMIN =
getProp(casePfx+"tbl.portalpage.admin","//table[contains(@id,'obj-nav-form:pages-datatable')]");
- private final String PAG_TL_MAIN =
getProp(casePfx+"pag.tl.main","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:object-link'')]");
- private final String PAG_TL_LAYOUT =
getProp(casePfx+"pag.tl.layout","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:edit-page-layout'')]");
- private final String PAG_TL_SECURITY =
getProp(casePfx+"pag.tl.security","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:security-link'')]");
- private final String PAG_TL_PROPERTIES =
getProp(casePfx+"pag.tl.properties","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:prop-link'')]");
- private final String PAG_TL_THEME =
getProp(casePfx+"pag.tl.theme","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:theme-link'')]");
- private final String PAG_TL_RENAME =
getProp(casePfx+"pag.tl.rename","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link'')]");
- private final String PAG_TL_DISPLAY =
getProp(casePfx+"pag.tl.display","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-display'')]");
- private final String PAG_TL_DELETE =
getProp(casePfx+"pag.tl.delete","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:delete-link'')]");
- private final String PAG_TL_MAKEDEF =
getProp(casePfx+"pag.tl.makedef","//a[contains(@id,''obj-nav-form:pages-datatable:{0}:default-link'')]");
+ private final String SEL_CONS_TYPE =
"//select[contains(@id,'definition-form:menu')]";
-
- /// def
-
- private final String T_LINK_PREF =
"//a[contains(@id,''def-list:portlet-pref-{0}'')]";
+ private final String ADR_HOME = getProp(casePfx + "adr.home",
"portal/auth/portal/default");
+
+ private final String SUBMIT_CONS_REGVAL = getProp(casePfx +
"submit.cons.regval",
"//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String SUBMIT_REFRESHFINAL = getProp(casePfx +
"submit.refreshfinal",
"//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+
+ private final String INPUT_CONS_REGVALUE = getProp(casePfx +
"input.cons.regvalue",
+ "//input[contains(@id,'edit-cons-form:existingProps:0:prop-value-input')]");
+ private final String SUBMIT_REFRESHSAVE = getProp(casePfx +
"submit.refreshsave",
"//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String INPUT_CONSWSDL = getProp(casePfx + "input.conswsdl",
"//input[contains(@id,'edit-cons-form:wsdl')]");
+ private final String INPUT_CACHEEXP = getProp(casePfx + "input.cacheexp",
"//input[contains(@id,'edit-cons-form:cache')]");
+ private final String SUBMIT_CREATECONS = getProp(casePfx +
"submit.createcons",
"//input[contains(@id,'createConsumer:createConsumerButton')]");
+ private final String INPUT_CREATECONS = getProp(casePfx + "input.createcons",
"//input[contains(@id,'createConsumer:consumerName')]");
+ private final String ID_LINK_CONSCONF = getProp(casePfx + "id.link.consconf",
"//a[contains(@id,'producer-temp-form:consumersTab')]");
+
+ private final String SEL_PORTLET_TYPE = getProp(casePfx + "sel.portlet.type",
"//select[contains(@id,'windowForm:instanceId')]");
+ private final String SUB_LAYOUT_ADD_CENTER = getProp(casePfx +
"sub.layout.add.center",
"//input[contains(@id,'layoutForm:a_center')]");
+ private final String TAB_PORTALOBJ_ID = getProp(casePfx + "tab.portalobj.id",
"Link=Admin");
+ private final String LNK_PORTALS_ID = getProp(casePfx + "lnk.portals.id",
"link=*Portal Objects*");
+ private final String LNK_PORTAL_HOME = getProp(casePfx + "lnk.portal.home",
"//a[contains(@id,'obj-temp-form:object-link-0')]");
+ private final String TBL_PORTAL_ADMIN = getProp(casePfx + "tbl.portal.admin",
"//table[contains(@id,'obj-nav-form:portal-datatable')]");
+ private final String POR_TL_MAIN = getProp(casePfx + "por.tl.main",
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]");
+ private final String TBL_PORTALPAGE_ADMIN = getProp(casePfx +
"tbl.portalpage.admin",
"//table[contains(@id,'obj-nav-form:pages-datatable')]");
+ private final String PAG_TL_LAYOUT = getProp(casePfx + "pag.tl.layout",
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:edit-page-layout'')]");
+
private final String SUBMIT_CREATE_INST =
"//input[contains(@name,'add_instance_form:j_id19')]";
private final String INPUT_INSTANCE_NAME =
"//input[contains(@id,'add_instance_form:instanceId')]";
private final String T_LINK_CREATE =
"//a[contains(@id,''def-list:create-instance-{0}'')]";
- private final String SUBMIT_PROVIDER_VIEW =
"//input[contains(@id,'definition-form:view-portlets')]";
- private final String SELECT_PROVIDER =
"//select[contains(@id,'definition-form:menu')]";
private final String TABLE_PORTLET =
"//form[contains(@id,'def-list')]/table";
- private final String LINK_NAME_ADMIN_PORT =
"//a[contains(@id,'common-show-portlet-detail-form:field1:select')]";
- private final String LINK_ADMIN_PORT =
"//a[contains(@id,'def-list:portlet-def-0')]";
private final String LINK_ADMIN = "link=Admin";
private final String LINK_TAB_PD =
"//a[contains(@id,'admin-subtab-form:portlet-def-link')]";
private final String LINK_PD_MAIN =
"//a[contains(@id,'man-form:def-link')]";
- public static String WSRP_CONSUMER_TABLE =
"//table[contains(@id,':consumer-list-form:consumersList')]";
-
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ protected void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
}
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
- //logout();
+ protected void logoutAfterTest() {
+ // logout();
}
-
+
private String PORTLET = "";
-
+
+ /**
+ * Testing the end-to-end adding of bea portlet. Simple WSRP consumer with
+ * name "BeaE2E" is created similar way as in
+ * {@link WSRPTestCase#testCreateBeaConsumer()}. Then the portlet instance
+ * is created with definition name "BEA: Hellow World", instance name
+ * "1BeaPor" and of type "BeaE2E" similar way as in
+ * {@link PortletDefinitionsTestCase#testCreateInstance()}. The instance is
+ * then added to page "default" to portal "default" similar way as
in
+ * {@link AdminPortalTestCase#testCreateWindow()}. The final assertion is
+ * made in the "default" page of "default" portal. The appearance of
string
+ * specific for bea portlet is asserted.
+ */
+ // TODO - click on a link in BEA applet and assert
@Test(enabled = true, description = "Creating a standard BEA portlet.")
- public void testEnd2EndBeaPortlet(){
-
+ public void testEnd2EndBeaPortlet() {
+
String consName = "BeaE2E";
String portalName = "default";
String pageName = "default";
- String defName= "BEA: Hello World";
- String insName = "1BeaPor";
-
+ String defName = "BEA: Hello World";
+ String insName = "1BeaPor";
+
createConsumer(consName);
createInstance(defName, consName, insName);
addPortlet(portalName, pageName, insName, "portlet");
-
+
selenium.open(ADR_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isTextPresent("1BeaPorWindow"));
Assert.assertTrue(selenium.isTextPresent("Welcome to WebLogic Portal WSRP
Demo."));
-
+
}
-
- private void createConsumer(String consumerName){
+
+ private void createConsumer(String consumerName) {
selenium.open(ADR_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
@@ -144,13 +111,13 @@
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
-
+
selenium.type(INPUT_CREATECONS, consumerName);
-
+
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(INPUT_CACHEEXP, "600");
-
+
selenium.type(INPUT_CONSWSDL,
"http://wsrp.bea.com:7001/producer/producer?WSDL");
selenium.click(SUBMIT_REFRESHSAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -165,77 +132,77 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(consumerName));
}
-
- private void createInstance(String defName, String type, String insName){
+
+ private void createInstance(String defName, String type, String insName) {
selenium.open(ADR_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
clickIfVisible(LINK_ADMIN);
clickIfVisible(LINK_ADMIN);
clickIfVisible(LINK_TAB_PD);
clickIfVisible(LINK_PD_MAIN);
-
- selenium.select(SEL_CONS_TYPE, "label="+type);
+
+ selenium.select(SEL_CONS_TYPE, "label=" + type);
selenium.click(SUB_VIEW_PORTLETS);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
int r = findTableRow(TABLE_PORTLET, defName, 0);
-
- selenium.click(MessageFormat.format(T_LINK_CREATE,r-1));
+
+ selenium.click(MessageFormat.format(T_LINK_CREATE, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("5555");
+ // selenium.setSpeed("5555");
selenium.type(INPUT_INSTANCE_NAME, insName);
selenium.click(SUBMIT_CREATE_INST);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(insName + " portlet details"));
+ Assert.assertTrue(selenium.isTextPresent(insName + " portlet details"));
}
-
+
private void addPortlet(String portalName, String pageName, String portletName, String
type) {
- selenium.open(ADR_HOME);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.open(ADR_HOME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LNK_PORTALS_ID);
- clickIfVisible(LNK_PORTAL_HOME);
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+ clickIfVisible(LNK_PORTAL_HOME);
- int r = findTableRow(TBL_PORTAL_ADMIN, portalName, 0) - 1;
- selenium.click(MessageFormat.format(POR_TL_MAIN, r));
- selenium.waitForPageToLoad(PAGE_LOAD);
+ int r = findTableRow(TBL_PORTAL_ADMIN, portalName, 0) - 1;
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
- r = findTableRow(TBL_PORTALPAGE_ADMIN, pageName, 0) - 1;
+ r = findTableRow(TBL_PORTALPAGE_ADMIN, pageName, 0) - 1;
- // click on the page layout
- selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
+ // click on the page layout
+ selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- //hack
- selenium.select(SEL_PORTLET_TYPE, "label=" + "cms");
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- selenium.select(SEL_PORTLET_TYPE, "label=" + type);
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- selenium.click("link=*"+portletName+"*");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
- selenium.click(SUB_LAYOUT_ADD_CENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
- }
+ // hack
+ selenium.select(SEL_PORTLET_TYPE, "label=" + "cms");
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ selenium.select(SEL_PORTLET_TYPE, "label=" + type);
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ selenium.click("link=*" + portletName + "*");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(SUB_LAYOUT_ADD_CENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -8,6 +8,7 @@
import org.testng.annotations.Test;
/**
+ * IdentityAdminTestCase is responsible for
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@@ -38,50 +39,52 @@
private final String INP_PASS_CHANGE_P2 = getProp(casePfx +
"inp.pass.change.p2",
"//input[contains(@id,':change-pwd-form:passwordCheck')]");
private final String INP_PASS_CHANGE_P1 = getProp(casePfx +
"inp.pass.change.p1",
"//input[contains(@id,':change-pwd-form:password')]");
private final String LNK_CHANGE_PASS = getProp(casePfx + "lnk.change.pass",
"//a[contains(@id,':profile-form:change-pwd-adm-link')]");
- public final String TBL_USERLIST = getProp(casePfx + "tbl.userlist",
"//table[contains(@id,'search-user-form1:userlist')]");
- public final String LNK_T_USRLIST_DEL = getProp(casePfx + "lnk.t.usrlist.del",
"//a[contains(@id,''search-user-form1:userlist:{0}:delete-user-link'')]");
- public final String LNK_T_USRLIST_ROLES = getProp(casePfx +
"lnk.t.usrlist.roles",
"//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]");
- public final String LNK_T_USRLIST_DIS = getProp(casePfx + "lnk.t.usrlist.dis",
"//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]");
- public final String LNK_T_USRLIST_EDIT = getProp(casePfx +
"lnk.t.usrlist.edit",
"//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]");
+ private final String TBL_USERLIST = getProp(casePfx + "tbl.userlist",
"//table[contains(@id,'search-user-form1:userlist')]");
+ private final String LNK_T_USRLIST_DEL = getProp(casePfx +
"lnk.t.usrlist.del",
"//a[contains(@id,''search-user-form1:userlist:{0}:delete-user-link'')]");
+ private final String LNK_T_USRLIST_ROLES = getProp(casePfx +
"lnk.t.usrlist.roles",
"//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]");
+ private final String LNK_T_USRLIST_DIS = getProp(casePfx +
"lnk.t.usrlist.dis",
"//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]");
+ private final String LNK_T_USRLIST_EDIT = getProp(casePfx +
"lnk.t.usrlist.edit",
"//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]");
- public final String TBL_ROLELIST = getProp(casePfx + "tbl.rolelist",
"//table[contains(@id,'roles-form:userlist')]");
+ private final String TBL_ROLELIST = getProp(casePfx + "tbl.rolelist",
"//table[contains(@id,'roles-form:userlist')]");
- public final String LNK_T_ROLLIST_DEL = getProp(casePfx + "lnk.t.rollist.del",
"//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]");
- public final String LNK_T_ROLLIST_MEMBERS = getProp(casePfx +
"lnk.t.rollist.members",
"//a[contains(@id,''roles-form:userlist:{0}:view-role-link'')]");
- public final String LNK_T_ROLLIST_EDIT = getProp(casePfx +
"lnk.t.rollist.edit",
"//a[contains(@id,''roles-form:userlist:{0}:edit-role-link'')]");
+ private final String LNK_T_ROLLIST_DEL = getProp(casePfx +
"lnk.t.rollist.del",
"//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]");
+ private final String LNK_T_ROLLIST_MEMBERS = getProp(casePfx +
"lnk.t.rollist.members",
"//a[contains(@id,''roles-form:userlist:{0}:view-role-link'')]");
+ private final String LNK_T_ROLLIST_EDIT = getProp(casePfx +
"lnk.t.rollist.edit",
"//a[contains(@id,''roles-form:userlist:{0}:edit-role-link'')]");
- public final String TBL_ROLEMEMBERS = getProp(casePfx + "tbl.rolemembers",
"//table[contains(@id,'role-members-form:role-data-table')]");
+ private final String TBL_ROLEMEMBERS = getProp(casePfx + "tbl.rolemembers",
"//table[contains(@id,'role-members-form:role-data-table')]");
- public final String SUB_CONF_CREATE_USER = getProp(casePfx +
"sub.conf.create.user",
"//input[contains(@id,'confirm-form:admin')]");
- public final String SUB_DELETE_ROLE = getProp(casePfx + "sub.delete.role",
"//input[contains(@id,'delete-role-form:confirm')]");
- public final String SUB_ROLE_CREATE = getProp(casePfx + "sub.role.create",
"//input[contains(@id,'create-role-form:submit')]");
- public final String INP_ROLEDISNAME = getProp(casePfx + "inp.roledisname",
"//input[contains(@id,'create-role-form:roledisplayname')]");
- public final String INP_ROLENAME = getProp(casePfx + "inp.rolename",
"//input[contains(@id,'create-role-form:rolename')]");
+ private final String SUB_CONF_CREATE_USER = getProp(casePfx +
"sub.conf.create.user",
"//input[contains(@id,'confirm-form:admin')]");
+ private final String SUB_DELETE_ROLE = getProp(casePfx + "sub.delete.role",
"//input[contains(@id,'delete-role-form:confirm')]");
+ private final String SUB_ROLE_CREATE = getProp(casePfx + "sub.role.create",
"//input[contains(@id,'create-role-form:submit')]");
+ private final String INP_ROLEDISNAME = getProp(casePfx + "inp.roledisname",
"//input[contains(@id,'create-role-form:roledisplayname')]");
+ private final String INP_ROLENAME = getProp(casePfx + "inp.rolename",
"//input[contains(@id,'create-role-form:rolename')]");
- public final String LNK_ROLE_CREATE = getProp(casePfx + "lnk.role.create",
"//a[contains(@id, 'create-role-form:create-role-link')]");
- public final String SUB_DEL_USER = getProp(casePfx + "sub.del.user",
"//input[contains(@id,'delete-user-form:submit')]");
- public final String SUB_ASSIGN_ROLE = getProp(casePfx + "sub.assign.role",
"//input[contains(@id,'assign-roles-form:submit')]");
- public final String SUB_USER_ROLE = getProp(casePfx + "sub.user.role",
"//input[contains(@id,'register-role-form:submit')]");
- public final String SUB_CREATE_USER = getProp(casePfx + "sub.create.user",
"//input[contains(@id,'register-form:submit')]");
- public final String INP_PASSWORD_CHK = getProp(casePfx + "inp.password.chk",
"//input[contains(@id,'register-form:passwordCheck')]");
- public final String INP_PASSWORD = getProp(casePfx + "inp.password",
"//input[contains(@id,'register-form:password')]");
- public final String INP_USEREMAIL = getProp(casePfx + "inp.useremail",
"//input[contains(@id,'register-form:email')]");
- public final String INP_USERNAME = getProp(casePfx + "inp.username",
"//input[contains(@id,'register-form:username')]");
- public final String SUB_SEARCH_USER = getProp(casePfx + "sub.search.user",
"//input[contains(@id,'search-user-form:search') and
@type='submit']");
- public final String INP_SEARCH_USER = getProp(casePfx + "inp.search.user",
"//input[contains(@id,'search-user-form:searchString')]");
- public final String LNK_SEARCH_USER = getProp(casePfx + "lnk.search.user",
"//a[contains(@id,'user-form:search-user-link')]");
- public final String LNK_USERTAB = getProp(casePfx + "lnk.usertab",
"//a[contains(@id,'role-temp-form:manage-users')]");
- public final String LNK_USERMAIN = getProp(casePfx + "lnk.usermain",
"//a[contains(@id,'user-temp-form1:user-adm-link')]");
+ private final String LNK_ROLE_CREATE = getProp(casePfx + "lnk.role.create",
"//a[contains(@id, 'create-role-form:create-role-link')]");
+ private final String SUB_DEL_USER = getProp(casePfx + "sub.del.user",
"//input[contains(@id,'delete-user-form:submit')]");
+ private final String SUB_ASSIGN_ROLE = getProp(casePfx + "sub.assign.role",
"//input[contains(@id,'assign-roles-form:submit')]");
+ private final String SUB_USER_ROLE = getProp(casePfx + "sub.user.role",
"//input[contains(@id,'register-role-form:submit')]");
+ private final String SUB_CREATE_USER = getProp(casePfx + "sub.create.user",
"//input[contains(@id,'register-form:submit')]");
+ private final String INP_PASSWORD_CHK = getProp(casePfx + "inp.password.chk",
"//input[contains(@id,'register-form:passwordCheck')]");
+ private final String INP_PASSWORD = getProp(casePfx + "inp.password",
"//input[contains(@id,'register-form:password')]");
+ private final String INP_USEREMAIL = getProp(casePfx + "inp.useremail",
"//input[contains(@id,'register-form:email')]");
+ private final String INP_USERNAME = getProp(casePfx + "inp.username",
"//input[contains(@id,'register-form:username')]");
+ private final String SUB_SEARCH_USER = getProp(casePfx + "sub.search.user",
"//input[contains(@id,'search-user-form:search') and
@type='submit']");
+ private final String INP_SEARCH_USER = getProp(casePfx + "inp.search.user",
"//input[contains(@id,'search-user-form:searchString')]");
+ private final String LNK_SEARCH_USER = getProp(casePfx + "lnk.search.user",
"//a[contains(@id,'user-form:search-user-link')]");
+ private final String LNK_USERTAB = getProp(casePfx + "lnk.usertab",
"//a[contains(@id,'role-temp-form:manage-users')]");
+ private final String LNK_USERMAIN = getProp(casePfx + "lnk.usermain",
"//a[contains(@id,'user-temp-form1:user-adm-link')]");
- public final String LNK_ROLETAB = getProp(casePfx + "lnk.roletab",
"//a[contains(@id,'user-temp-form:role-mgm-link')]");
+ private final String LNK_ROLETAB = getProp(casePfx + "lnk.roletab",
"//a[contains(@id,'user-temp-form:role-mgm-link')]");
- public final String LNK_ROLEMAIN = getProp(casePfx + "lnk.rolemain",
"//a[contains(@id, 'role-temp-form1:role-admin-link')]");
- public final String LNK_USERMANG_MAIN = getProp(casePfx + "lnk.usermang.main",
"//a[contains(@id,'user-temp-form1:assign-role-link')]");
- public final String LNK_USERMANG_MAIN2 = getProp(casePfx +
"lnk.usermang.main2",
"//a[contains(@id,'user-temp-form1:user-mgm-link')]");
- public final String LNK_CREATE_USER = getProp(casePfx + "lnk.create.user",
"//a[contains(@id,':user-form:create-user-link')]");
+ private final String LNK_ROLEMAIN = getProp(casePfx + "lnk.rolemain",
"//a[contains(@id, 'role-temp-form1:role-admin-link')]");
+ private final String LNK_USERMANG_MAIN = getProp(casePfx +
"lnk.usermang.main",
"//a[contains(@id,'user-temp-form1:assign-role-link')]");
+ private final String LNK_USERMANG_MAIN2 = getProp(casePfx +
"lnk.usermang.main2",
"//a[contains(@id,'user-temp-form1:user-mgm-link')]");
+ private final String LNK_CREATE_USER = getProp(casePfx + "lnk.create.user",
"//a[contains(@id,':user-form:create-user-link')]");
- public final String CHK_ROLE = getProp(casePfx + "chk.role",
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']");
+ private final String CHK_ROLE = getProp(casePfx + "chk.role",
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']");
+
+ /** The timeout used to wait after clicking submit button in user search. */
public final long SEARCH_TIMEOUT = 10000;
private String butDelUsr_id(String userName) {
@@ -97,13 +100,13 @@
}
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ private void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
}
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
+ private void logoutAfterTest() {
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -49,7 +49,7 @@
protected static final int ELEM_TIMEOUT = 220;
@BeforeClass
- public void setupChromeForLogin() throws Exception {
+ protected void setupChromeForLogin() throws Exception {
String browser = System.getProperty("browser");
@@ -62,7 +62,7 @@
}
@AfterClass
- public void tearDownInstaller() throws Exception {
+ protected void tearDownInstaller() throws Exception {
selenium.stop();
}
@@ -82,7 +82,7 @@
return props;
}
- protected String getProp(String prop, String subst) {
+ public String getProp(String prop, String subst) {
if (subst == null || "".equals(subst)) {
subst = "Locator not set";
@@ -97,7 +97,7 @@
}
}
- protected void clickIfVisible(String id) {
+ public void clickIfVisible(String id) {
if (selenium.isElementPresent(id)) {
selenium.click(id);
@@ -106,16 +106,16 @@
}
}
- protected int findTableRow(String tableLocation, String searchName, int searchCol) {
+ public int findTableRow(String tableLocation, String searchName, int searchCol) {
return Integer.valueOf(selenium.getEval("selenium.findTableRow(\"" +
tableLocation + "\",'" + searchName + "'," + searchCol +
")"));
}
- protected int countTableRows(String tableLocation) {
+ public int countTableRows(String tableLocation) {
return Integer.valueOf(selenium.getEval("selenium.countTableRows(\"" +
tableLocation + "\")"));
}
// TODO refactor
- protected void safeSelect(String locator, String value) {
+ public void safeSelect(String locator, String value) {
waitForElement(locator);
for (int second = 0;; second++) {
@@ -143,18 +143,18 @@
selenium.select(locator, "label=" + value);
}
- protected void clickAndWait(String locator) {
+ public void clickAndWait(String locator) {
waitForElement(locator);
selenium.click(locator);
selenium.waitForPageToLoad(PAGE_LOAD);
}
- protected void openAndWait(String locator) {
+ public void openAndWait(String locator) {
selenium.open(locator);
selenium.waitForPageToLoad(PAGE_LOAD);
}
-
- protected void selectIfNotSelected(String selector, String label) {
+
+ public void selectIfNotSelected(String selector, String label) {
waitForElement(selector);
if (!selenium.getSelectedLabel(selector).equals(label)) {
selenium.select(selector, "label=" + label);
@@ -162,11 +162,16 @@
}
}
- protected boolean assertTextOrder(String text) {
+ public boolean assertTextOrder(String text) {
return Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" +
text + "\")"));
}
- protected void waitFor(long time) {
+ /**
+ * Waits for specified time in ms. Used mostly in AJAX based tests.
+ *
+ * @param time the time (in ms) to be waited for.
+ */
+ public void waitFor(long time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
@@ -175,7 +180,12 @@
}
}
- protected void waitForElement(String locator) {
+ /**
+ * Waits for element to appear on the screen. Used mostly in AJAX based tests.
+ *
+ * @param locator the locator of the element to be waited for
+ */
+ public void waitForElement(String locator) {
for (int second = 0;; second++) {
if (second >= ELEM_TIMEOUT) {
Assert.fail("Element " + locator + " not found.");
@@ -190,7 +200,16 @@
}
}
- protected void waitForElement(String locatorElem, String locatorLink, long timeToWait,
long n) {
+ /**
+ * Waits for element to appear on the screen. Used mostly in AJAX based tests.
+ *
+ * @param locatorElem the element locator
+ * @param locatorLink the link locator - not used
+ * @param timeToWait the time (in ms) to wait until timeout is reached
+ * @param n the n
+ */
+ //TODO refactor - locatorLink is not used
+ public void waitForElement(String locatorElem, String locatorLink, long timeToWait, long
n) {
for (int i = 0;; i++) {
if (i >= n) {
Assert.fail("Element " + locatorElem + " not found.");
@@ -205,6 +224,11 @@
}
}
+ /**
+ * Waits for text to appear on the screen. Used mostly in AJAX based tests.
+ *
+ * @param text the text to be waited for
+ */
public void waitForText(String text) {
for (int second = 0;; second++) {
if (second >= ELEM_TIMEOUT) {
@@ -220,7 +244,13 @@
}
}
- protected void login(String username, String password) {
+ /**
+ * Login into JBoss portal.
+ *
+ * @param username the username
+ * @param password the password
+ */
+ public void login(String username, String password) {
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -239,7 +269,10 @@
Assert.assertTrue(selenium.isTextPresent("Logged in as: " + username),
"Not logged in, login message missing.");
}
- protected void logout() {
+ /**
+ * Logs out from JBoss portal application.
+ */
+ public void logout() {
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent(LINK_LOGOUT));
@@ -249,7 +282,11 @@
Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link
not present.");
}
- protected void logoutIfPossible() {
+ /**
+ * Logs out from portal application if a user is logged in.
+ */
+ //TODO refactoring needed - use function logout()
+ public void logoutIfPossible() {
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
if (selenium.isElementPresent(LINK_LOGOUT)) {
@@ -260,12 +297,22 @@
}
}
- protected void debugPrint(String debugText) {
+ /**
+ * Prints a message into the system output for debugging purposes. The message is
printed only in the case, if the value true of parameter <i>debug</i> was
passed to jvm with -Ddebug="true" switch.
+ *
+ * @param debugText the debug text
+ */
+ public void debugPrint(String debugText) {
if (JBossSeleniumTestListener.debug)
System.out.println("[Selenium debug] : " + debugText);
}
- protected void debugScreenshot(String filename) {
+ /**
+ * Captures screenshot for debugging purposes. Saves a screenshot into debug directory.
The screenshot is saved only in the case, if the value true of parameter
<i>debug</i> was passed to jvm with -Ddebug="true" switch.
+ *
+ * @param filename the filename of the debug screenshot
+ */
+ public void debugScreenshot(String filename) {
if (JBossSeleniumTestListener.debug)
selenium.captureScreenshot(debugDir + "/" + filename);
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -10,9 +10,12 @@
import org.testng.annotations.Test;
/**
+ * CMSSecureTestCase is reponsible for testing of security of CMS module in
+ * JBoss Portal.
+ *
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
-
+//TODO tests testing write and manage security are missing
@Test(groups = { "cms_secure" }, enabled = true, description = "Setting
permissions on the default portlet.")
public class CMSSecureTestCase extends JBossPortalSeleniumTestCase {
private final String casePfx = "cms.sec.";
@@ -34,27 +37,29 @@
private final String LNK_LOGOUT = getProp(casePfx + "lnk.logout",
"link=Logout");
private final String SEL_CMS_ACTION = getProp(casePfx + "sel.cms.action",
"//div[@id='center']/div/div/div[1]/div/select");
+ /** prefix for locator properties = user.login. */
public String caseIPfx = "iden.man.";
- public final String LNK_ROLETAB = getProp(caseIPfx + "lnk.roletab",
"//a[contains(@id,'user-temp-form:role-mgm-link')]");
- public final String LNK_ROLEMAIN = getProp(caseIPfx + "lnk.rolemain",
"//a[contains(@id, 'role-temp-form1:role-admin-link')]");
- public final String LNK_ROLE_CREATE = getProp(caseIPfx + "lnk.role.create",
"//a[contains(@id, 'create-role-form:create-role-link')]");
- public final String INP_ROLEDISNAME = getProp(caseIPfx + "inp.roledisname",
"//input[contains(@id,'create-role-form:roledisplayname')]");
- public final String INP_ROLENAME = getProp(caseIPfx + "inp.rolename",
"//input[contains(@id,'create-role-form:rolename')]");
- public final String SUB_ROLE_CREATE = getProp(caseIPfx + "sub.role.create",
"//input[contains(@id,'create-role-form:submit')]");
- public final String SUB_ASSIGN_ROLE = getProp(caseIPfx + "sub.assign.role",
"//input[contains(@id,'assign-roles-form:submit')]");
- public final String CHK_ROLE = getProp(caseIPfx + "chk.role",
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']");
- public final String LNK_USERTAB = getProp(caseIPfx + "lnk.usertab",
"//a[contains(@id,'role-temp-form:manage-users')]");
- public final String LNK_USERMAIN = getProp(caseIPfx + "lnk.usermain",
"//a[contains(@id,'user-temp-form1:user-adm-link')]");
- public final String LNK_USERMANG_MAIN = getProp(caseIPfx +
"lnk.usermang.main",
"//a[contains(@id,'user-temp-form1:assign-role-link')]");
- public final String SUB_SEARCH_USER = getProp(caseIPfx + "sub.search.user",
"//input[contains(@id,'search-user-form:search') and
@type='submit']");
- public final String INP_SEARCH_USER = getProp(caseIPfx + "inp.search.user",
"//input[contains(@id,'search-user-form:searchString')]");
- public final String LNK_SEARCH_USER = getProp(caseIPfx + "lnk.search.user",
"//a[contains(@id,'user-form:search-user-link')]");
- public final String TBL_USERLIST = getProp(caseIPfx + "tbl.userlist",
"//table[contains(@id,'search-user-form1:userlist')]");
- public final String LNK_T_USRLIST_ROLES = getProp(caseIPfx +
"lnk.t.usrlist.roles",
+
+ private final String LNK_ROLETAB = getProp(caseIPfx + "lnk.roletab",
"//a[contains(@id,'user-temp-form:role-mgm-link')]");
+ private final String LNK_ROLEMAIN = getProp(caseIPfx + "lnk.rolemain",
"//a[contains(@id, 'role-temp-form1:role-admin-link')]");
+ private final String LNK_ROLE_CREATE = getProp(caseIPfx + "lnk.role.create",
"//a[contains(@id, 'create-role-form:create-role-link')]");
+ private final String INP_ROLEDISNAME = getProp(caseIPfx + "inp.roledisname",
"//input[contains(@id,'create-role-form:roledisplayname')]");
+ private final String INP_ROLENAME = getProp(caseIPfx + "inp.rolename",
"//input[contains(@id,'create-role-form:rolename')]");
+ private final String SUB_ROLE_CREATE = getProp(caseIPfx + "sub.role.create",
"//input[contains(@id,'create-role-form:submit')]");
+ private final String SUB_ASSIGN_ROLE = getProp(caseIPfx + "sub.assign.role",
"//input[contains(@id,'assign-roles-form:submit')]");
+ private final String CHK_ROLE = getProp(caseIPfx + "chk.role",
"//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']");
+ private final String LNK_USERTAB = getProp(caseIPfx + "lnk.usertab",
"//a[contains(@id,'role-temp-form:manage-users')]");
+ private final String LNK_USERMAIN = getProp(caseIPfx + "lnk.usermain",
"//a[contains(@id,'user-temp-form1:user-adm-link')]");
+ private final String LNK_USERMANG_MAIN = getProp(caseIPfx +
"lnk.usermang.main",
"//a[contains(@id,'user-temp-form1:assign-role-link')]");
+ private final String SUB_SEARCH_USER = getProp(caseIPfx + "sub.search.user",
"//input[contains(@id,'search-user-form:search') and
@type='submit']");
+ private final String INP_SEARCH_USER = getProp(caseIPfx + "inp.search.user",
"//input[contains(@id,'search-user-form:searchString')]");
+ private final String LNK_SEARCH_USER = getProp(caseIPfx + "lnk.search.user",
"//a[contains(@id,'user-form:search-user-link')]");
+ private final String TBL_USERLIST = getProp(caseIPfx + "tbl.userlist",
"//table[contains(@id,'search-user-form1:userlist')]");
+ private final String LNK_T_USRLIST_ROLES = getProp(caseIPfx +
"lnk.t.usrlist.roles",
"//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]");
@AfterMethod(groups = { "log" })
- public void logoutAfterTestIfPossible() {
+ private void logoutAfterTestIfPossible() {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -90,7 +95,7 @@
}
@BeforeClass()
- public void createRoles() {
+ private void createRoles() {
String roleName = "secRole";
String roleDisplayName = "secRoleDisp";
@@ -114,6 +119,12 @@
logout();
}
+ /**
+ * Sets admin read permissions, login as user. Sets permissions of
+ * default/index.html to Administrators/admin;#/#;#/#. Assert is then based
+ * on a fact, that logged admin is able to see the content of index html (on
+ * homepage) and non visible to not logged in user or "user".
+ */
@Test(enabled = true, description = "Set admin read permissions, login as
user.")
public void testSetAdminReadPer() {
login("admin", "admin");
@@ -148,12 +159,22 @@
Assert.assertTrue(selenium.isTextPresent("Access to this resource is
denied"), "Secured resource is visible.#2");
logout();
+ login("admin", "admin");
+ Assert.assertFalse(selenium.isTextPresent("Access to this resource is
denied"), "Secured resource is visible.#2");
}
+ /**
+ * Sets user read permissions, login as user. Sets permissions of
+ * default/index.html to Administrators/user;#/#;#/#. At first attempt the
+ * setting of permissions is canceled, at the second attempt, it is
+ * submitted. Assert is then based on a fact, that logged "user" is able to
+ * see the content of index html (on homepage) and non visible to not logged
+ * in user.
+ */
@Test(enabled = true, description = "Set user read permissions, login as
user.")
public void testSetUserReadPer() {
- // cancelling at first stage
+ // canceling at first stage
login("admin", "admin");
@@ -209,6 +230,13 @@
}
+ /**
+ * Sets user read permissions, login as user. It assigns role "secRole" to
+ * user "user". Sets permissions for default/index.html to
+ * secRoleDisp/admin;#/#;#/#. Assert is then based on a fact, that logged
+ * "user" is able to see the content of index html (on homepage) and non
+ * visible to not logged in user.
+ */
@Test(enabled = true, description = "Set admin/secRole read permissions, login as
user w secRole.")
public void testSetRoleReadPer1() {
login("admin", "admin");
@@ -244,6 +272,12 @@
}
+ /**
+ * Sets user read permissions, login as user. It deassigns role "secRole"
from
+ * user "user". Sets permissions for default/index.html to
+ * secRoleDisp/admin;#/#;#/#. Assert is then based on a fact, that logged
+ * "user" is not able to see the content of index html (on homepage) and
neither not logged in user is able to see the resources.
+ */
@Test(enabled = true, dependsOnMethods = { "testSetRoleReadPer1" },
description = "Set admin/secRole read permissions, login as user w/o secRole.")
public void testSetRoleReadPer2() {
login("admin", "admin");
@@ -279,6 +313,10 @@
}
+ /**
+ * Unknown
+ */
+ //TODO implementation missing!
@Test(enabled = false, description = "Recursive permission test")
public void testRecursiveSecurity() {
login("admin", "admin");
@@ -306,6 +344,12 @@
logout();
}
+ /**
+ * Sets user read permissions, login as user. It deassigns role "secRole"
from
+ * user "user". Sets permissions for default/index.html to
+ * Administrators/admin;Administrators/admin;Administrators/admin. Assert is then based
on a fact, that not logged
+ * user is not able to see the subpage of (explore page) of the CMS module.
+ */
@Test(enabled = true, dependsOnMethods = { "testSetRoleReadPer1" },
description = "Subpage permission test")
public void testSubpageSecurity() {
selenium.open("/portal/portal/default");
@@ -412,9 +456,9 @@
selenium.click(LNK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("5000");
+ // selenium.setSpeed("5000");
selenium.type(INP_SEARCH_USER, username);
- //System.out.println(SUB_SEARCH_USER);
+ // System.out.println(SUB_SEARCH_USER);
selenium.click(SUB_SEARCH_USER);
try {
@@ -426,7 +470,7 @@
Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
Assert.assertTrue(selenium.isTextPresent(email), "User email adress was not
found.");
- //selenium.setSpeed("0");
+ // selenium.setSpeed("0");
}
private String butUsrRol_id(String userName) {
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -13,6 +13,7 @@
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*
*/
+//TODO - adding of simple portlet - more portlet types
@Test(groups = { "admin_portal" }, enabled = true, description = "Partal
administrating.")
public class AdminPortalTestCase extends JBossPortalSeleniumTestCase {
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -8,51 +8,64 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+/**
+ * DashboardsTestCase responsible for testing of dashboards settings in portal
+ * admin.
+ *
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
public class DashboardsTestCase extends JBossPortalSeleniumTestCase {
+ /** prefix for locator properties = portal.dash. */
public final String casePfx = "portal.dash.";
-
- private final String T_DH_SUB_UPDATE =
getProp(casePfx+"t.dh.sub.update","//form[contains(@id,'common-edit-theme-form')]/input[@type='submit']");
- private final String T_DH_SEL_RENDERSET =
getProp(casePfx+"t.dh.sel.renderset","//select[contains(@id,'common-edit-theme-form:renderSet')]");
- private final String T_DH_SEL_THEME =
getProp(casePfx+"t.dh.sel.theme","//select[contains(@id,'common-edit-theme-form:theme')]");
- private final String T_DH_SEL_LAYOUT =
getProp(casePfx+"t.dh.sel.layout","//select[contains(@id,'common-edit-theme-form:layout')]");
- private final String T_PA_SUB_UPDATE =
getProp(casePfx+"t.pa.sub.update","//input[contains(@id,'common-edit-page-error-form:update')]");
- private final String T_PO_SUB_UPDATE =
getProp(casePfx+"t.po.sub.update","//input[contains(@id,'common-edit-portal-error-form:update')]");
- private final String T_PA_INP_PAGEADD =
getProp(casePfx+"t.pa.inp.pageadd","//input[contains(@id,'common-edit-page-error-form:page-res-select')]");
- private final String T_PO_INP_PAGEADD =
getProp(casePfx+"t.po.inp.pageadd","//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
- private final String T_PA_SEL_PNF =
getProp(casePfx+"t.pa.sel.pnf","//select[contains(@id,'common-edit-page-error-form:page-not-found-select')]");
- private final String T_PA_SEL_INTERN =
getProp(casePfx+"t.pa.sel.intern","//select[contains(@id,'common-edit-page-error-form:page-internal-select')]");
- private final String T_PA_SEL_ERROR =
getProp(casePfx+"t.pa.sel.error","//select[contains(@id,'common-edit-page-error-form:page-error-select')]");
- private final String T_PA_SEL_CONTROL =
getProp(casePfx+"t.pa.sel.control","//select[contains(@id,'common-edit-page-error-form:page-control-select')]");
- private final String T_PA_SEL_ACCESS =
getProp(casePfx+"t.pa.sel.access","//select[contains(@id,'common-edit-page-error-form:page-access-select')]");
- private final String T_PO_SEL_PNF =
getProp(casePfx+"t.po.sel.pnf","//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
- private final String T_PO_SEL_UNAVAIL =
getProp(casePfx+"t.po.sel.unavail","//select[contains(@id,'common-edit-portal-error-form:portal-unavail-select')]");
- private final String T_PO_SEL_ACCESS =
getProp(casePfx+"t.po.sel.access","//select[contains(@id,'common-edit-portal-error-form:portal-access-select')]");
- private final String SUBMIT_UPDATE_VALUE =
getProp(casePfx+"submit.update.value","//input[contains(@id,'common-manage-prop-form:update')]");
- private final String TABLE_PROPS =
getProp(casePfx+"table.props","//table[contains(@id,'common-manage-prop-form:prop-data-table')]");
- private final String T_PROPS_INPUT_VALUE =
getProp(casePfx+"t.props.input.value","//input[contains(@id,''common-manage-prop-form:prop-data-table:{0}:prop-value-input'')]");
- private final String T_PROPS_LINK_DEL =
getProp(casePfx+"t.props.link.del","//a[contains(@id,''common-manage-prop-form:prop-data-table:{0}:delete'')]");
- private final String TABLE_PA_ERR =
getProp(casePfx+"table.pa.err","//form[@id='common-edit-page-error-form']/table");
- private final String TABLE_PO_ERR =
getProp(casePfx+"table.po.err","//form[@id='common-edit-portal-error-form']/table");
- private final String TABLE_DH_THM =
getProp(casePfx+"table.dh.thm","//form[@id='common-edit-theme-form']/table");
- private final String INPUT_PROP_NAME =
getProp(casePfx+"input.prop.name","//input[contains(@id,'common-edit-prop-form:property')]");
- private final String SUBMIT_ADD_PROP =
getProp(casePfx+"submit.add.prop","//input[contains(@id,'common-edit-prop-form:add-property')]");
- private final String LINK_ADMIN =
getProp(casePfx+"link.admin","link=Admin");
- private final String LINK_TAB_DASH =
getProp(casePfx+"link.tab.dash","//a[contains(@id,'admin-subtab-form:dashboard-link')]");
+ private final String T_DH_SUB_UPDATE = getProp(casePfx + "t.dh.sub.update",
"//form[contains(@id,'common-edit-theme-form')]/input[@type='submit']");
+ private final String T_DH_SEL_RENDERSET = getProp(casePfx +
"t.dh.sel.renderset",
"//select[contains(@id,'common-edit-theme-form:renderSet')]");
+ private final String T_DH_SEL_THEME = getProp(casePfx + "t.dh.sel.theme",
"//select[contains(@id,'common-edit-theme-form:theme')]");
+ private final String T_DH_SEL_LAYOUT = getProp(casePfx + "t.dh.sel.layout",
"//select[contains(@id,'common-edit-theme-form:layout')]");
+ private final String T_PA_SUB_UPDATE = getProp(casePfx + "t.pa.sub.update",
"//input[contains(@id,'common-edit-page-error-form:update')]");
+ private final String T_PO_SUB_UPDATE = getProp(casePfx + "t.po.sub.update",
"//input[contains(@id,'common-edit-portal-error-form:update')]");
+ private final String T_PA_INP_PAGEADD = getProp(casePfx + "t.pa.inp.pageadd",
"//input[contains(@id,'common-edit-page-error-form:page-res-select')]");
+ private final String T_PO_INP_PAGEADD = getProp(casePfx + "t.po.inp.pageadd",
"//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
+ private final String T_PA_SEL_PNF = getProp(casePfx + "t.pa.sel.pnf",
"//select[contains(@id,'common-edit-page-error-form:page-not-found-select')]");
+ private final String T_PA_SEL_INTERN = getProp(casePfx + "t.pa.sel.intern",
"//select[contains(@id,'common-edit-page-error-form:page-internal-select')]");
+ private final String T_PA_SEL_ERROR = getProp(casePfx + "t.pa.sel.error",
"//select[contains(@id,'common-edit-page-error-form:page-error-select')]");
+ private final String T_PA_SEL_CONTROL = getProp(casePfx + "t.pa.sel.control",
"//select[contains(@id,'common-edit-page-error-form:page-control-select')]");
+ private final String T_PA_SEL_ACCESS = getProp(casePfx + "t.pa.sel.access",
"//select[contains(@id,'common-edit-page-error-form:page-access-select')]");
+ private final String T_PO_SEL_PNF = getProp(casePfx + "t.po.sel.pnf",
"//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
+ private final String T_PO_SEL_UNAVAIL = getProp(casePfx + "t.po.sel.unavail",
+ "//select[contains(@id,'common-edit-portal-error-form:portal-unavail-select')]");
+ private final String T_PO_SEL_ACCESS = getProp(casePfx + "t.po.sel.access",
"//select[contains(@id,'common-edit-portal-error-form:portal-access-select')]");
+ private final String SUBMIT_UPDATE_VALUE = getProp(casePfx +
"submit.update.value",
"//input[contains(@id,'common-manage-prop-form:update')]");
+ private final String TABLE_PROPS = getProp(casePfx + "table.props",
"//table[contains(@id,'common-manage-prop-form:prop-data-table')]");
+ private final String T_PROPS_INPUT_VALUE = getProp(casePfx +
"t.props.input.value",
+ "//input[contains(@id,''common-manage-prop-form:prop-data-table:{0}:prop-value-input'')]");
+ private final String T_PROPS_LINK_DEL = getProp(casePfx + "t.props.link.del",
"//a[contains(@id,''common-manage-prop-form:prop-data-table:{0}:delete'')]");
+ private final String TABLE_PA_ERR = getProp(casePfx + "table.pa.err",
"//form[@id='common-edit-page-error-form']/table");
+ private final String TABLE_PO_ERR = getProp(casePfx + "table.po.err",
"//form[@id='common-edit-portal-error-form']/table");
+ private final String TABLE_DH_THM = getProp(casePfx + "table.dh.thm",
"//form[@id='common-edit-theme-form']/table");
+ private final String INPUT_PROP_NAME = getProp(casePfx + "input.prop.name",
"//input[contains(@id,'common-edit-prop-form:property')]");
+ private final String SUBMIT_ADD_PROP = getProp(casePfx + "submit.add.prop",
"//input[contains(@id,'common-edit-prop-form:add-property')]");
+ private final String LINK_ADMIN = getProp(casePfx + "link.admin",
"link=Admin");
+ private final String LINK_TAB_DASH = getProp(casePfx + "link.tab.dash",
"//a[contains(@id,'admin-subtab-form:dashboard-link')]");
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ protected void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
goToDash();
}
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
-
+ protected void logoutAfterTest() {
+
}
+ /**
+ * Testing property addition. Simple adding of "SelenProp" property. Only
+ * the appearance of text "SelenProp" on the dashboards screen is used for
+ * final assertion.
+ */
@Test(enabled = true)
public void testPropAdd() {
final String propName = "SelenProp";
@@ -64,6 +77,11 @@
Assert.assertTrue(selenium.isTextPresent(propName));
}
+ /**
+ * Testing of property update. Simple adding of "SelenValueProp" property
+ * and setting it the value "updatedValue". The value is then assrted to be
+ * appearing in the property table.
+ */
@Test(enabled = true)
public void testPropUpdate() {
final String propName = "SelenValueProp";
@@ -74,16 +92,21 @@
selenium.click(SUBMIT_ADD_PROP);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(propName));
-
+
int r = findTableRow(TABLE_PROPS, propName, 1);
-
- selenium.type(MessageFormat.format(T_PROPS_INPUT_VALUE, r-1),value);
+
+ selenium.type(MessageFormat.format(T_PROPS_INPUT_VALUE, r - 1), value);
selenium.click(SUBMIT_UPDATE_VALUE);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getValue(MessageFormat.format(T_PROPS_INPUT_VALUE,
r-1)),value,"Updated value not found.");
-
+ Assert.assertEquals(selenium.getValue(MessageFormat.format(T_PROPS_INPUT_VALUE, r -
1)), value, "Updated value not found.");
+
}
+ /**
+ * Testing property deletion. Property named "SelenDeleteProp" is added and
+ * deleted. Final assertion is about non-appearance of that property in
+ * property table.
+ */
@Test(enabled = true)
public void testPropDelete() {
final String propName = "SelenDeleteProp";
@@ -93,16 +116,24 @@
selenium.click(SUBMIT_ADD_PROP);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent(propName));
-
+
int r = findTableRow(TABLE_PROPS, propName, 0);
-
- selenium.click(MessageFormat.format(T_PROPS_LINK_DEL, r-1));
+
+ selenium.click(MessageFormat.format(T_PROPS_LINK_DEL, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertFalse(selenium.isTextPresent(propName));
-
+
}
+ /**
+ * Testing of portal error handling. in
+ * "Configure how the system handles errors on portal level." changing
+ * several (access, unavailable, page not found) items and changing of
+ * redirection is done. There is no final assertion.
+ */
+ // TODO - not all elements tested
+ // TODO - no assertions done
@Test(enabled = true)
public void testPortalError() {
selenium.select(T_PO_SEL_ACCESS, "label=Redirect to the specified
resource");
@@ -116,6 +147,12 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
+ /**
+ * Testing of page error handling. in
+ * "Configure how the system handles errors on page level." changing all
+ * items and changing of redirection is done. There is no final assertion.
+ */
+ // TODO - no assertions done
@Test(enabled = true)
public void testPageError() {
selenium.select(T_PA_SEL_ACCESS, "label=Display the default error message");
@@ -133,18 +170,19 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
+ /**
+ * Testing of dashboard theme. The layout, theme and renderset are changed,
+ * but no assertion is done.
+ */
+ // TODO - no assertions done
@Test(enabled = true)
public void testDashboardTheme() {
-
+
safeSelect(T_DH_SEL_LAYOUT, "1column");
-
-
-
safeSelect(T_DH_SEL_RENDERSET, "default");
-
safeSelect(T_DH_SEL_THEME, "nphalanx");
clickAndWait(T_DH_SUB_UPDATE);
-
+
}
private void goToDash() {
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-04-07
13:13:01 UTC (rev 13169)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-04-07
13:21:00 UTC (rev 13170)
@@ -12,12 +12,14 @@
import org.testng.annotations.Test;
/**
+ * EndtoEndPortalAdminTestCase is responsible for end-to-end testing of portal admin.
Creating of new portal, adding pages to it and setting it as a default portal
+ * is the main goal of this test case.
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "end2end" }, enabled = true, description = "Creating of
new portal with content.")
public class EndtoEndPortalAdminTestCase extends JBossPortalSeleniumTestCase {
-
+ /** prefix for locator properties = portal.e2e.*/
public static String casePfx = "portal.e2e.";
private final String ADR_PORTAL = getProp(casePfx +
"adr.home","/portal");
@@ -58,21 +60,14 @@
private final String INP_NET_SEARCH = getProp(casePfx + "inp.goo.search",
"//div[contains(@id,'directory_search_div')]/form/input[@name='query']");
private final String SUB_NET_SEARCH = getProp(casePfx + "sub.goo.search",
"//div[contains(@id,'directory_search_div')]/form/input[@type='submit']");
- /*
- * - create a new portal - add couple of page to the portal - add few
- * portlets of different kinds (csm, widget, regular portlets) in each page
- * - verify that new portal, pages and portlets get added correctly. - Make
- * the new portal default and verify that it becomes default portal
- */
-
@BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
+ protected void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
}
@AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
+ protected void logoutAfterTest() {
}
final String portalName = "UseCasePortal";
@@ -92,6 +87,51 @@
final String PORTLET5 = "default/project.html";
final String por5str = "Our wiki knowledge base";
+ /**
+ * Usecase for creating small portal with content. Portal named
"UseCasePortal" is created similar way as in {@link
AdminPortalTestCase#testPortalCreate()}. Then few pages are added similar way
+ * as in {@link AdminPortalTestCase#testAddPage()}. A portlet is added to each page
similar way as in {@link AdminPortalTestCase#testCreateWindow()}. The important
information about pages and portlets are
+ * listed in the table below
+ *
+ * <table>
+ * <caption>Important information about portlets in
EndtoEndPortalAdminTestCase</caption>
+ * <thead>
+ * <tr>
+ * <th>page name</th>
+ * <th>portlet name</th>
+ * <th>asserted string</th>
+ * <th>portlet type</th>
+ * </tr>
+ * </thead>
+ * <tr>
+ * <td>firstPage</td>
+ * <td>Cart Portlet</td><td>Cart Portlet</td>
+ * <td>portlet</td>
+ * </tr>
+ * <tr>
+ * <td>anotherPage</td>
+ * <td>Band Culinaria</td><td>Band Culinaria</td>
+ * <td>widget/google</td>
+ * </tr>
+ * <tr>
+ * <td>lastPage with whitespace</td>
+ * <td>Cahuete.com</td><td>Cahuete.com</td>
+ * <td>widget/netvibes</td>
+ * </tr>
+ * <tr>
+ * <td>dseer</td>
+ * <td>dir1/foo.txt</td><td>File Portlet</td>
+ * <td>filesystem</td>
+ * </tr>
+ * <tr>
+ * <td>cemese</td>
+ * <td>default/project.html</td><td>Our wiki knowledge
base</td>
+ * <td>cms</td>
+ * </tr>
+ * </table>
+ *
+ * Final assertions are made by clicking on the pages listed above and asserting that
each page contains the string specific for the portlet used (again listed in table).
+ *
+ */
@Test(enabled = true, description = "Usecase for creating small portal with
content.")
public void testCreatePortalUsecase() {
createPortal(portalName);
@@ -128,10 +168,6 @@
assertPageContains(page5Name, por5str);
}
-
- public void testManagePortal(){
-
- }
private void assertPageContains(String pageName, String awaitStr) {
selenium.open(ADR_PORTAL);