</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>
<scope>provided</scope>
</dependency>
</dependencies>
-
</project>
\ No newline at end of file
package androidtest.tests;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
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.OutputType;
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.RemoteWebDriver;
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;
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));
+ }
+
}
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;
private final String FOLDER_NAME = "testCreateFolder";
private String CurrentCreatedFolder = "";
-
@Before
public void setUp() throws Exception {
setUpCommonDriver();
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
if (folderHasBeenCreated) {
MainView mainView = new MainView(driver);
Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
driver.removeApp("com.owncloud.android");
driver.quit();
}
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
if(folderHasBeenCreated){
MainView mainView = new MainView(driver);
Actions.deleteElement(FOLDER_NAME, mainView, driver);
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
driver.removeApp("com.owncloud.android");
driver.quit();
}
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
driver.removeApp("com.owncloud.android");
driver.quit();
}
@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);
@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);
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
if (fileHasBeenCreated) {
MainView mainView = new MainView(driver);
Actions.deleteElement(CurrentCreatedFile,mainView, driver);
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
if(folderHasBeenCreated){
MainView mainView = new MainView(driver);
Actions.deleteElement(CurrentCreatedFolder, mainView, driver);
@After
public void tearDown() throws Exception {
+ takeScreenShotOnFailed(getName());
MainView mainView = new MainView(driver);
Actions.deleteElement(FILE_NAME,mainView, driver);
driver.removeApp("com.owncloud.android");