[kune-commits] r1537 - in trunk: . src/main/java/cc/kune/common/client/tooltip src/main/java/cc/kune/core/client/auth src/main/java/cc/kune/core/client/groups/newgroup src/main/java/cc/kune/core/client/sub src/main/java/cc/kune/core/public src/main/java/org/ourproject/kune src/main/java/org/ourproject/kune/platf/client src/test/java/cc/kune/selenium src/test/java/cc/kune/selenium/login src/test/java/org/ourproject/kune src/test/java/org/ourproject/kune/platf/client
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Tue Sep 27 15:13:59 CEST 2011
Author: vjrj_
Date: 2011-09-27 15:13:59 +0200 (Tue, 27 Sep 2011)
New Revision: 1537
Added:
trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/ui/
trunk/src/main/java/org/ourproject/kune/workspace/
trunk/src/test/java/org/ourproject/kune/platf/client/ui/
trunk/src/test/java/org/ourproject/kune/workspace/
Modified:
trunk/INSTALL
trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java
trunk/src/main/java/cc/kune/core/public/ws.css
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/PageObject.java
trunk/src/test/java/cc/kune/selenium/SeleniumModule.java
trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java
trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java
trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java
trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java
trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java
Log:
NEW - # 53: Add Selenium Framework testing
http://kune.ourproject.org/issues/ticket/53
CLOSED - # 129: Add some simple mail lib utility in serverside
http://kune.ourproject.org/issues/ticket/129
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/INSTALL 2011-09-27 13:13:59 UTC (rev 1537)
@@ -84,6 +84,10 @@
Install and run a openfire jabber server (see Appendix A for proper configuration of openfire).
+===Configure your SMTP server===
+
+See Appendix C for more info.
+
===Wave in a Box===
Follow "Federation configuration" from:
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -56,6 +56,12 @@
private static final int WIDTH_NOT_DEFINED = -1;
+ public static void hideCurrent() {
+ if (current != null) {
+ current.hide();
+ }
+ }
+
public static Tooltip to(final Widget widget, final String text) {
final Tooltip tip = new Tooltip();
tip.to(widget);
@@ -90,6 +96,7 @@
private Widget ofWidget;
private final Label textLabel;
private final TooltipTimers timers;
+
@UiField
InlineLabel title;
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -20,6 +20,7 @@
package cc.kune.core.client.auth;
import cc.kune.common.client.notify.NotifyLevelImages;
+import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.client.ui.MaskWidgetView;
import cc.kune.common.client.ui.dialogs.MessageToolbar;
import cc.kune.common.client.utils.OnAcceptCallback;
@@ -132,6 +133,7 @@
@Override
public void show() {
super.show();
+ Tooltip.hideCurrent();
KuneUiUtils.focusOnField(getNickname());
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -21,6 +21,7 @@
import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.notify.NotifyLevelImages;
+import cc.kune.common.client.tooltip.Tooltip;
import cc.kune.common.client.ui.MaskWidgetView;
import cc.kune.common.client.ui.dialogs.BasicTopDialog;
import cc.kune.common.client.ui.dialogs.BasicTopDialog.Builder;
@@ -295,6 +296,7 @@
@Override
public void show() {
+ Tooltip.hideCurrent();
dialog.showCentered();
}
Modified: trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -2,6 +2,7 @@
import cc.kune.common.client.utils.Base64Utils;
import cc.kune.common.client.utils.SimpleCallback;
+import cc.kune.common.client.utils.TextUtils;
import cc.kune.core.client.state.StateManager;
import com.google.gwt.event.shared.EventBus;
@@ -44,12 +45,19 @@
public void show(final String token) {
final String[] params = token.split("\\|");
+ final int len = params.length;
getView().setTitleText(new String(Base64Utils.fromBase64(params[0])));
- getView().setDescription(new String(Base64Utils.fromBase64(params[1])));
+ if (len > 1) {
+ getView().setDescription(new String(Base64Utils.fromBase64(params[1])));
+ }
getView().show(new SimpleCallback() {
@Override
public void onCallback() {
- stateManager.gotoHistoryToken(params[2]);
+ if (len > 2 && TextUtils.notEmpty(params[2])) {
+ stateManager.gotoHistoryToken(params[2]);
+ } else {
+ stateManager.gotoHistoryToken("");
+ }
}
});
}
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-09-27 13:13:59 UTC (rev 1537)
@@ -1,4 +1,4 @@
-CHARSET "UTF-8 "; body {
+CHARSET "UTF-8 "; body {
background-color: transparent;
color: black;
font-family: 'Ubuntu', Arial;
@@ -944,7 +944,7 @@
border-color: #CCCCCC !important;
background: inherits !important;
kfilter: alpha(opacity =
- 60) !important;
+ 60) !important;
-moz-opacity: 0.60 !important;
-khtml-opacity: 0.60 !important;
opacity: 0.60 !important;
@@ -1230,7 +1230,7 @@
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
kfilter: alpha(opacity =
- 90);
+ 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
@@ -1520,4 +1520,10 @@
-webkit-border-top-left-radius: 5px;
-moz-border-radius-topleft: 5px;
border-top-left-radius: 5px;
-}
\ No newline at end of file
+}
+
+.k-outline {
+ -moz-outline-radius: 5px;
+ outline: #f90 solid 2px !important;
+ outline-offset: -2px !important;
+}
Modified: trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -4,13 +4,12 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.events.WebDriverEventListener;
-import org.testng.Assert;
public class CustomWebDriverEventListener implements WebDriverEventListener {
@Override
public void afterChangeValueOf(final WebElement element, final WebDriver driver) {
- sleep(200);
+ sleep(400);
}
@Override
@@ -34,7 +33,7 @@
@Override
public void afterNavigateTo(final String url, final WebDriver driver) {
- slow();
+ sleep(500);
}
@Override
@@ -56,7 +55,6 @@
@Override
public void beforeNavigateBack(final WebDriver driver) {
- ;
}
@Override
@@ -75,15 +73,11 @@
public void onException(final Throwable throwable, final WebDriver driver) {
}
- public void sleep(final int milliseconds) {
- try {
- Thread.sleep(milliseconds);
- } catch (final InterruptedException e) {
- Assert.fail("Exception in sleep method", e);
- }
+ private void sleep(final int milliseconds) {
+ SeleniumUtils.sleep(milliseconds);
}
private void slow() {
- sleep(500);
+ sleep(1000);
}
}
\ No newline at end of file
Modified: trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -26,15 +26,12 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.ElementLocatorFactory;
-import org.testng.Assert;
import org.testng.ITestContext;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.DataProvider;
-import cc.kune.core.client.auth.AnonUsersManager;
-import cc.kune.core.client.state.SiteTokens;
import cc.kune.core.client.state.TokenUtils;
import cc.kune.core.client.sub.SubtitlesWidget;
import cc.kune.core.shared.domain.utils.StateToken;
@@ -48,7 +45,7 @@
public class KuneSeleniumDefaults {
private static final Log LOG = LogFactory.getLog(KuneSeleniumDefaults.class);
- public static boolean mustCloseFinally = true;
+ public static boolean mustCloseFinally = false;
private final String baseUrl;
protected final EntityHeaderPageObject entityHeader;
private final Injector injector;
@@ -57,9 +54,8 @@
private final WebDriver webdriver;
public KuneSeleniumDefaults() {
- baseUrl = "http://kune.beta.iepala.es/ws/?locale=en#";
- // baseUrl =
- // "http://127.0.0.1:8888/ws/?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:9997#";
+ // baseUrl = "http://kune.beta.iepala.es/ws/?locale=en#";
+ baseUrl = "http://127.0.0.1:8888/?locale=es&log_level=INFO&gwt.codesvr=127.0.0.1:9997#";
injector = Guice.createInjector(new SeleniumModule());
webdriver = injector.getInstance(WebDriver.class);
login = injector.getInstance(LoginPageObject.class);
@@ -76,7 +72,6 @@
resize();
LOG.info("Going home");
home();
- webdriver.findElement(By.id(SeleniumConstants.GWTDEV + AnonUsersManager.ANON_MESSAGE_CLOSE_ICON)).click();
}
@BeforeMethod
@@ -134,6 +129,7 @@
public void home() {
assert baseUrl != null;
webdriver.get(baseUrl);
+ login.getAnonMsg().click();
}
public void open(final String url) {
@@ -146,17 +142,22 @@
js.executeScript("window.resizeTo(840,770); window.moveTo(0,0);");
}
+ public void showSubtitle(final String title) {
+ showSubtitle(title, "", "");
+ }
+
+ public void showSubtitle(final String title, final String description) {
+ showSubtitle(title, description, "");
+ }
+
public void showSubtitle(final String title, final String description, final String token) {
- gotoToken(TokenUtils.subtitle("User sign in", "", SiteTokens.SIGNIN));
+ gotoToken(TokenUtils.subtitle(title, description, token));
sleep(3000);
webdriver.findElement(By.id(SeleniumConstants.GWTDEV + SubtitlesWidget.SUBTITLE_MANAGER_ID)).click();
}
public void sleep(final int milliseconds) {
- try {
- Thread.sleep(milliseconds);
- } catch (final InterruptedException e) {
- Assert.fail("Exception in sleep method", e);
- }
+ SeleniumUtils.sleep(milliseconds);
}
+
}
Modified: trunk/src/test/java/cc/kune/selenium/PageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/PageObject.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/PageObject.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
@@ -85,6 +86,15 @@
return webdriver.getWindowHandles();
}
+ public void hightlight(final WebElement element) {
+ final JavascriptExecutor js = (JavascriptExecutor) webdriver;
+ final String script = "window.jQuery('#" + element.getAttribute("id") + "').addClass('k-outline');"
+ + "setTimeout('window.jQuery(\"#" + element.getAttribute("id")
+ + "\").removeClass(\"k-outline\")', 700);";
+ // LOG.info("High: " + script);
+ js.executeScript(script);
+ }
+
public boolean isElementPresent(final String id) {
final Wait<WebDriver> wait = new WebDriverWait(webdriver, 5);
final WebElement element = wait.until(visibilityOfElementLocated(By.id(id)));
@@ -112,6 +122,7 @@
public void moveMouseTo(final WebElement element) {
final Actions actions = new Actions(webdriver);
actions.moveToElement(element);
+ sleep(1000);
}
public Navigation navigate() {
@@ -122,6 +133,10 @@
webdriver.quit();
}
+ public void sleep(final int milliseconds) {
+ SeleniumUtils.sleep(milliseconds);
+ }
+
public TargetLocator switchTo() {
return webdriver.switchTo();
}
Modified: trunk/src/test/java/cc/kune/selenium/SeleniumModule.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/SeleniumModule.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/SeleniumModule.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -46,9 +46,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());
@@ -81,9 +80,9 @@
private FirefoxDriver creatFirefoxDriver() {
// http://code.google.com/p/selenium/wiki/FirefoxDriver
+ System.setProperty("webdriver.firefox.useExisting", "true");
final ProfilesIni allProfiles = new ProfilesIni();
final FirefoxProfile profile = allProfiles.getProfile(SeleniumConstants.FIREFOX_PROFILE_NAME);
- // System.setProperty("webdriver.firefox.useExisting", "true");
// final FirefoxProfile profile = allProfiles.getProfile("76tp2vh0.ff5");
final FirefoxDriver driver = new FirefoxDriver(profile);
return driver;
Added: trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java (rev 0)
+++ trunk/src/test/java/cc/kune/selenium/SeleniumUtils.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -0,0 +1,15 @@
+package cc.kune.selenium;
+
+import org.testng.Assert;
+
+public class SeleniumUtils {
+
+ public static void sleep(final int milliseconds) {
+ try {
+ Thread.sleep(milliseconds);
+ } catch (final InterruptedException e) {
+ Assert.fail("Exception in sleep method", e);
+ }
+ }
+
+}
Modified: trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/login/AbstractLoginObject.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -30,6 +30,7 @@
}
public void logout() {
+ hightlight(signOutLink);
signOutLink.click();
assertIsDisconnected();
}
Modified: trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/login/LoginPageObject.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -23,12 +23,15 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
+import cc.kune.core.client.auth.AnonUsersManager;
import cc.kune.core.client.auth.SignInForm;
import cc.kune.core.client.auth.SignInPanel;
import cc.kune.selenium.tools.SeleniumConstants;
public class LoginPageObject extends AbstractLoginObject {
+ @FindBy(id = SeleniumConstants.GWTDEV + AnonUsersManager.ANON_MESSAGE_CLOSE_ICON)
+ private WebElement anonWelcome;
@FindBy(id = SeleniumConstants.GWTDEV + SignInPanel.CREATE_ONE)
protected WebElement createOneLink;
@FindBy(id = SignInForm.PASSWORD_FIELD_ID + SeleniumConstants.INPUT)
@@ -42,11 +45,22 @@
// i18n = new I18nHelper(LoginMessages.class);
}
+ public void createOne() {
+ assertIsDisconnected();
+ hightlight(signInLink);
+ signInLink.click();
+ hightlight(createOneLink);
+ createOneLink.click();
+ }
+
public void fillSigInInForm(final String username, final String password, final boolean withReturn) {
clearField(user);
+ hightlight(user);
user.sendKeys(username);
clearField(passwd);
+ hightlight(passwd);
passwd.sendKeys(password);
+ hightlight(signInButton);
if (withReturn) {
passwd.sendKeys(Keys.RETURN);
} else {
@@ -54,6 +68,10 @@
}
}
+ public WebElement getAnonMsg() {
+ return anonWelcome;
+ }
+
public WebElement getHeader() {
return signInLink;
}
@@ -62,19 +80,24 @@
return getHeader();
}
+ public void high() {
+ hightlight(signInLink);
+ }
+
public void signIn(final String username, final String password) {
- signIn(username, password, true);
+ signIn(username, password, false);
}
public void signIn(final String username, final String password, final boolean withReturn) {
assertIsDisconnected();
+ hightlight(signInLink);
moveMouseTo(signInLink);
signInLink.click();
fillSigInInForm(username, password, withReturn);
}
public void signInDefUser() {
- signIn(SeleniumConstants.USER_SHORNAME, SeleniumConstants.USER_PASSWD, false);
+ signIn(SeleniumConstants.USER_SHORNAME, SeleniumConstants.USER_PASSWD, true);
}
}
Modified: trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -21,11 +21,15 @@
import org.testng.annotations.Test;
-import cc.kune.core.client.state.SiteTokens;
import cc.kune.selenium.KuneSeleniumTest;
public class LoginSeleniumTests extends KuneSeleniumTest {
+ @Test
+ public void high() {
+ login.high();
+ }
+
@Test(dataProvider = "correctlogin")
public void severalsSignInSingOut(final String user, final String passwd) {
login.assertIsDisconnected();
@@ -43,6 +47,7 @@
@Test(dataProvider = "correctlogin")
public void signIn(final String user, final String passwd) {
login.assertIsDisconnected();
+ showSubtitle("User sign in", "to get full access to this site");
login.signIn(user, passwd);
login.assertIsConnectedAs(user);
login.logout();
@@ -59,7 +64,6 @@
@Test(dataProvider = "correctlogin")
public void signInWithToken(final String user, final String passwd) {
login.assertIsDisconnected();
- showSubtitle("User sign in", "", SiteTokens.SIGNIN);
login.fillSigInInForm(user, passwd, true);
login.assertIsConnectedAs(user);
login.logout();
Modified: trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/login/RegisterPageObject.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -47,13 +47,18 @@
public void fillRegisterForm(final String nick, final String name, final String pass, final String em,
final boolean withReturn) {
clearField(shortName);
+ hightlight(shortName);
shortName.sendKeys(nick);
clearField(longName);
+ hightlight(longName);
longName.sendKeys(name);
clearField(passwd);
+ hightlight(passwd);
passwd.sendKeys(pass);
clearField(email);
+ hightlight(email);
email.sendKeys(em);
+ hightlight(registerButton);
if (withReturn) {
email.sendKeys(Keys.RETURN);
} else {
Modified: trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java 2011-09-26 22:39:06 UTC (rev 1536)
+++ trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java 2011-09-27 13:13:59 UTC (rev 1537)
@@ -30,9 +30,8 @@
final String email) {
// 15 chars, the limit, so we don't use shortName
final String prefix = getTempString();
- login.assertIsDisconnected();
- login.signInLink.click();
- login.createOneLink.click();
+ showSubtitle("User registration", "to get full access to this site");
+ login.createOne();
register.fillRegisterForm(prefix, prefix + longName, passwd, prefix + email, false);
login.assertIsConnectedAs(prefix);
sleep(1000);
More information about the kune-commits
mailing list