+
+ 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));
+ }
+
+ protected void assertIsInMainView() throws InterruptedException {
+ assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")")));
+ assertTrue(isElementPresent((AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"Upload\")")));
+ }
+
+ protected void assertIsNotInMainView() throws InterruptedException {
+ AndroidElement fileElement;
+ assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")")));
+ try {
+ fileElement = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"Upload\")");
+ } catch (NoSuchElementException e) {
+ fileElement = null;
+ }
+ assertNull(fileElement);
+ }