[kune-commits] r1539 - in trunk/src: main/java/org test/java test/java/cc/kune/selenium test/java/cc/kune/selenium/login test/java/testsuites test/java/testsuites/ng

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Sep 27 23:01:37 CEST 2011


Author: vjrj_
Date: 2011-09-27 23:01:37 +0200 (Tue, 27 Sep 2011)
New Revision: 1539

Added:
   trunk/src/test/java/testsuites/ng/
   trunk/src/test/java/testsuites/ng/kune-selenium-testsuite.xml
Removed:
   trunk/src/main/java/org/ourproject/
   trunk/src/test/java/org/
Modified:
   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/SeleniumModule.java
   trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java
   trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java
Log:
CLOSED - # 53: Add Selenium Framework testing 
http://kune.ourproject.org/issues/ticket/53

Modified: trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java	2011-09-27 19:40:16 UTC (rev 1538)
+++ trunk/src/test/java/cc/kune/selenium/CustomWebDriverEventListener.java	2011-09-27 21:01:37 UTC (rev 1539)
@@ -1,15 +1,17 @@
 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;
 import org.openqa.selenium.support.events.WebDriverEventListener;
 
 public class CustomWebDriverEventListener implements WebDriverEventListener {
 
   @Override
   public void afterChangeValueOf(final WebElement element, final WebDriver driver) {
-    sleep(400);
+    sleep(600);
   }
 
   @Override
@@ -72,6 +74,9 @@
 
   @Override
   public void onException(final Throwable throwable, final WebDriver driver) {
+    if (driver instanceof ChromeDriver) {
+      ((ChromeDriver) driver).getScreenshotAs(OutputType.FILE);
+    }
   }
 
   private void sleep(final int milliseconds) {

Modified: trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java	2011-09-27 19:40:16 UTC (rev 1538)
+++ trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java	2011-09-27 21:01:37 UTC (rev 1539)
@@ -45,8 +45,11 @@
 import com.google.inject.Injector;
 
 public class KuneSeleniumDefaults {
+
+  public static final Injector INJECTOR = Guice.createInjector(new SeleniumModule());
+
   private static final Log LOG = LogFactory.getLog(KuneSeleniumDefaults.class);
-  public static boolean mustCloseFinally = false;
+  public static boolean mustCloseFinally = true;
   private final String baseUrl;
   protected final ChatPageObject chat;
   protected final EntityHeaderPageObject entityHeader;
@@ -58,7 +61,7 @@
   public KuneSeleniumDefaults() {
     // 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());
+    injector = INJECTOR;
     webdriver = injector.getInstance(WebDriver.class);
     login = injector.getInstance(LoginPageObject.class);
     register = injector.getInstance(RegisterPageObject.class);
@@ -71,17 +74,17 @@
     PageFactory.initElements(locator, chat);
   }
 
+  @BeforeMethod
+  public void beforeMethods(final ITestContext context) {
+  }
+
   @BeforeSuite
-  public void beforeClass() {
+  public void beforeSuite() {
     resize();
     LOG.info("Going home");
     home();
   }
 
-  @BeforeMethod
-  public void beforeMethods(final ITestContext context) {
-  }
-
   public void close() {
     webdriver.close();
   }

Modified: trunk/src/test/java/cc/kune/selenium/SeleniumModule.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/SeleniumModule.java	2011-09-27 19:40:16 UTC (rev 1538)
+++ trunk/src/test/java/cc/kune/selenium/SeleniumModule.java	2011-09-27 21:01:37 UTC (rev 1539)
@@ -42,9 +42,6 @@
 
 public class SeleniumModule extends PageObjectModule {
 
-  public SeleniumModule() {
-  }
-
   @Override
   protected void configure() {
     // final RemoteWebDriver driver = createChromeDriver();

Modified: trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java	2011-09-27 19:40:16 UTC (rev 1538)
+++ trunk/src/test/java/cc/kune/selenium/login/LoginSeleniumTests.java	2011-09-27 21:01:37 UTC (rev 1539)
@@ -45,7 +45,7 @@
   }
 
   @Test(dataProvider = "correctlogin")
-  public void signIn(final String user, final String passwd) {
+  public void basicSignIn(final String user, final String passwd) {
     login.assertIsDisconnected();
     showSubtitle("User sign in", "to get full access to this site");
     login.signIn(user, passwd);

Modified: trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java	2011-09-27 19:40:16 UTC (rev 1538)
+++ trunk/src/test/java/cc/kune/selenium/login/RegisterSeleniumTests.java	2011-09-27 21:01:37 UTC (rev 1539)
@@ -26,7 +26,7 @@
 public class RegisterSeleniumTests extends KuneSeleniumTest {
 
   @Test(dataProvider = "correctregister")
-  public void severalsSignInSingOut(final String shortName, final String longName, final String passwd,
+  public void basicRegister(final String shortName, final String longName, final String passwd,
       final String email) {
     // 15 chars, the limit, so we don't use shortName
     final String prefix = getTempString();
@@ -39,31 +39,7 @@
     register.getWelcomeMsg().click();
     chat.show();
     sleep(3000);
-    // login.logout();
+    login.logout();
   }
-  // @Test(dataProvider = "correctlogin")
-  // public void signIn(final String user, final String passwd) {
-  // login.assertIsDisconnected();
-  // login.signIn(user, passwd);
-  // login.assertIsConnectedAs(user);
-  // login.logout();
-  // login.assertIsDisconnected();
-  // }
-  //
-  // @Test
-  // public void signInIncorrectPasswd() {
-  // login.assertIsDisconnected();
-  // login.signIn("nouser", "nopassword");
-  // login.assertIsDisconnected();
-  // }
-  //
-  // @Test(dataProvider = "correctlogin")
-  // public void signInWithToken(final String user, final String passwd) {
-  // login.assertIsDisconnected();
-  // webdriver.gotoToken(SiteTokens.SIGNIN);
-  // login.fillSigInInForm(user, passwd, true);
-  // login.assertIsConnectedAs(user);
-  // login.logout();
-  // login.assertIsDisconnected();
-  // }
+
 }

Added: trunk/src/test/java/testsuites/ng/kune-selenium-testsuite.xml
===================================================================
--- trunk/src/test/java/testsuites/ng/kune-selenium-testsuite.xml	                        (rev 0)
+++ trunk/src/test/java/testsuites/ng/kune-selenium-testsuite.xml	2011-09-27 21:01:37 UTC (rev 1539)
@@ -0,0 +1,23 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<suite name="VideoTestSuite" verbose="3">
+  <test name="login">
+    <classes>
+      <class name="cc.kune.selenium.login.LoginSeleniumTests">
+	<methods>
+	  <include name="basicSignIn" />
+	</methods>
+      </class>
+      <class name="cc.kune.selenium.login.RegisterSeleniumTests">
+	<methods>
+	  <include name="basicRegister" />
+	</methods>
+      </class>
+      <class name="cc.kune.selenium.chat.ChatSeleniumTests">
+	<methods>
+	  <include name="basicChat" />
+	</methods>
+      </class>
+    </classes>
+  </test>
+</suite> 
+




More information about the kune-commits mailing list