[kune-commits] r1627 - in trunk/src: main/java/cc/kune/core/client/groups/newgroup main/java/cc/kune/core/client/sitebar test/java/cc/kune/selenium test/java/cc/kune/selenium/login test/java/cc/kune/selenium/spaces
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Thu Nov 24 04:35:39 CET 2011
Author: vjrj_
Date: 2011-11-24 04:35:38 +0100 (Thu, 24 Nov 2011)
New Revision: 1627
Added:
trunk/src/test/java/cc/kune/selenium/spaces/NewGroupPageObject.java
trunk/src/test/java/cc/kune/selenium/spaces/NewGroupSeleniumTests.java
Modified:
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
trunk/src/test/java/cc/kune/selenium/SeleniumConf.java
trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java
trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java
Log:
NEW - # 127: Generate some screencast while doing automate testing
http://kune.ourproject.org/issues/ticket/127
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-11-24 01:57:56 UTC (rev 1626)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -139,6 +139,7 @@
publicDescField.setTabIndex(3);
publicDescField.setFieldLabel(i18n.t("Public description"));
publicDescField.setName(PUBLICDESC_FIELD);
+ publicDescField.setId(PUBLICDESC_FIELD);
publicDescField.setWidth(DefaultForm.BIG_FIELD_WIDTH);
publicDescField.setAllowBlank(false);
publicDescField.setMinLength(10);
@@ -198,6 +199,8 @@
tag.setTabIndex(4);
tag.setFieldLabel(i18n.t("Group tags"));
tag.setName(TAGS_FIELD);
+ // FIXME if we us this for several tags, we should use different ids
+ tag.setId(TAGS_FIELD);
tag.setWidth(DefaultForm.BIG_FIELD_WIDTH);
tag.setAllowBlank(false);
Tooltip.to(tag, i18n.t("type some keyword that define your group"));
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2011-11-24 01:57:56 UTC (rev 1626)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -30,7 +30,6 @@
import com.google.inject.Inject;
public class SitebarNewGroupLink extends ButtonDescriptor {
-
public static class SitebarNewGroupAction extends AbstractExtendedAction {
private final StateManager stateManager;
@@ -40,6 +39,7 @@
super();
this.stateManager = stateManager;
putValue(Action.NAME, i18n.t("Create New Group"));
+
putValue(Action.TOOLTIP, i18n.t("Create a new group for your initiative or organization "
+ "(NGO, collective, academic group...)"));
}
@@ -47,15 +47,16 @@
@Override
public void actionPerformed(final ActionEvent event) {
stateManager.gotoHistoryToken(SiteTokens.NEWGROUP);
- // stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.NEWGROUP);
}
}
+ public static final String NEW_GROUP_BTN_ID = "k-site-newgroup-btn";
+
@Inject
public SitebarNewGroupLink(final SitebarNewGroupAction action, final SitebarActions sitebarActions) {
super(action);
- setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
- setParent(sitebarActions.getRightToolbar());
+ withId(NEW_GROUP_BTN_ID).withStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
+ withParent(sitebarActions.getRightToolbar());
}
}
Modified: trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-11-24 01:57:56 UTC (rev 1626)
+++ trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -42,12 +42,14 @@
import cc.kune.core.client.state.TokenUtils;
import cc.kune.core.client.sub.SubtitlesWidget;
import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.GroupType;
import cc.kune.selenium.chat.ChatPageObject;
import cc.kune.selenium.general.EntityHeaderPageObject;
import cc.kune.selenium.login.LoginPageObject;
import cc.kune.selenium.login.RegisterPageObject;
import cc.kune.selenium.spaces.GroupSpacePageObject;
import cc.kune.selenium.spaces.HomeSpacePageObject;
+import cc.kune.selenium.spaces.NewGroupPageObject;
import cc.kune.selenium.spaces.SitePageObject;
import cc.kune.selenium.spaces.UserSpacePageObject;
@@ -63,11 +65,12 @@
private final String baseUrl;
protected final ChatPageObject chat;
protected final EntityHeaderPageObject entityHeader;
- protected final GroupSpacePageObject groupSpace;
+ protected GroupSpacePageObject groupSpace;
protected final HomeSpacePageObject homeSpace;
private final Injector injector;
protected LoginPageObject login;
private final ResourceBundle messages;
+ protected NewGroupPageObject newGroup;
protected RegisterPageObject register;
protected final SitePageObject site;
protected UserSpacePageObject userSpace;
@@ -76,7 +79,9 @@
public KuneSeleniumDefaults() {
baseUrl = "http://" + SeleniumConf.SITE.getDomain() + "/" + SeleniumConf.SITE.getParams() + "#";
injector = INJECTOR;
+ final ElementLocatorFactory locator = injector.getInstance(ElementLocatorFactory.class);
webdriver = injector.getInstance(WebDriver.class);
+
login = injector.getInstance(LoginPageObject.class);
register = injector.getInstance(RegisterPageObject.class);
entityHeader = injector.getInstance(EntityHeaderPageObject.class);
@@ -85,8 +90,8 @@
homeSpace = injector.getInstance(HomeSpacePageObject.class);
userSpace = injector.getInstance(UserSpacePageObject.class);
groupSpace = injector.getInstance(GroupSpacePageObject.class);
- messages = injector.getInstance(ResourceBundle.class);
- final ElementLocatorFactory locator = injector.getInstance(ElementLocatorFactory.class);
+ newGroup = injector.getInstance(NewGroupPageObject.class);
+
PageFactory.initElements(locator, login);
PageFactory.initElements(locator, register);
PageFactory.initElements(locator, entityHeader);
@@ -95,6 +100,9 @@
PageFactory.initElements(locator, homeSpace);
PageFactory.initElements(locator, userSpace);
PageFactory.initElements(locator, groupSpace);
+ PageFactory.initElements(locator, newGroup);
+
+ messages = injector.getInstance(ResourceBundle.class);
}
public void answerOnNextPrompt(final String answer) {
@@ -182,6 +190,13 @@
webdriver.get(baseUrl);
}
+ @DataProvider(name = "newGroups")
+ public Object[][] newGroups() {
+ return new Object[][] { { "grp0", "Ecologist Group", GroupType.PROJECT },
+ { "grp1", "Chomsky Fan Club", GroupType.ORGANIZATION }, { "grp2", "吗台湾", GroupType.CLOSED },
+ { "grp3", "روبا", GroupType.COMMUNITY } };
+ }
+
public void open(final String url) {
webdriver.get(url);
}
Modified: trunk/src/test/java/cc/kune/selenium/SeleniumConf.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/SeleniumConf.java 2011-11-24 01:57:56 UTC (rev 1626)
+++ trunk/src/test/java/cc/kune/selenium/SeleniumConf.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -30,8 +30,8 @@
}
public enum Site {
- demo("kune.beta.iepala.es"), eurosur("beta.eurosur.org"), kunecc("kune.cc"), localhost("localhost",
- "&log_level=INFO&gwt.codesvr=127.0.0.1:9997");
+ demo("kune.beta.iepala.es"), eurosur("beta.eurosur.org"), kunecc("kune.cc"), localhost(
+ "localhost:8888", "&log_level=INFO&gwt.codesvr=127.0.0.1:9997");
private String domain;
private String params;
@@ -57,7 +57,7 @@
public static final Driver DRIVER = Driver.firefox;
/* Configure this for use other lang, site, or driver */
public static final Lang LANG = Lang.es;
- public static final Site SITE = Site.eurosur;
+ public static final Site SITE = Site.localhost;
public static final int TIMEOUT = 25;
SeleniumConf() {
Modified: trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java 2011-11-24 01:57:56 UTC (rev 1626)
+++ trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -53,7 +53,7 @@
// home space
showTitleSlide(t("Home space (your welcome page)"),
t("Here you can see a summary of your activity in this site"));
- site.homeBtn().click();
+ site.homeSpaceBtn.click();
sleep(2000);
homeSpace.getSndStats().click();
sleep(2000);
@@ -62,8 +62,8 @@
// user space
showTitleSlide(t("User space (your Inbox)"), t("contents in which you participate"));
- showTooltip(site.userBtn());
- site.userBtn().click();
+ showTooltip(site.userSpaceBtn);
+ site.userSpaceBtn.click();
showMsg(t("You can see this like an advanced email system..."));
userSpace.getFirstWave().click();
sleep(2000);
@@ -88,8 +88,8 @@
// group space
showTitleSlide(t("Your personal public space"), t("here you can have your blog, etc"));
sleep(500);
- site.groupBtn().click();
- site.groupBtn().click();
+ site.groupSpaceBtn.click();
+ site.groupSpaceBtn.click();
showMsg(t("Let's start adding some buddie to our social network"));
sleep(1000);
groupSpace.addBuddieBtn().click();
@@ -124,7 +124,7 @@
chat.getSend(jids).click();
showMsg(t("And you can chat event while going back/forward with your browser"));
- site.homeBtn().click();
+ site.homeSpaceBtn.click();
sleep(2000);
chat.getTalkBox(jids).sendKeys(t("la la la"));
chat.getSend(jids).click();
Added: trunk/src/test/java/cc/kune/selenium/spaces/NewGroupPageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/spaces/NewGroupPageObject.java (rev 0)
+++ trunk/src/test/java/cc/kune/selenium/spaces/NewGroupPageObject.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -0,0 +1,50 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.selenium.spaces;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+import cc.kune.core.client.groups.newgroup.NewGroupPanel;
+import cc.kune.selenium.PageObject;
+import cc.kune.selenium.SeleniumConstants;
+
+public class NewGroupPageObject extends PageObject {
+
+ @FindBy(id = NewGroupPanel.CLOSED_GROUP_TYPE_ID)
+ public WebElement closedType;
+ @FindBy(id = NewGroupPanel.COMM_GROUP_TYPE_ID)
+ public WebElement communityType;
+ @FindBy(id = NewGroupPanel.LONGNAME_FIELD + SeleniumConstants.INPUT)
+ public WebElement longName;
+ @FindBy(id = NewGroupPanel.ORG_GROUP_TYPE_ID)
+ public WebElement orgType;
+ @FindBy(id = NewGroupPanel.PROJ_GROUP_TYPE_ID)
+ public WebElement projectType;
+ @FindBy(id = NewGroupPanel.PUBLICDESC_FIELD + SeleniumConstants.INPUT)
+ public WebElement publicDescription;
+ @FindBy(id = SeleniumConstants.GWTDEV + NewGroupPanel.REGISTER_BUTTON)
+ public WebElement registerBtn;
+ @FindBy(id = NewGroupPanel.SHORTNAME_FIELD + SeleniumConstants.INPUT)
+ public WebElement shortName;
+ @FindBy(id = NewGroupPanel.TAGS_FIELD + SeleniumConstants.INPUT)
+ public WebElement tags;
+
+}
Added: trunk/src/test/java/cc/kune/selenium/spaces/NewGroupSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/spaces/NewGroupSeleniumTests.java (rev 0)
+++ trunk/src/test/java/cc/kune/selenium/spaces/NewGroupSeleniumTests.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -0,0 +1,72 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.selenium.spaces;
+
+import org.testng.annotations.Test;
+
+import cc.kune.common.client.errors.UIException;
+import cc.kune.core.shared.dto.GroupType;
+import cc.kune.selenium.KuneSeleniumTest;
+import cc.kune.selenium.SeleniumConstants;
+import cc.kune.selenium.SeleniumUtils;
+
+public class NewGroupSeleniumTests extends KuneSeleniumTest {
+
+ @Test(dataProvider = "newGroups")
+ public void basicSignIn(final String shortname, final String longname, final GroupType groupType) {
+ SeleniumUtils.fastSpeed(true);
+ login.assertIsDisconnected();
+
+ login.signIn(SeleniumConstants.USER_SHORNAME, SeleniumConstants.USER_PASSWD);
+ login.assertIsConnectedAs(SeleniumConstants.USER_SHORNAME);
+ site.groupSpaceBtn.click();
+ site.newGroupBtn.click();
+
+ final String prefix = getTempString();
+
+ newGroup.shortName.sendKeys(shortname + prefix);
+ final String longNameTranslated = t(longname) + " " + prefix;
+ newGroup.longName.sendKeys(longNameTranslated);
+ newGroup.publicDescription.sendKeys(t("This is only a test group"));
+ newGroup.tags.sendKeys("tag1 tag2");
+ switch (groupType) {
+ case PROJECT:
+ newGroup.projectType.click();
+ break;
+ case ORGANIZATION:
+ newGroup.orgType.click();
+ break;
+ case CLOSED:
+ newGroup.closedType.click();
+ break;
+ case COMMUNITY:
+ newGroup.closedType.click();
+ break;
+ default:
+ throw new UIException("New group types?");
+ }
+ newGroup.registerBtn.click();
+
+ entityHeader.waitForEntityTitle(longNameTranslated);
+
+ login.assertIsDisconnected();
+ }
+
+}
Modified: trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java 2011-11-24 01:57:56 UTC (rev 1626)
+++ trunk/src/test/java/cc/kune/selenium/spaces/SitePageObject.java 2011-11-24 03:35:38 UTC (rev 1627)
@@ -23,6 +23,7 @@
import org.openqa.selenium.support.FindBy;
import cc.kune.core.client.notify.confirm.UserConfirmPanel;
+import cc.kune.core.client.sitebar.SitebarNewGroupLink;
import cc.kune.core.client.sitebar.search.SitebarSearchPanel;
import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter.SpaceSelectorView;
import cc.kune.selenium.PageObject;
@@ -35,41 +36,15 @@
@FindBy(id = SeleniumConstants.GWTDEV + UserConfirmPanel.OK_ID)
public WebElement confirmationOk;
@FindBy(id = SeleniumConstants.GWTDEV + SpaceSelectorView.GROUP_SPACE_ID)
- protected WebElement groupSpaceBtn;
+ public WebElement groupSpaceBtn;
@FindBy(id = SeleniumConstants.GWTDEV + SpaceSelectorView.HOME_SPACE_ID)
- protected WebElement homeSpaceBtn;
+ public WebElement homeSpaceBtn;
+ @FindBy(id = SeleniumConstants.GWTDEV + SitebarNewGroupLink.NEW_GROUP_BTN_ID)
+ public WebElement newGroupBtn;
@FindBy(id = SeleniumConstants.GWTDEV + SpaceSelectorView.PUBLIC_SPACE_ID)
- protected WebElement publicSpaceBtn;
+ public WebElement publicSpaceBtn;
@FindBy(id = SeleniumConstants.GWTDEV + SitebarSearchPanel.SITE_SEARCH_TEXTBOX)
public WebElement searchTextBox;
@FindBy(id = SeleniumConstants.GWTDEV + SpaceSelectorView.USER_SPACE_ID)
- protected WebElement userSpaceBtn;
-
- public SitePageObject() {
- }
-
- public WebElement getConfirmationCancel() {
- return confirmationCancel;
- }
-
- public WebElement getConfirmationOk() {
- return confirmationOk;
- }
-
- public WebElement groupBtn() {
- return groupSpaceBtn;
- }
-
- public WebElement homeBtn() {
- return homeSpaceBtn;
- }
-
- public WebElement publicBtn() {
- return publicSpaceBtn;
- }
-
- public WebElement userBtn() {
- return userSpaceBtn;
- }
-
+ public WebElement userSpaceBtn;
}
More information about the kune-commits
mailing list