[kune-commits] r1591 - in trunk: img/icons src/main/java/cc/kune/core/public src/main/webapp src/main/webapp/others src/test/java/cc/kune/selenium src/test/java/cc/kune/selenium/chat

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Nov 8 05:06:31 CET 2011


Author: vjrj_
Date: 2011-11-08 05:06:31 +0100 (Tue, 08 Nov 2011)
New Revision: 1591

Added:
   trunk/img/icons/cursor-orange.png
   trunk/src/main/webapp/others/cursor-orange.png
Modified:
   trunk/img/icons/Black_Cursor.svg
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/webapp/ws.html
   trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java
   trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
   trunk/src/test/java/cc/kune/selenium/PageObjectModule.java
   trunk/src/test/java/cc/kune/selenium/SeleniumModule.java
   trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java
   trunk/src/test/java/cc/kune/selenium/chat/ChatPageObject.java
Log:
NEW - # 127: Generate some screencast while doing automate testing 
http://kune.ourproject.org/issues/ticket/127

Modified: trunk/img/icons/Black_Cursor.svg
===================================================================
--- trunk/img/icons/Black_Cursor.svg	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/img/icons/Black_Cursor.svg	2011-11-08 04:06:31 UTC (rev 1591)
@@ -14,7 +14,7 @@
    width="20"
    height="20"
    id="svg2"
-   inkscape:version="0.48.1 r9760"
+   inkscape:version="0.48.2 r9819"
    sodipodi:docname="Black_Cursor.svg">
   <sodipodi:namedview
      pagecolor="#ffffff"
@@ -31,9 +31,9 @@
      showgrid="false"
      inkscape:showpageshadow="false"
      showborder="false"
-     inkscape:zoom="1"
-     inkscape:cx="6.5104813"
-     inkscape:cy="10.563713"
+     inkscape:zoom="4.4875"
+     inkscape:cx="10"
+     inkscape:cy="10"
      inkscape:window-x="0"
      inkscape:window-y="947"
      inkscape:window-maximized="0"
@@ -110,7 +110,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title />
+        <dc:title></dc:title>
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -268,4 +268,100 @@
          id="g3078-1" />
     </g>
   </g>
+  <g
+     inkscape:export-ydpi="90"
+     inkscape:export-xdpi="90"
+     inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/cursor-orange.png"
+     id="g3039"
+     transform="matrix(-0.89284025,1.2053366,1.2053366,0.89284025,-1205.9051,-972.00694)"
+     style="fill:#ff6600">
+    <g
+       id="g3041"
+       transform="matrix(0.05527655,0,0,0.05527655,-22.484133,1026.5598)"
+       style="fill:#ff6600">
+      <g
+         id="g3043"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600" />
+      <g
+         id="g3045"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600" />
+      <g
+         id="g3047"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600" />
+      <g
+         id="g3049"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600">
+        <g
+           id="g3051"
+           transform="matrix(221,0,0,306,1,526)"
+           style="fill:#ff6600">
+          <image
+             id="image3053"
+             mask="url(#mask3036-4)"
+             transform="matrix(1,0,0,-1,0,1)"
+             height="1"
+             width="1"
+             xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAN0AAAEyCAYAAAB+odX5AAAABHNCSVQICAgIfAhkiAAAA2dJREFUeJzt0zEBACAMwLCBf8/gohwkCvp0zcwZILNfB8BvTAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcRMBzHTQcx0EDMdxEwHMdNBzHQQMx3ETAcx00HMdBAzHcQu1KYDY6GxuR4AAAAASUVORK5CYII="
+             style="fill:#ff6600" />
+        </g>
+      </g>
+      <g
+         id="g3055"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600" />
+      <g
+         id="g3057"
+         clip-path="url(#clipPath3048-6)"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600">
+        <g
+           id="g3059"
+           style="fill:#ff6600" />
+        <g
+           id="g3061"
+           style="fill:#ff6600">
+          <g
+             id="g3063"
+             clip-path="url(#clipPath3054-7)"
+             style="fill:#ff6600">
+            <g
+               id="g3065"
+               style="fill:#ff6600" />
+            <g
+               id="g3067"
+               style="fill:#ff6600">
+              <g
+                 id="g3069"
+                 clip-path="url(#clipPath3058-3)"
+                 style="fill:#ff6600">
+                <path
+                   inkscape:connector-curvature="0"
+                   style="fill:#ff6600;fill-opacity:1;fill-rule:nonzero;stroke:none"
+                   id="path3071"
+                   d="m 41.14001,791.145 0,-187.8 42.2,40.8 40.99999,-69.2 22.8,0 0.4,19 -36.2,68 c 0,0 16.8,0 26.4,0 11.2667,0 36.2,0 36.2,0 l -132.79999,129.2 z" />
+                <g
+                   id="g3073"
+                   transform="matrix(1,0,0,-1,0.1400146,841.945)"
+                   style="fill:#ff6600">
+                  <path
+                     inkscape:connector-curvature="0"
+                     style="fill:#ff6600;stroke:#ffffff;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+                     id="path3075"
+                     d="M 41,50.79999 41,238.6 l 42.2,-40.8 41,69.2 22.8,0 0.4,-19 -36.2,-68 c 0,0 16.8,0 26.4,0 11.2667,0 36.2,0 36.2,0 L 41,50.79999 z" />
+                </g>
+              </g>
+            </g>
+          </g>
+        </g>
+      </g>
+      <g
+         id="g3077"
+         transform="matrix(1.25,0,0,-1.25,385.16156,1124.4318)"
+         style="fill:#ff6600" />
+    </g>
+  </g>
 </svg>

Added: trunk/img/icons/cursor-orange.png
===================================================================
(Binary files differ)


Property changes on: trunk/img/icons/cursor-orange.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-11-08 04:06:31 UTC (rev 1591)
@@ -1543,7 +1543,7 @@
 }
 
 div.jGrowl {
-  font-size: 18px;
+  font-size: 18px !important;
 }
 
 /* Dotted tab panel */

Added: trunk/src/main/webapp/others/cursor-orange.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/webapp/others/cursor-orange.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/webapp/ws.html
===================================================================
--- trunk/src/main/webapp/ws.html	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/main/webapp/ws.html	2011-11-08 04:06:31 UTC (rev 1591)
@@ -75,6 +75,7 @@
 <script type="text/javascript"
     src="http://wave.google.com/gadgets/js/core:rpc.js?c=1"></script>
 
+
 <style type="text/css">
 body {
   background-color: white;
@@ -278,6 +279,85 @@
 <![endif]-->
 </head>
 <body>
+    <div id="kcursor"
+        style="visibility: hidden; position: absolute; z-Index: 10000; height: 0; width: 0">
+        <img src="/others/cursor-orange.png">
+    </div>
+    <script type="text/javascript">
+    <!-- // This is only used for tests (comment/remove in production)
+      var newx;
+      var newy;
+      var k_cur_x;
+      var k_cur_y;
+      var xGreat;
+      var x_inc;
+      var y_inc;
+      var diff_x;
+      var diff_y;
+      function kmove(x, y) {
+        newx = x - 18 + 15;
+        newy = y - 7 + 15;
+        kmoveit();
+      }
+
+      function recheck() {
+        if (newx >= k_cur_x) {
+          x_inc = 1;
+        } else {
+          x_inc = -1;
+        }
+        if (newy >= k_cur_y) {
+          y_inc = 1;
+        } else {
+          y_inc = -1;
+        }
+        diff_x = newx - k_cur_x * x_inc;
+        diff_y = newy - k_cur_y * y_inc;
+        xGreat = diff_x > diff_y;
+      }
+
+      function kmoveit() {
+        recheck();
+        if (k_cur_x != newx)
+          if (xGreat) {
+            k_cur_x = k_cur_x + 3 * x_inc;
+          } else {
+            k_cur_x = Math.round(k_cur_y * newx / newy);
+          }
+        if (k_cur_y != newy)
+          if (xGreat) {
+            k_cur_y = Math.round(k_cur_x * newy / newx);
+          } else {
+            k_cur_y = k_cur_y + 3 * y_inc;
+          }
+
+        ksetCursorPos(k_cur_x, k_cur_y);
+
+        if ((diff_x > 3) || (diff_y > 3)) {
+          window.setTimeout('kmoveit()', 1);
+        }
+      }
+
+      function ksetCursorPos(x, y) {
+        document.getElementById('kcursor').style.top = k_cur_y + 'px';
+        document.getElementById('kcursor').style.left = k_cur_x + 'px';
+      }
+      function ksetCursor(x, y) {
+        k_cur_x = x;
+        k_cur_y = y;
+        ksetCursorPos(x, y);
+      }
+
+      function khideCursor() {
+        document.getElementById('kcursor').style.visibility = 'hidden';
+      }
+
+      function kshowCursor() {
+        document.getElementById('kcursor').style.visibility = 'visible';
+      }
+      ksetCursor(0, 0);
+    //-->
+    </script>
     <!-- Banner for wave errors -->
     <div class="banner" id="banner"></div>
     <!-- Autocomplete user/pass -->
@@ -324,8 +404,8 @@
                                 </li>
                                 <li
                                     style="background-image: url(ws/images/kune-intro-group.png);">
-                                    <!-- Put here your site default group name -->
-                                    <a href="#site">Work in collaboration</a>
+                                    <!-- Put here your site default group name --> <a
+                                    href="#site">Work in collaboration</a>
                                 </li>
                                 <li
                                     style="background-image: url(ws/images/kune-intro-world.png);">

Modified: trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java	2011-11-08 04:06:31 UTC (rev 1591)
@@ -1,7 +1,6 @@
 package cc.kune.selenium;
 
 import org.openqa.selenium.By;
-import org.openqa.selenium.OutputType;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.chrome.ChromeDriver;
@@ -45,6 +44,7 @@
   @Override
   public void beforeChangeValueOf(final WebElement element, final WebDriver driver) {
     SeleniumUtils.hightlight(element, driver);
+    sleep(300);
   }
 
   @Override
@@ -76,7 +76,7 @@
   @Override
   public void onException(final Throwable throwable, final WebDriver driver) {
     if (driver instanceof ChromeDriver) {
-      ((ChromeDriver) driver).getScreenshotAs(OutputType.FILE);
+      // ((ChromeDriver) driver).getScreenshotAs(OutputType.FILE);
     }
   }
 

Modified: trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java	2011-11-08 04:06:31 UTC (rev 1591)
@@ -68,8 +68,8 @@
 
   public KuneSeleniumDefaults() {
     // baseUrl = "http://kune.beta.iepala.es/?locale=en#";
+    baseUrl = "http://127.0.0.1:8888/?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:9997#";
     // baseUrl = "http://beta.eurosur.org/#";
-    baseUrl = "http://127.0.0.1:8888/?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:9997#";
     injector = INJECTOR;
     webdriver = injector.getInstance(WebDriver.class);
     login = injector.getInstance(LoginPageObject.class);
@@ -95,6 +95,9 @@
     LOG.info("Going home");
     home();
     resize();
+    SeleniumUtils.initCursor(webdriver);
+    SeleniumUtils.showCursor(webdriver);
+    login.getAnonMsg().click();
   }
 
   public void close() {
@@ -147,7 +150,6 @@
   public void home() {
     assert baseUrl != null;
     webdriver.get(baseUrl);
-    login.getAnonMsg().click();
   }
 
   public void open(final String url) {
@@ -163,6 +165,10 @@
     js.executeScript("window.resizeTo(806,707); window.moveTo(0,0);");
   }
 
+  public void showCursor(final int x, final int y) {
+    SeleniumUtils.showCursor(webdriver, x, y);
+  }
+
   public void showMsg(final String msg) {
     SeleniumUtils.showMsg(webdriver, "", msg);
   }
@@ -181,7 +187,7 @@
 
   public void showTitleSlide(final String title, final String description, final String token) {
     gotoToken(TokenUtils.subtitle(title, description, token));
-    sleep(3000);
+    sleep(4000);
     webdriver.findElement(By.id(SeleniumConstants.GWTDEV + SubtitlesWidget.SUBTITLE_MANAGER_ID)).click();
   }
 

Modified: trunk/src/test/java/cc/kune/selenium/PageObjectModule.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/PageObjectModule.java	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/test/java/cc/kune/selenium/PageObjectModule.java	2011-11-08 04:06:31 UTC (rev 1591)
@@ -29,6 +29,5 @@
       final ElementLocatorFactory locator) {
     bind(componentType).toInstance(object);
     PageFactory.initElements(locator, object);
-
   }
 }

Modified: trunk/src/test/java/cc/kune/selenium/SeleniumModule.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/SeleniumModule.java	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/test/java/cc/kune/selenium/SeleniumModule.java	2011-11-08 04:06:31 UTC (rev 1591)
@@ -47,8 +47,8 @@
 
   @Override
   protected void configure() {
-    // final RemoteWebDriver driver = createChromeDriver();
-    final WebDriver driver = creatFirefoxDriver();
+    final RemoteWebDriver driver = createChromeDriver();
+    // final WebDriver driver = creatFirefoxDriver();
     final EventFiringWebDriver wrap = new EventFiringWebDriver(driver);
     wrap.register(new CustomWebDriverEventListener());
 

Modified: trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java	2011-11-08 04:06:31 UTC (rev 1591)
@@ -1,6 +1,9 @@
 package cc.kune.selenium;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Point;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
@@ -10,27 +13,57 @@
 
 public class SeleniumUtils {
 
+  private static final Log LOG = LogFactory.getLog(SeleniumUtils.class);
+
+  public static void hideCursor(final WebDriver webdriver) {
+    jsExec(webdriver).executeScript("khideCursor();");
+  }
+
   public static void hightlight(final WebElement element, final WebDriver webdriver) {
-    final JavascriptExecutor js = (JavascriptExecutor) webdriver;
+    showCursor(webdriver, element);
+    sleep(300);
     final String script = "window.jQuery('#" + element.getAttribute("id") + "').addClass('k-outline');"
         + "setTimeout('window.jQuery(\"#" + element.getAttribute("id")
         + "\").removeClass(\"k-outline\")', 1200);";
     // Antes 700
     // LOG.info("High: " + script);
-    js.executeScript(script);
+    jsExec(webdriver).executeScript(script);
+
   }
 
+  public static void initCursor(final WebDriver webdriver) {
+    jsExec(webdriver).executeScript("ksetCursor(100,100);");
+    showCursor(webdriver);
+  }
+
+  private static JavascriptExecutor jsExec(final WebDriver webdriver) {
+    return (JavascriptExecutor) webdriver;
+  }
+
   public static void moveMouseTo(final WebDriver webdriver, final WebElement element) {
     final Actions actions = new Actions(webdriver);
     actions.moveToElement(element);
   }
 
+  public static void showCursor(final WebDriver webdriver) {
+    jsExec(webdriver).executeScript("kshowCursor();");
+  }
+
+  public static void showCursor(final WebDriver webdriver, final int x, final int y) {
+    LOG.info("Mover cursor to x: " + x + ", y: " + y);
+    jsExec(webdriver).executeScript("kmove(" + x + "," + y + ");");
+  }
+
+  public static void showCursor(final WebDriver webdriver, final WebElement element) {
+    final Point location = element.getLocation();
+    showCursor(webdriver, location.getX(), location.getY());
+  }
+
   public static void showMsg(final WebDriver webdriver, final String header, final String msg) {
-    final JavascriptExecutor js = (JavascriptExecutor) webdriver;
     final String opts = TextUtils.notEmpty(header) ? "header: '" + header + "'," : "";
     // sticky: true,
     final String script = "window.jQuery.jGrowl(\"" + msg + "\", { " + opts + " theme: 'k-jgrowl' } )";
-    js.executeScript(script);
+    jsExec(webdriver).executeScript(script);
   }
 
   public static void showTooltip(final WebDriver webdriver, final WebElement element) {
@@ -46,5 +79,4 @@
       Assert.fail("Exception in sleep method", e);
     }
   }
-
 }

Modified: trunk/src/test/java/cc/kune/selenium/chat/ChatPageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/chat/ChatPageObject.java	2011-11-07 22:25:13 UTC (rev 1590)
+++ trunk/src/test/java/cc/kune/selenium/chat/ChatPageObject.java	2011-11-08 04:06:31 UTC (rev 1591)
@@ -80,13 +80,17 @@
   }
 
   public void openChat(final XmppURI uri) {
+    hightlight(openChat);
     openChat.click();
     jid.sendKeys(uri.toString());
+    hightlight(addToRoster);
     addToRoster.click();
+    hightlight(openChatBtn);
     openChatBtn.click();
   }
 
   public void show() {
+    hightlight(chatIcon);
     chatIcon.click();
   }
 




More information about the kune-commits mailing list