[kune-commits] r931 - trunk/src/test/java/org/ourproject/kune/platf/integration/selenium

vjrj vjrj at ourproject.org
Mon Oct 27 01:00:31 CET 2008


Author: vjrj
Date: 2008-10-27 01:00:30 +0100 (Mon, 27 Oct 2008)
New Revision: 931

Added:
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
Modified:
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java
Log:
Incomplete - task Selenium tests helpers and new tests


Added: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java	2008-10-26 23:48:42 UTC (rev 930)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java	2008-10-27 00:00:30 UTC (rev 931)
@@ -0,0 +1,46 @@
+package org.ourproject.kune.platf.integration.selenium;
+
+import org.ourproject.kune.workspace.client.signin.SignInForm;
+import org.ourproject.kune.workspace.client.signin.SignInPanel;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignInLinkPanel;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLinkPanel;
+import org.ourproject.kune.workspace.client.title.EntityTitlePanel;
+
+public class KuneSeleniumTestHelper extends SeleniumTestHelper {
+
+    protected void ifLoggedSigOut() {
+        if (selenium.getText(gid(SiteSignOutLinkPanel.SITE_SIGN_OUT)).indexOf("admin") > 0) {
+            signOut();
+        }
+    }
+
+    protected void openDefPage() {
+        open("/kune/?locale=en");
+    }
+
+    protected void openDefPageAndSignOutIfLogged() throws Exception {
+        openDefPage();
+        waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
+        ifLoggedSigOut();
+    }
+
+    protected void signIn() {
+        signIn("admin", "easyeasy");
+    }
+
+    protected void signIn(String nick, String passwd) {
+        selenium.click(gid(SiteSignInLinkPanel.SITE_SIGN_IN));
+        selenium.type(SignInForm.NICKOREMAIL_FIELD, "admin");
+        selenium.type(SignInForm.PASSWORD_FIELD, "easyeasy");
+        selenium.click(SignInPanel.SIGN_IN_BUTTON_ID);
+    }
+
+    protected void signOut() {
+        selenium.click("gwt-debug-k-ssolp-lb");
+    }
+
+    protected void verifyLoggedUserShorName(String userShortName) throws Exception {
+        waitForTextInside(gid(SiteSignOutLinkPanel.SITE_SIGN_OUT), userShortName);
+    }
+
+}

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java	2008-10-26 23:48:42 UTC (rev 930)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java	2008-10-27 00:00:30 UTC (rev 931)
@@ -2,20 +2,14 @@
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.ourproject.kune.workspace.client.signin.SignInForm;
-import org.ourproject.kune.workspace.client.signin.SignInPanel;
-import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignInLinkPanel;
-import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLinkPanel;
-import org.ourproject.kune.workspace.client.title.EntityTitlePanel;
 
+import com.google.gwt.user.client.ui.UIObject;
 import com.thoughtworks.selenium.DefaultSelenium;
 
 public class SeleniumTestHelper {
 
-    private static final String GWT_DEBUG = "gwt-debug-";
+    protected static DefaultSelenium selenium;
 
-    private static DefaultSelenium selenium;
-
     @AfterClass
     public static void afterClass() throws Exception {
         selenium.stop();
@@ -56,35 +50,24 @@
         throw new Exception(message);
     }
 
+    /**
+     * Returns the debug id with the gwt DEBUG_ID_PREFIX
+     * 
+     * @param id
+     * @return
+     */
     protected String gid(String id) {
-        return GWT_DEBUG + id;
+        return UIObject.DEBUG_ID_PREFIX + id;
     }
 
-    protected void ifLoggedSigOut() {
-        if (selenium.getText(gid(SiteSignOutLinkPanel.SITE_SIGN_OUT)).indexOf("admin") > 0) {
-            signOut();
+    protected void open(String url) {
+        try {
+            selenium.open(url);
+        } catch (final UnsupportedOperationException e) {
+            System.err.println("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
         }
     }
 
-    protected void openDefPage() {
-        open("/kune/?locale=en");
-    }
-
-    protected void signIn() {
-        signIn("admin", "easyeasy");
-    }
-
-    protected void signIn(String nick, String passwd) {
-        selenium.click(gid(SiteSignInLinkPanel.SITE_SIGN_IN));
-        selenium.type(SignInForm.NICKOREMAIL_FIELD, "admin");
-        selenium.type(SignInForm.PASSWORD_FIELD, "easyeasy");
-        selenium.click(SignInPanel.SIGN_IN_BUTTON_ID);
-    }
-
-    protected void signOut() {
-        selenium.click("gwt-debug-k-ssolp-lb");
-    }
-
     protected void wait(int milliseconds) {
         try {
             Thread.sleep(milliseconds);
@@ -123,22 +106,4 @@
             Thread.sleep(1000);
         }
     }
-
-    private void open(String url) {
-        try {
-            selenium.open(url);
-        } catch (final UnsupportedOperationException e) {
-            System.err.println("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
-        }
-    }
-
-    protected void openDefPageAndSignOutIfLogged() throws Exception {
-        openDefPage();
-        waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
-        ifLoggedSigOut();
-    }
-
-    protected void verifyLoggedUserShorName(String userShortName) throws Exception {
-        waitForTextInside(gid(SiteSignOutLinkPanel.SITE_SIGN_OUT), userShortName);
-    }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java	2008-10-26 23:48:42 UTC (rev 930)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SignInSeleniumTest.java	2008-10-27 00:00:30 UTC (rev 931)
@@ -4,7 +4,7 @@
 import org.ourproject.kune.workspace.client.signin.SignInPanel;
 import org.ourproject.kune.workspace.client.signin.SignInPresenter;
 
-public class SignInSeleniumTest extends SeleniumTestHelper {
+public class SignInSeleniumTest extends KuneSeleniumTestHelper {
 
     @Test
     public void testSignInAndOut() throws Exception {




More information about the kune-commits mailing list