From 8386357e687544f53a7e4417bcbab1eff6a0d135 Mon Sep 17 00:00:00 2001 From: purigarcia Date: Fri, 15 May 2015 12:32:16 +0200 Subject: [PATCH] add headers. reformat files --- .../android/test/ui/actions/Actions.java | 80 ++++++++++++++----- .../test/ui/groups/FailingTestCategory.java | 19 +++++ .../test/ui/groups/IgnoreTestCategory.java | 20 +++++ .../test/ui/groups/NoIgnoreTestCategory.java | 20 +++++ .../test/ui/groups/OtherTestCategory.java | 20 +++++ .../test/ui/groups/SmokeTestCategory.java | 20 +++++ .../ui/groups/UnfinishedTestCategory.java | 20 +++++ .../test/ui/models/CertificatePopUp.java | 20 +++++ .../test/ui/models/ElementMenuOptions.java | 23 +++++- .../test/ui/models/FileDetailsView.java | 20 +++++ .../android/test/ui/models/FileListView.java | 51 +++++++++--- .../test/ui/models/GmailEmailListView.java | 26 +++++- .../test/ui/models/GmailEmailView.java | 20 +++++ .../test/ui/models/GmailSendMailView.java | 20 +++++ .../android/test/ui/models/ImageView.java | 25 +++++- .../android/test/ui/models/LoginForm.java | 32 +++++++- .../android/test/ui/models/MenuList.java | 20 +++++ .../android/test/ui/models/MoveView.java | 20 +++++ .../test/ui/models/NewFolderPopUp.java | 26 +++++- .../test/ui/models/PassCodeRequestView.java | 38 +++++++-- .../android/test/ui/models/PassCodeView.java | 44 ++++++++-- .../ui/models/RemoveConfirmationView.java | 20 +++++ .../android/test/ui/models/SettingsView.java | 23 +++++- .../android/test/ui/models/ShareView.java | 20 +++++ .../test/ui/models/UploadFilesView.java | 23 +++++- .../android/test/ui/models/UploadView.java | 20 +++++ .../test/ui/models/WaitAMomentPopUp.java | 20 +++++ .../android/test/ui/testSuites/Common.java | 75 +++++++++++++---- .../ui/testSuites/CreateFolderTestSuite.java | 32 +++++++- .../ui/testSuites/DeleteFileTestSuite.java | 33 +++++++- .../ui/testSuites/DeleteFolderTestSuite.java | 35 ++++++-- .../test/ui/testSuites/LoginTestSuite.java | 51 +++++++++--- .../test/ui/testSuites/LogoutTestSuite.java | 26 +++++- .../test/ui/testSuites/MoveFileTestSuite.java | 44 ++++++++-- .../ui/testSuites/MoveFolderTestSuite.java | 44 ++++++++-- .../test/ui/testSuites/PasscodeTestSuite.java | 42 ++++++++-- .../ui/testSuites/RefreshFolderTestSuite.java | 26 +++++- .../ui/testSuites/RenameFileTestSuite.java | 48 ++++++++--- .../ui/testSuites/RenameFolderTestSuite.java | 44 ++++++++-- .../test/ui/testSuites/RunFailingTests.java | 20 +++++ .../test/ui/testSuites/RunNoIgnoreTests.java | 20 +++++ .../test/ui/testSuites/RunSmokeTests.java | 20 +++++ .../ui/testSuites/ShareLinkFileTestSuite.java | 46 +++++++++-- .../test/ui/testSuites/UploadTestSuite.java | 78 +++++++++++++----- 44 files changed, 1228 insertions(+), 166 deletions(-) diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java b/automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java index ae41573ce2..6d592179bb 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.actions; import java.util.HashMap; @@ -26,15 +46,20 @@ import com.owncloud.android.test.ui.testSuites.Common; public class Actions { - public static FileListView login(String url, String user, String password, Boolean isTrusted, AndroidDriver driver) throws InterruptedException { + public static FileListView login(String url, String user, String password, + Boolean isTrusted, AndroidDriver driver) + throws InterruptedException { LoginForm loginForm = new LoginForm(driver); CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url); if(!isTrusted){ WebDriverWait wait = new WebDriverWait(driver, 30); - //sometimes the certificate has been already accept and it doesn't appear again + //sometimes the certificate has been already accept + //and it doesn't appear again try { - wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement())); - //we need to repaint the screen because of some element are misplaced + wait.until(ExpectedConditions + .visibilityOf(certificatePopUp.getOkButtonElement())); + //we need to repaint the screen + //because of some element are misplaced driver.rotate(ScreenOrientation.LANDSCAPE); driver.rotate(ScreenOrientation.PORTRAIT); certificatePopUp.clickOnOkButton(); @@ -49,26 +74,30 @@ public class Actions { return loginForm.clickOnConnectButton(); } - public static WaitAMomentPopUp createFolder(String folderName, FileListView fileListView){ + public static WaitAMomentPopUp createFolder(String folderName, + FileListView fileListView){ NewFolderPopUp newFolderPopUp = fileListView.clickOnNewFolderButton(); newFolderPopUp.typeNewFolderName(folderName); - WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton(); + WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp + .clickOnNewFolderOkButton(); //TODO. assert here return waitAMomentPopUp; } - public static AndroidElement scrollTillFindElement (String elementName, AndroidElement element, AndroidDriver driver) { + public static AndroidElement scrollTillFindElement (String elementName, + AndroidElement element, AndroidDriver driver) { AndroidElement fileElement; if(element.getAttribute("scrollable").equals("true")){ - HashMap scrollObject = new HashMap(); + HashMap scrollObject = new HashMap(); scrollObject.put("text", elementName); scrollObject.put("element", ( (RemoteWebElement) element).getId()); driver.executeScript("mobile: scrollTo", scrollObject); } try { - fileElement = (AndroidElement) driver.findElementByName(elementName); + fileElement = (AndroidElement) driver + .findElementByName(elementName); } catch (NoSuchElementException e) { fileElement = null; } @@ -92,28 +121,39 @@ public class Actions { } //TODO. convert deleteFodler and deleteFile in deleteElement - public static AndroidElement deleteElement(String elementName, FileListView fileListView, AndroidDriver driver) throws Exception{ + public static AndroidElement deleteElement(String elementName, + FileListView fileListView, AndroidDriver driver) throws Exception{ AndroidElement fileElement; WaitAMomentPopUp waitAMomentPopUp; try{ - //To open directly the "file list view" and we don't need to know in which view we are - driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); - fileElement = (AndroidElement) driver.findElementByName(elementName); - ElementMenuOptions menuOptions = fileListView.longPressOnElement(elementName); - RemoveConfirmationView removeConfirmationView = menuOptions.clickOnRemove();; - waitAMomentPopUp = removeConfirmationView.clickOnRemoteAndLocalButton(); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + //To open directly the "file list view" and + //we don't need to know in which view we are + driver.startActivity("com.owncloud.android", + ".ui.activity.FileDisplayActivity"); + fileElement = (AndroidElement) driver + .findElementByName(elementName); + ElementMenuOptions menuOptions = fileListView + .longPressOnElement(elementName); + RemoveConfirmationView removeConfirmationView = menuOptions + .clickOnRemove();; + waitAMomentPopUp = removeConfirmationView + .clickOnRemoteAndLocalButton(); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); }catch(NoSuchElementException e){ fileElement=null; } return fileElement; } - public static FileListView uploadFile(String elementName, FileListView fileListView) throws InterruptedException{ + public static FileListView uploadFile(String elementName, + FileListView fileListView) throws InterruptedException{ fileListView.clickOnUploadButton(); - UploadFilesView uploadFilesView = fileListView.clickOnFilesElementUploadFile(); + UploadFilesView uploadFilesView = fileListView + .clickOnFilesElementUploadFile(); uploadFilesView.clickOnFileName(elementName); - FileListView fileListViewAfterUploadFile = uploadFilesView.clickOnUploadButton(); + FileListView fileListViewAfterUploadFile = uploadFilesView + .clickOnUploadButton(); //TO DO. detect when the file is successfully uploaded Thread.sleep(15000); return fileListViewAfterUploadFile; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/FailingTestCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/FailingTestCategory.java index b8f6eae546..2a91e7ffc9 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/FailingTestCategory.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/FailingTestCategory.java @@ -1,3 +1,22 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ package com.owncloud.android.test.ui.groups; public interface FailingTestCategory extends IgnoreTestCategory {} diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/IgnoreTestCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/IgnoreTestCategory.java index 6d252f3e10..2586edb7d5 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/IgnoreTestCategory.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/IgnoreTestCategory.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.groups; public interface IgnoreTestCategory {} diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/NoIgnoreTestCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/NoIgnoreTestCategory.java index 50d4170151..321fb08855 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/NoIgnoreTestCategory.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/NoIgnoreTestCategory.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.groups; public interface NoIgnoreTestCategory { diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/OtherTestCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/OtherTestCategory.java index 8f0094e3b6..b14c36e48b 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/OtherTestCategory.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/OtherTestCategory.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.groups; public interface OtherTestCategory extends IgnoreTestCategory {} diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/SmokeTestCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/SmokeTestCategory.java index 69f3ad100f..ebac5fecf4 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/SmokeTestCategory.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/SmokeTestCategory.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.groups; public interface SmokeTestCategory { diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/UnfinishedTestCategory.java b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/UnfinishedTestCategory.java index 8d66b2bde0..2a1451d557 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/groups/UnfinishedTestCategory.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/groups/UnfinishedTestCategory.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.groups; public interface UnfinishedTestCategory extends IgnoreTestCategory{ diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/CertificatePopUp.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/CertificatePopUp.java index 41cd4ae47c..1908ac9feb 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/CertificatePopUp.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/CertificatePopUp.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/ElementMenuOptions.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/ElementMenuOptions.java index 844ad1fe43..ccf9bd4e16 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/ElementMenuOptions.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/ElementMenuOptions.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; @@ -39,7 +59,8 @@ public class ElementMenuOptions { public RemoveConfirmationView clickOnRemove () { removeFileElement.click(); - RemoveConfirmationView removeConfirmationView = new RemoveConfirmationView(driver); + RemoveConfirmationView removeConfirmationView = + new RemoveConfirmationView(driver); return removeConfirmationView; } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileDetailsView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileDetailsView.java index 1410d95816..46da42fd29 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileDetailsView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileDetailsView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java index f75347472e..f10e7aa3c6 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/FileListView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import java.util.List; @@ -18,7 +38,8 @@ import com.owncloud.android.test.ui.actions.Actions; public class FileListView { final AndroidDriver driver; - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"More options\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"More options\")") private AndroidElement menuButton; @CacheLookup @@ -26,14 +47,16 @@ public class FileListView { private AndroidElement filesLayout; @CacheLookup - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/action_bar_title\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".resourceId(\"android:id/action_bar_title\")") private AndroidElement titleText; @AndroidFindBy(id = "android:id/progress_circular") private AndroidElement progressCircular; @CacheLookup - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"New folder\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"New folder\")") private AndroidElement newFolderButton; @CacheLookup @@ -52,16 +75,20 @@ public class FileListView { private AndroidElement filesElementUploadFile; @CacheLookup - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"List Layout\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"List Layout\")") private AndroidElement listLayout; private AndroidElement fileElement; private AndroidElement fileElementLayout; - private static String localFileIndicator = "com.owncloud.android:id/localFileIndicator"; - private static String favoriteFileIndicator = "com.owncloud.android:id/favoriteIcon"; - private static String sharedElementIndicator = "com.owncloud.android:id/sharedIcon"; + private static String localFileIndicator = + "com.owncloud.android:id/localFileIndicator"; + private static String favoriteFileIndicator = + "com.owncloud.android:id/favoriteIcon"; + private static String sharedElementIndicator = + "com.owncloud.android:id/sharedIcon"; public FileListView (AndroidDriver driver) { @@ -133,9 +160,12 @@ public class FileListView { } public AndroidElement scrollTillFindElement (String elementName) { - fileElement = Actions.scrollTillFindElement (elementName,filesLayout,driver); + fileElement = Actions + .scrollTillFindElement (elementName,filesLayout,driver); try { - fileElementLayout = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"LinearLayout-"+ elementName +"\")"); + fileElementLayout = (AndroidElement) driver + .findElementByAndroidUIAutomator("new UiSelector()" + + ".description(\"LinearLayout-"+ elementName +"\")"); } catch (NoSuchElementException e) { fileElementLayout = null; } @@ -163,7 +193,8 @@ public class FileListView { } public void pulldownToRefresh () throws InterruptedException { Point listLocation = listLayout.getLocation(); - driver.swipe(listLocation.getX(),listLocation.getY(), listLocation.getX(),listLocation.getY()+1000, 5000); + driver.swipe(listLocation.getX(),listLocation.getY(), + listLocation.getX(),listLocation.getY()+1000, 5000); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailListView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailListView.java index f3d0f8100f..a6b6975141 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailListView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailListView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; @@ -12,9 +32,11 @@ public class GmailEmailListView { final AndroidDriver driver; - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"me about UploadFile, on May 11, conversation read\")") + @AndroidFindBy(uiAutomator = "new UiSelector().description(\"" + + "me about UploadFile, on May 11, conversation read\")") private AndroidElement emailAmericanFormatDate; - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"me about UploadFile, on 11 May, conversation read\")") + @AndroidFindBy(uiAutomator = "new UiSelector().description(\"" + + "me about UploadFile, on 11 May, conversation read\")") private AndroidElement emailEuropeanFormatDate; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailView.java index a5797014a1..6d6acd7973 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailEmailView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailSendMailView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailSendMailView.java index 264a61c4e4..a8688157cf 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailSendMailView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/GmailSendMailView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/ImageView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/ImageView.java index 8803b29080..c0f13fcc14 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/ImageView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/ImageView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; @@ -15,7 +35,8 @@ public class ImageView { final AndroidDriver driver; @CacheLookup - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"More options\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"More options\")") private AndroidElement optionsButton; @AndroidFindBy(name = "Share") @@ -48,7 +69,7 @@ public class ImageView { public void clickOnOwnCloudButton(){ if(Common.isElementPresent(ownCloudButton)){ - Actions.scrollTillFindElement("ownCloud", sharingAppsLayout, driver); + Actions.scrollTillFindElement("ownCloud",sharingAppsLayout,driver); ownCloudButton.click(); }else if(Common.isElementPresent(shareWithOwnCloudButton)){} } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/LoginForm.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/LoginForm.java index 6971cc233f..aaef6aedfd 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/LoginForm.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/LoginForm.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import org.openqa.selenium.support.CacheLookup; @@ -12,7 +32,8 @@ public class LoginForm { final AndroidDriver driver; @CacheLookup - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Server address\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"Server address\")") private AndroidElement hostUrlInput; @CacheLookup @@ -27,10 +48,12 @@ public class LoginForm { @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Connect\")") private AndroidElement connectButton; - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Testing connection\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"Testing connection\")") private AndroidElement serverStatusText; - @AndroidFindBy(uiAutomator = "new UiSelector().description(\"Wrong username or password\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".description(\"Wrong username or password\")") private AndroidElement authStatusText; public LoginForm (AndroidDriver driver) { @@ -51,7 +74,8 @@ public class LoginForm { public void typeUserName (String userName) { userNameInput.clear(); - //using the \n , it not need to hide the keyboard which sometimes gives problems + //using the \n , it not need to hide the keyboard + //which sometimes gives problems userNameInput.sendKeys(userName + "\n"); //driver.hideKeyboard(); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/MenuList.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/MenuList.java index 9dade478f3..132e6717cf 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/MenuList.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/MenuList.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import org.openqa.selenium.support.PageFactory; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/MoveView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/MoveView.java index 5be7b69dc9..222a268eff 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/MoveView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/MoveView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/NewFolderPopUp.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/NewFolderPopUp.java index 560c9abe57..fb28066272 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/NewFolderPopUp.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/NewFolderPopUp.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import org.openqa.selenium.support.PageFactory; @@ -11,10 +31,12 @@ public class NewFolderPopUp { final AndroidDriver driver; - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/button1\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".resourceId(\"android:id/button1\")") private AndroidElement newFolderOkButton; - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"com.owncloud.android:id/user_input\")") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".resourceId(\"com.owncloud.android:id/user_input\")") private AndroidElement newFolderNameField; public NewFolderPopUp (AndroidDriver driver) { diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeRequestView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeRequestView.java index 05d5248706..52744cb568 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeRequestView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeRequestView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import org.openqa.selenium.support.PageFactory; @@ -10,16 +30,20 @@ import io.appium.java_client.pagefactory.AppiumFieldDecorator; public class PassCodeRequestView { final AndroidDriver driver; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(0)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(0)") private AndroidElement codeElement1; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(1)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(1)") private AndroidElement codeElement2; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(2)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(2)") private AndroidElement codeElement3; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(3)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(3)") private AndroidElement codeElement4; public PassCodeRequestView (AndroidDriver driver) { @@ -27,8 +51,10 @@ final AndroidDriver driver; PageFactory.initElements(new AppiumFieldDecorator(driver), this); } - public void enterPasscode(String codeNumber1, String codeNumber2, String codeNumber3, String codeNumber4){ - codeElement1.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); + public void enterPasscode(String codeNumber1, String codeNumber2, + String codeNumber3, String codeNumber4){ + codeElement1 + .sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); } } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeView.java index a101823f5e..6f84fca582 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/PassCodeView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; @@ -10,16 +30,20 @@ import org.openqa.selenium.support.PageFactory; public class PassCodeView { final AndroidDriver driver; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(0)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(0)") private AndroidElement codeElement1; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(1)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(1)") private AndroidElement codeElement2; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(2)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(2)") private AndroidElement codeElement3; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.EditText\").index(3)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.EditText\").index(3)") private AndroidElement codeElement4; @AndroidFindBy(name = "Cancel") @@ -30,12 +54,16 @@ public class PassCodeView { PageFactory.initElements(new AppiumFieldDecorator(driver), this); } - public PassCodeView enterPasscode(String codeNumber1, String codeNumber2, String codeNumber3, String codeNumber4){ - codeElement1.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); + public PassCodeView enterPasscode(String codeNumber1, String codeNumber2, + String codeNumber3, String codeNumber4){ + codeElement1 + .sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); return this; } - public SettingsView reenterPasscode(String codeNumber1, String codeNumber2, String codeNumber3, String codeNumber4){ - codeElement1.sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); + public SettingsView reenterPasscode(String codeNumber1, + String codeNumber2, String codeNumber3, String codeNumber4){ + codeElement1 + .sendKeys(codeNumber1 + codeNumber1 + codeNumber1 + codeNumber1); SettingsView settingsView = new SettingsView(driver); return settingsView; } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/RemoveConfirmationView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/RemoveConfirmationView.java index 1458e4fe28..5b0c06617b 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/RemoveConfirmationView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/RemoveConfirmationView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/SettingsView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/SettingsView.java index eeea7bf3e9..43d31ecd28 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/SettingsView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/SettingsView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; @@ -30,7 +50,8 @@ public class SettingsView { @AndroidFindBy(name = "Add account") private AndroidElement addAccountElement; - @AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.CheckBox\").index(0)") + @AndroidFindBy(uiAutomator = "new UiSelector()" + + ".className(\"android.widget.CheckBox\").index(0)") private AndroidElement passcodeCheckbox; public SettingsView (AndroidDriver driver) { diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/ShareView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/ShareView.java index b9258bd4f6..650671ba35 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/ShareView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/ShareView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadFilesView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadFilesView.java index f2af739eb9..599e90c1da 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadFilesView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadFilesView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; @@ -36,7 +56,8 @@ public class UploadFilesView{ //change to scrollTillFindElement public void scrollTillFindFile (String fileName) { - fileElement = Actions.scrollTillFindElement (fileName,filesLayout,driver); + fileElement = Actions + .scrollTillFindElement(fileName,filesLayout,driver); } public void clickOnFileName (String fileName) { diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadView.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadView.java index 26397f5500..5975c9af7d 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadView.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/UploadView.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import io.appium.java_client.android.AndroidDriver; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/models/WaitAMomentPopUp.java b/automationTest/src/test/java/com/owncloud/android/test/ui/models/WaitAMomentPopUp.java index edef1d172c..d296235b57 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/models/WaitAMomentPopUp.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/models/WaitAMomentPopUp.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.models; import org.openqa.selenium.support.PageFactory; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java index 4e45bb6c22..6a40be29e0 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -34,16 +54,21 @@ public class Common{ capabilities.setCapability("deviceName", "test"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appPackage", "com.owncloud.android"); - capabilities.setCapability("appActivity", ".ui.activity.FileDisplayActivity"); - capabilities.setCapability("appWaitActivity", ".authentication.AuthenticatorActivity"); - driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); - driver.manage().timeouts().implicitlyWait(waitingTime, TimeUnit.SECONDS); + capabilities.setCapability("appActivity", + ".ui.activity.FileDisplayActivity"); + capabilities.setCapability("appWaitActivity", + ".authentication.AuthenticatorActivity"); + driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), + capabilities); + driver.manage().timeouts().implicitlyWait(waitingTime, + TimeUnit.SECONDS); wait = new WebDriverWait(driver, waitingTime, 50); return driver; } - protected boolean waitForTextPresent(String text, AndroidElement element) throws InterruptedException{ + protected boolean waitForTextPresent(String text, AndroidElement element) + throws InterruptedException{ for (int second = 0;;second++){ if (second >= waitingTime) return false; @@ -77,7 +102,8 @@ public class Common{ } //pollingTime in milliseconds - public static void waitTillElementIsNotPresent (AndroidElement element, int pollingTime) throws Exception { + public static void waitTillElementIsNotPresent (AndroidElement element, + int pollingTime) throws Exception { for (int time = 0;;time += pollingTime){ if (time >= waitingTime * 1000) //convert to milliseconds break; @@ -91,24 +117,35 @@ public class Common{ throw new TimeoutException(); } - protected void takeScreenShotOnFailed (String testName) throws IOException { - File file = ((RemoteWebDriver) driver).getScreenshotAs(OutputType.FILE); + 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"; + String screenShotName = "ScreenShots/" + dt1.format(today) + "/" + + testName + ".png"; FileUtils.copyFile(file, new File(screenShotName)); } protected void assertIsInFileListView() 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\")"))); + 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 assertIsNotInFileListView() throws InterruptedException { AndroidElement fileElement; - assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); + assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver + .findElementByAndroidUIAutomator("new UiSelector()" + + ".resourceId(\"android:id/action_bar_title\")"))); try { - fileElement = (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().description(\"Upload\")"); + fileElement = (AndroidElement) driver + .findElementByAndroidUIAutomator("new UiSelector()" + + ".description(\"Upload\")"); } catch (NoSuchElementException e) { fileElement = null; } @@ -116,13 +153,19 @@ public class Common{ } protected void assertIsPasscodeRequestView() throws InterruptedException { - assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); - assertTrue(((AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().text(\"Please, insert your pass code\")")).isDisplayed()); + assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver + .findElementByAndroidUIAutomator("new UiSelector()" + + ".resourceId(\"android:id/action_bar_title\")"))); + assertTrue(((AndroidElement) driver.findElementByAndroidUIAutomator( + "new UiSelector().text(\"Please, insert your pass code\")")) + .isDisplayed()); } protected void assertIsInSettingsView() throws InterruptedException { - assertTrue(waitForTextPresent("Settings", (AndroidElement) driver.findElementByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/action_bar_title\")"))); + assertTrue(waitForTextPresent("Settings", (AndroidElement) driver + .findElementByAndroidUIAutomator("new UiSelector()" + + ".resourceId(\"android:id/action_bar_title\")"))); } } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/CreateFolderTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/CreateFolderTestSuite.java index a2bdab33f0..d9d5b272f2 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/CreateFolderTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/CreateFolderTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -41,17 +61,21 @@ public class CreateFolderTestSuite{ public void testCreateNewFolder () throws Exception { String NEW_FOLDER_NAME = "testCreateFolder"; - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, + Config.user,Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //check if the folder already exists and if true, delete them Actions.deleteElement(NEW_FOLDER_NAME, fileListView, driver); - WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(NEW_FOLDER_NAME, fileListView); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + WaitAMomentPopUp waitAMomentPopUp = Actions + .createFolder(NEW_FOLDER_NAME, fileListView); + Common.waitTillElementIsNotPresent(waitAMomentPopUp + .getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(FOLDER_NAME); assertNotNull(fileListView.getFileElement()); - assertTrue(folderHasBeenCreated=fileListView.getFileElement().isDisplayed()); + assertTrue( + folderHasBeenCreated=fileListView.getFileElement().isDisplayed()); CurrentCreatedFolder = FOLDER_NAME; assertEquals(FOLDER_NAME , fileListView.getFileElement().getText()); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFileTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFileTestSuite.java index 28e6b25131..af6e37d1f2 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFileTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFileTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -38,15 +58,20 @@ public class DeleteFileTestSuite{ @Test @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testDeleteFile () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //TODO. if the file already exists, do not upload - FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(FILE_NAME, fileListView); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); - Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); - common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())))); + Common.waitTillElementIsNotPresent( + fileListViewAfterUploadFile.getProgressCircular(), 1000); + common.wait.until(ExpectedConditions.visibilityOf( + fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getLocalFileIndicator())))); Actions.deleteElement(FILE_NAME,fileListViewAfterUploadFile, driver); assertFalse(fileListViewAfterUploadFile.getFileElement().isDisplayed()); diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFolderTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFolderTestSuite.java index 105a42dc57..5e0e2cd1b9 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFolderTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/DeleteFolderTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -38,19 +58,24 @@ public class DeleteFolderTestSuite{ @Test @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testDeleteFolder () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //TODO. if the folder already exists, do no created //create the folder - WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(FOLDER_NAME, fileListView); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + WaitAMomentPopUp waitAMomentPopUp = Actions + .createFolder(FOLDER_NAME, fileListView); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(FOLDER_NAME); - assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); + assertTrue( + folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); //delete the folder Actions.deleteElement(FOLDER_NAME, fileListView, driver); - assertFalse(folderHasBeenCreated =fileListView.getFileElement().isDisplayed()); + assertFalse( + folderHasBeenCreated =fileListView.getFileElement().isDisplayed()); } @After diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java index 4083e8eda4..4c6c4cceda 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -38,7 +58,8 @@ public class LoginTestSuite{ public void test1LoginPortrait () throws Exception { driver.rotate(ScreenOrientation.PORTRAIT); - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); } @@ -46,7 +67,8 @@ public class LoginTestSuite{ @Category({NoIgnoreTestCategory.class}) public void test2LoginLandscape () throws Exception { driver.rotate(ScreenOrientation.LANDSCAPE); - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); } @@ -55,7 +77,8 @@ public class LoginTestSuite{ @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void test3MultiAccountRotate () throws Exception { driver.rotate(ScreenOrientation.LANDSCAPE); - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); driver.rotate(ScreenOrientation.PORTRAIT); @@ -63,7 +86,8 @@ public class LoginTestSuite{ SettingsView settingsView = menu.clickOnSettingsButton(); settingsView.tapOnAddAccount(1, 1000); - fileListView = Actions.login(Config.URL2, Config.user2,Config.password2, Config.isTrusted2, driver); + fileListView = Actions.login(Config.URL2, Config.user2, + Config.password2, Config.isTrusted2, driver); common.assertIsInSettingsView(); } @@ -71,7 +95,8 @@ public class LoginTestSuite{ @Category({NoIgnoreTestCategory.class}) public void test4ExistingAccountRotate () throws Exception { driver.rotate(ScreenOrientation.PORTRAIT); - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); driver.rotate(ScreenOrientation.LANDSCAPE); @@ -80,23 +105,29 @@ public class LoginTestSuite{ settingsView.tapOnAddAccount(1, 1000); LoginForm loginForm = new LoginForm(driver); - fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); - assertTrue(common.waitForTextPresent("An account for the same user and server already exists in the device", loginForm.getAuthStatusText())); + fileListView = Actions.login(Config.URL, Config.user,Config.password, + Config.isTrusted, driver); + assertTrue(common.waitForTextPresent("An account for the same user and" + + " server already exists in the device", + loginForm.getAuthStatusText())); } @Test @Category({NoIgnoreTestCategory.class}) public void test5ChangePasswordWrong () throws Exception { driver.rotate(ScreenOrientation.PORTRAIT); - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); MenuList menu = fileListView.clickOnMenuButton(); SettingsView settingsView = menu.clickOnSettingsButton(); settingsView.tapOnAccountElement(1, 1000); - LoginForm changePasswordForm = settingsView.clickOnChangePasswordElement(); + LoginForm changePasswordForm = settingsView + .clickOnChangePasswordElement(); changePasswordForm.typePassword("WrongPassword"); changePasswordForm.clickOnConnectButton(); - assertTrue(common.waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText())); + assertTrue(common.waitForTextPresent("Wrong username or password", + changePasswordForm.getAuthStatusText())); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LogoutTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LogoutTestSuite.java index 6ebfb635a4..d99a4a611b 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LogoutTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LogoutTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; @@ -35,13 +55,15 @@ public class LogoutTestSuite{ @Test @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testLogout () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); MenuList menulist = fileListView.clickOnMenuButton(); SettingsView settingsView = menulist.clickOnSettingsButton(); settingsView.tapOnAccountElement(1, 1000); LoginForm loginForm = settingsView.clickOnDeleteAccountElement(); - assertEquals("Server address https://…", loginForm.gethostUrlInput().getText()); + assertEquals("Server address https://…", + loginForm.gethostUrlInput().getText()); assertEquals("Username", loginForm.getUserNameInput().getText()); assertEquals("", loginForm.getPasswordInput().getText()); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFileTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFileTestSuite.java index c5070a0adc..d950d4130b 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFileTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFileTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -41,37 +61,45 @@ public class MoveFileTestSuite{ public void testMoveFile () throws Exception { WaitAMomentPopUp waitAMomentPopUp; - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); - //Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); + //Common.waitTillElementIsNotPresent( + //fileListView.getProgressCircular(), 1000); //check if the folder already exists and if true, delete them Actions.deleteElement(FOLDER_WHERE_MOVE, fileListView, driver); Actions.deleteElement(FILE_NAME, fileListView, driver); //Create the folder where the other is gone to be moved - waitAMomentPopUp = Actions.createFolder(FOLDER_WHERE_MOVE, fileListView); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + waitAMomentPopUp = Actions + .createFolder(FOLDER_WHERE_MOVE, fileListView); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE); assertTrue(fileListView.getFileElement().isDisplayed()); - FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(FILE_NAME, fileListView); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); //select to move the file - ElementMenuOptions menuOptions = fileListView.longPressOnElement(FILE_NAME); + ElementMenuOptions menuOptions = fileListView + .longPressOnElement(FILE_NAME); MoveView moveView = menuOptions.clickOnMove(); //to move to a folder moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); waitAMomentPopUp = moveView.clickOnChoose(); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); //check that the folder moved is inside the other fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); - Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); + Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), + 1000); Thread.sleep(1000); fileListView.scrollTillFindElement(FILE_NAME); assertEquals(FILE_NAME , fileListView.getFileElement().getText()); diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFolderTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFolderTestSuite.java index d7439040c8..790336c949 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFolderTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/MoveFolderTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -41,39 +61,47 @@ public class MoveFolderTestSuite{ public void testMoveFolder () throws Exception { WaitAMomentPopUp waitAMomentPopUp; - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); - //Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); + //Common.waitTillElementIsNotPresent( + //fileListView.getProgressCircular(), 1000); //check if the folder already exists and if true, delete them Actions.deleteElement(FOLDER_WHERE_MOVE, fileListView, driver); Actions.deleteElement(FOLDER_TO_MOVE, fileListView, driver); //Create the folder where the other is gone to be moved - waitAMomentPopUp = Actions.createFolder(FOLDER_WHERE_MOVE, fileListView); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + waitAMomentPopUp = Actions + .createFolder(FOLDER_WHERE_MOVE, fileListView); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE); assertTrue(fileListView.getFileElement().isDisplayed()); //Create the folder which is going to be moved waitAMomentPopUp = Actions.createFolder(FOLDER_TO_MOVE, fileListView); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(FOLDER_TO_MOVE); assertTrue(fileListView.getFileElement().isDisplayed()); //select to move the folder - ElementMenuOptions menuOptions = fileListView.longPressOnElement(FOLDER_TO_MOVE); + ElementMenuOptions menuOptions = fileListView + .longPressOnElement(FOLDER_TO_MOVE); MoveView moveView = menuOptions.clickOnMove(); //to move to a folder moveView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); waitAMomentPopUp = moveView.clickOnChoose(); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + Common.waitTillElementIsNotPresent(waitAMomentPopUp + .getWaitAMomentTextElement(), 100); //check that the folder moved is inside the other fileListView.scrollTillFindElement(FOLDER_WHERE_MOVE).tap(1,1); - Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); + Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), + 1000); Thread.sleep(1000); fileListView.scrollTillFindElement(FOLDER_TO_MOVE); assertEquals(FOLDER_TO_MOVE , fileListView.getFileElement().getText()); diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/PasscodeTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/PasscodeTestSuite.java index 7b50af8863..9f671ce806 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/PasscodeTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/PasscodeTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import io.appium.java_client.android.AndroidDriver; @@ -37,25 +57,33 @@ public class PasscodeTestSuite { @Category({NoIgnoreTestCategory.class}) public void testPincodeEnable () throws Exception { driver.rotate(ScreenOrientation.PORTRAIT); - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); MenuList menu = fileListView.clickOnMenuButton(); SettingsView settingsView = menu.clickOnSettingsButton(); PassCodeView passCodeview = settingsView.EnablePassCode(); - PassCodeView passCodeview2 = passCodeview.enterPasscode(Config.passcode1, Config.passcode2, Config.passcode3, Config.passcode4); - passCodeview2.reenterPasscode(Config.passcode1, Config.passcode2, Config.passcode3, Config.passcode4); + PassCodeView passCodeview2 = passCodeview.enterPasscode( + Config.passcode1, Config.passcode2, Config.passcode3, + Config.passcode4); + passCodeview2.reenterPasscode(Config.passcode1, Config.passcode2, + Config.passcode3, Config.passcode4); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME); //TO DO. Open the app instead of start an activity - driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); - //here we check that we are not in the fileDisplayActivity, because pincode is asked + driver.startActivity("com.owncloud.android", + ".ui.activity.FileDisplayActivity"); + //here we check that we are not in the fileDisplayActivity, + //because pincode is asked common.assertIsNotInFileListView(); common.assertIsPasscodeRequestView(); - PassCodeRequestView passCodeReequestView = new PassCodeRequestView(driver); - passCodeReequestView.enterPasscode(Config.passcode1, Config.passcode2, Config.passcode3, Config.passcode4); + PassCodeRequestView passCodeReequestView = new + PassCodeRequestView(driver); + passCodeReequestView.enterPasscode(Config.passcode1, Config.passcode2, + Config.passcode3, Config.passcode4); common.assertIsInFileListView(); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RefreshFolderTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RefreshFolderTestSuite.java index 15015c0699..1d4c76c02c 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RefreshFolderTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RefreshFolderTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -34,9 +54,11 @@ public class RefreshFolderTestSuite{ @Test @Category({UnfinishedTestCategory.class}) public void testPulldownToRefreshFolder () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); - //TODO. Remove the sleep and check why is not working the assert when using waitTillElementIsNotPresent + //TODO. Remove the sleep and check why is not working the assert + //when using waitTillElementIsNotPresent Thread.sleep(5000); //waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); fileListView.pulldownToRefresh(); diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFileTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFileTestSuite.java index 4c9b293be9..6e04a20d2b 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFileTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFileTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -44,29 +64,39 @@ public class RenameFileTestSuite{ @Test @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testRenameFile () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //TODO. if the file already exists, do not upload - FileListView fileListViewAfterUploadFile = Actions.uploadFile(OLD_FILE_NAME, fileListView); + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(OLD_FILE_NAME, fileListView); //check if the file with the new name already exists, if true delete it Actions.deleteElement(FILE_NAME, fileListView, driver); fileListViewAfterUploadFile.scrollTillFindElement(OLD_FILE_NAME); - assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed()); + assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile + .getFileElement().isDisplayed()); CurrentCreatedFile = OLD_FILE_NAME; - Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); - common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())))); - ElementMenuOptions menuOptions = fileListViewAfterUploadFile.longPressOnElement(OLD_FILE_NAME); + Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile + .getProgressCircular(), 1000); + common.wait.until(ExpectedConditions.visibilityOf( + fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getLocalFileIndicator())))); + ElementMenuOptions menuOptions = fileListViewAfterUploadFile + .longPressOnElement(OLD_FILE_NAME); NewFolderPopUp newFolderPopUp = menuOptions.clickOnRename(); newFolderPopUp.typeNewFolderName(FILE_NAME); - WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton(); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp + .clickOnNewFolderOkButton(); + Common.waitTillElementIsNotPresent(waitAMomentPopUp + .getWaitAMomentTextElement(), 100); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); assertNotNull(fileListViewAfterUploadFile.getFileElement()); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); - assertEquals(FILE_NAME , fileListViewAfterUploadFile.getFileElement().getText()); + assertEquals(FILE_NAME , fileListViewAfterUploadFile.getFileElement() + .getText()); CurrentCreatedFile = FILE_NAME; } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFolderTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFolderTestSuite.java index 0983f017f7..0298bd469f 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFolderTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RenameFolderTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.*; @@ -43,30 +63,38 @@ public class RenameFolderTestSuite{ @Test @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testRenameFolder () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //TODO. if the folder already exists, do no created //create the folder to rename - WaitAMomentPopUp waitAMomentPopUp = Actions.createFolder(OLD_FOLDER_NAME, fileListView); - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + WaitAMomentPopUp waitAMomentPopUp = Actions + .createFolder(OLD_FOLDER_NAME, fileListView); + Common.waitTillElementIsNotPresent( + waitAMomentPopUp.getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(OLD_FOLDER_NAME); - assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); + assertTrue( + folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); - //check if the folder with the new name already exists and if true, delete them + //check if the folder with the new name already exists + //and if true, delete them Actions.deleteElement(FOLDER_NAME, fileListView, driver); CurrentCreatedFolder = OLD_FOLDER_NAME; - ElementMenuOptions menuOptions = fileListView.longPressOnElement(OLD_FOLDER_NAME); + ElementMenuOptions menuOptions = fileListView + .longPressOnElement(OLD_FOLDER_NAME); NewFolderPopUp FolderPopUp = menuOptions.clickOnRename(); FolderPopUp.typeNewFolderName(FOLDER_NAME); FolderPopUp.clickOnNewFolderOkButton(); CurrentCreatedFolder = FOLDER_NAME; - Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + Common.waitTillElementIsNotPresent(waitAMomentPopUp + .getWaitAMomentTextElement(), 100); fileListView.scrollTillFindElement(FOLDER_NAME); assertNotNull(fileListView.getFileElement()); - assertTrue(folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); + assertTrue( + folderHasBeenCreated = fileListView.getFileElement().isDisplayed()); assertEquals(FOLDER_NAME , fileListView.getFileElement().getText()); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunFailingTests.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunFailingTests.java index 53d69fd025..9633abca3e 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunFailingTests.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunFailingTests.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunNoIgnoreTests.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunNoIgnoreTests.java index bfa7dbf5ed..4d90438760 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunNoIgnoreTests.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunNoIgnoreTests.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import org.junit.experimental.categories.Categories.ExcludeCategory; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunSmokeTests.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunSmokeTests.java index ad4738f030..5c2e6ebdba 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunSmokeTests.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/RunSmokeTests.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import org.junit.experimental.categories.Categories.ExcludeCategory; diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/ShareLinkFileTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/ShareLinkFileTestSuite.java index 147801f8e2..42195a7762 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/ShareLinkFileTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/ShareLinkFileTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; import static org.junit.Assert.assertTrue; @@ -38,24 +58,34 @@ public class ShareLinkFileTestSuite{ @Test @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testShareLinkFile () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //TODO. if the file already exists, do not upload - FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(FILE_NAME, fileListView); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); - assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile.getFileElement().isDisplayed()); + assertTrue(fileHasBeenCreated = fileListViewAfterUploadFile + .getFileElement().isDisplayed()); - ElementMenuOptions elementMenuOption = fileListViewAfterUploadFile.longPressOnElement(FILE_NAME); + ElementMenuOptions elementMenuOption = fileListViewAfterUploadFile + .longPressOnElement(FILE_NAME); ShareView shareView = elementMenuOption.clickOnShareLinkElement(); - Actions.scrollTillFindElement("Gmail", shareView.getListViewLayout(), driver).click(); + Actions.scrollTillFindElement("Gmail", shareView.getListViewLayout(), + driver).click(); GmailSendMailView gmailSendMailView = new GmailSendMailView(driver); gmailSendMailView.typeToEmailAdress(Config.gmailAccount); gmailSendMailView.clickOnSendButton(); - Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); - common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator())))); - assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getSharedElementIndicator())).isDisplayed()); + Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile + .getProgressCircular(), 1000); + common.wait.until(ExpectedConditions.visibilityOf( + fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getSharedElementIndicator())))); + assertTrue(fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getSharedElementIndicator())) + .isDisplayed()); } diff --git a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java index 84c228edca..50ddb39042 100644 --- a/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java +++ b/automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java @@ -1,3 +1,23 @@ +/** + * ownCloud Android client application + * + * @author purigarcia + * Copyright (C) 2015 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.test.ui.testSuites; @@ -55,29 +75,39 @@ public class UploadTestSuite{ @Category(NoIgnoreTestCategory.class) public void testUploadFile () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); //check if the file already exists and if true, delete it Actions.deleteElement(FILE_NAME, fileListView, driver); - FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(FILE_NAME, fileListView); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); - Common.waitTillElementIsNotPresent(fileListViewAfterUploadFile.getProgressCircular(), 1000); - common.wait.until(ExpectedConditions.visibilityOf(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())))); - assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getLocalFileIndicator())).isDisplayed()); + Common.waitTillElementIsNotPresent( + fileListViewAfterUploadFile.getProgressCircular(), 1000); + common.wait.until(ExpectedConditions.visibilityOf( + fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getLocalFileIndicator())))); + assertTrue(fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getLocalFileIndicator())) + .isDisplayed()); fileListView = new FileListView(driver); fileListView.scrollTillFindElement(FILE_NAME); - assertTrue(fileHasBeenUploaded = fileListView.getFileElement().isDisplayed()); + assertTrue( + fileHasBeenUploaded = fileListView.getFileElement().isDisplayed()); } @Test @Category(UnfinishedTestCategory.class) public void testUploadFromGmail () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); - driver.startActivity("com.google.android.gm", ".ConversationListActivityGmail"); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); + driver.startActivity("com.google.android.gm", + ".ConversationListActivityGmail"); GmailEmailListView gmailEmailListView = new GmailEmailListView(driver); Thread.sleep(3000); GmailEmailView gmailEmailView = gmailEmailListView.clickOnEmail(); @@ -93,12 +123,16 @@ public class UploadTestSuite{ UploadView uploadView = new UploadView(driver); uploadView.clickOUploadButton(); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME); - driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); - common.wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name(FILE_GMAIL_NAME))); - assertEquals(Config.fileToTestSendByEmailName , driver.findElementByName(FILE_GMAIL_NAME).getText()); + driver.startActivity("com.owncloud.android", + ".ui.activity.FileDisplayActivity"); + common.wait.until(ExpectedConditions + .visibilityOfAllElementsLocatedBy(By.name(FILE_GMAIL_NAME))); + assertEquals(Config.fileToTestSendByEmailName , + driver.findElementByName(FILE_GMAIL_NAME).getText()); fileListView = new FileListView(driver); fileListView.scrollTillFindElement(FILE_GMAIL_NAME); - assertTrue(fileHasBeenUploadedFromGmail = fileListView.getFileElement().isDisplayed()); + assertTrue(fileHasBeenUploadedFromGmail = fileListView + .getFileElement().isDisplayed()); //TODO. correct assert if fileListView is shown in grid mode } @@ -107,22 +141,30 @@ public class UploadTestSuite{ @Category({FailingTestCategory.class}) public void testKeepFileUpToDate () throws Exception { - FileListView fileListView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); + FileListView fileListView = Actions.login(Config.URL, Config.user, + Config.password, Config.isTrusted, driver); common.assertIsInFileListView(); - Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), 1000); + Common.waitTillElementIsNotPresent(fileListView.getProgressCircular(), + 1000); - FileListView fileListViewAfterUploadFile = Actions.uploadFile(FILE_NAME, fileListView); + FileListView fileListViewAfterUploadFile = Actions + .uploadFile(FILE_NAME, fileListView); fileListViewAfterUploadFile.scrollTillFindElement(FILE_NAME); assertTrue(fileListViewAfterUploadFile.getFileElement().isDisplayed()); - ElementMenuOptions menuOptions = fileListViewAfterUploadFile.longPressOnElement(FILE_NAME); + ElementMenuOptions menuOptions = fileListViewAfterUploadFile + .longPressOnElement(FILE_NAME); FileDetailsView fileDetailsView = menuOptions.clickOnDetails(); fileDetailsView.checkKeepFileUpToDateCheckbox(); Thread.sleep(3000); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK); - assertTrue(common.isElementPresent(fileListViewAfterUploadFile.getFileElementLayout(), MobileBy.id(FileListView.getFavoriteFileIndicator()))); - assertTrue(fileListViewAfterUploadFile.getFileElementLayout().findElement(By.id(FileListView.getFavoriteFileIndicator())).isDisplayed()); + assertTrue(common.isElementPresent( + fileListViewAfterUploadFile.getFileElementLayout(), + MobileBy.id(FileListView.getFavoriteFileIndicator()))); + assertTrue(fileListViewAfterUploadFile.getFileElementLayout() + .findElement(By.id(FileListView.getFavoriteFileIndicator())) + .isDisplayed()); }