add new changes
authorpurigarcia <pgarcia@solidgear.es>
Thu, 16 Apr 2015 07:08:41 +0000 (09:08 +0200)
committerpurigarcia <pgarcia@solidgear.es>
Thu, 16 Apr 2015 07:08:41 +0000 (09:08 +0200)
12 files changed:
automationTest/pom.xml
automationTest/src/test/java/androidtest/tests/Common.java
automationTest/src/test/java/androidtest/tests/CreateFolderTestSuite.java
automationTest/src/test/java/androidtest/tests/DeleteFileTestSuite.java
automationTest/src/test/java/androidtest/tests/DeleteFolderTestSuite.java
automationTest/src/test/java/androidtest/tests/LoginTestSuite.java
automationTest/src/test/java/androidtest/tests/LogoutTestSuite.java
automationTest/src/test/java/androidtest/tests/MoveFileTestSuite.java
automationTest/src/test/java/androidtest/tests/MoveFolderTestSuite.java
automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java
automationTest/src/test/java/androidtest/tests/RenameFolderTestSuite.java
automationTest/src/test/java/androidtest/tests/UploadTestSuite.java

index eded8e8..773f1a6 100644 (file)
                        </includes>
                        </configuration>
                </plugin>
                        </includes>
                        </configuration>
                </plugin>
+               <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-compiler-plugin</artifactId>
+               <version>3.3</version>
+               <configuration>
+               <source>1.7</source>
+               <target>1.7</target>
+        </configuration>
+      </plugin>
       </plugins>
     </pluginManagement>
   </build>
       </plugins>
     </pluginManagement>
   </build>
@@ -66,5 +75,4 @@
        <scope>provided</scope>
   </dependency>
 </dependencies>
        <scope>provided</scope>
   </dependency>
 </dependencies>
-
 </project>
\ No newline at end of file
 </project>
\ No newline at end of file
index 7bf21bd..c457d20 100644 (file)
@@ -1,14 +1,24 @@
 package androidtest.tests;
 
 import java.io.File;
 package androidtest.tests;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URL;
 import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.concurrent.TimeUnit;
 
 import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.io.FileUtils;
 import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
 import org.openqa.selenium.By;
 import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.OutputType;
 import org.openqa.selenium.TimeoutException;
 import org.openqa.selenium.TimeoutException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.remote.Augmenter;
 import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.RemoteWebDriver;
 import org.openqa.selenium.support.ui.WebDriverWait;
 import org.openqa.selenium.support.ui.WebDriverWait;
+
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidElement;
 import junit.framework.TestCase;
 import io.appium.java_client.android.AndroidDriver;
 import io.appium.java_client.android.AndroidElement;
 import junit.framework.TestCase;
@@ -84,4 +94,12 @@ public class Common extends TestCase{
                throw new TimeoutException();
        }
        
                throw new TimeoutException();
        }
        
+       protected void takeScreenShotOnFailed (String testName) throws IOException {
+               File file  = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE);
+               SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
+               Date today = Calendar.getInstance().getTime(); 
+               String screenShotName = "ScreenShots/" + dt1.format(today) + "/" + testName + ".png";
+               FileUtils.copyFile(file, new File(screenShotName));
+       }
+
 }
 }
index 61294da..ad72e36 100644 (file)
@@ -5,6 +5,7 @@ import org.junit.Before;
 import org.junit.runners.MethodSorters;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
+
 import androidtest.actions.Actions;
 import androidtest.models.MainView;
 import androidtest.models.WaitAMomentPopUp;
 import androidtest.actions.Actions;
 import androidtest.models.MainView;
 import androidtest.models.WaitAMomentPopUp;
@@ -17,7 +18,6 @@ public class CreateFolderTestSuite extends Common{
        private final String FOLDER_NAME = "testCreateFolder";
        private String CurrentCreatedFolder = "";
 
        private final String FOLDER_NAME = "testCreateFolder";
        private String CurrentCreatedFolder = "";
 
-
        @Before
        public void setUp() throws Exception {
                setUpCommonDriver();
        @Before
        public void setUp() throws Exception {
                setUpCommonDriver();
@@ -44,6 +44,7 @@ public class CreateFolderTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                if (folderHasBeenCreated) {
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
                if (folderHasBeenCreated) {
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
index 2ea23b6..a07bb97 100644 (file)
@@ -40,6 +40,7 @@ public class DeleteFileTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }
index d5a8b35..f015c1e 100644 (file)
@@ -41,6 +41,7 @@ public class DeleteFolderTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                if(folderHasBeenCreated){
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(FOLDER_NAME, mainView, driver);
                if(folderHasBeenCreated){
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(FOLDER_NAME, mainView, driver);
index a37bfa7..0d2553a 100644 (file)
@@ -88,6 +88,7 @@ public class LoginTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }
index a562441..f9f5402 100644 (file)
@@ -33,6 +33,7 @@ public class LogoutTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }
index ca8a4ec..502d45f 100644 (file)
@@ -67,6 +67,7 @@ public class MoveFileTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                MainView mainView = new MainView(driver);
                driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
                Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
                MainView mainView = new MainView(driver);
                driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
                Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
index a95c56c..5b835d3 100644 (file)
@@ -66,6 +66,7 @@ public class MoveFolderTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                MainView mainView = new MainView(driver);
                driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
                Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
                MainView mainView = new MainView(driver);
                driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
                Actions.deleteElement(FOLDER_WHERE_MOVE, mainView, driver);
index a95168a..4909fbb 100644 (file)
@@ -59,6 +59,7 @@ public class RenameFileTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                if (fileHasBeenCreated) {
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(CurrentCreatedFile,mainView, driver);
                if (fileHasBeenCreated) {
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(CurrentCreatedFile,mainView, driver);
index ef5d742..24c6484 100644 (file)
@@ -57,6 +57,7 @@ public class RenameFolderTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                if(folderHasBeenCreated){
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
                if(folderHasBeenCreated){
                        MainView mainView = new MainView(driver);
                        Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
index 20ddf64..6038930 100644 (file)
@@ -70,6 +70,7 @@ public class UploadTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
 
        @After
        public void tearDown() throws Exception {
+               takeScreenShotOnFailed(getName());
                MainView mainView = new MainView(driver);
                Actions.deleteElement(FILE_NAME,mainView, driver);
                driver.removeApp("com.owncloud.android");
                MainView mainView = new MainView(driver);
                Actions.deleteElement(FILE_NAME,mainView, driver);
                driver.removeApp("com.owncloud.android");