add headers. reformat files

This commit is contained in:
purigarcia 2015-05-15 12:32:16 +02:00
parent c775fa0691
commit 8386357e68
44 changed files with 1228 additions and 166 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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<String, String> scrollObject = new HashMap<String, String>();
HashMap<String, String> scrollObject = new HashMap<String,String>();
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;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups;
public interface FailingTestCategory extends IgnoreTestCategory {}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups;
public interface IgnoreTestCategory {}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups;
public interface NoIgnoreTestCategory {

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups;
public interface OtherTestCategory extends IgnoreTestCategory {}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups;
public interface SmokeTestCategory {

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.groups;
public interface UnfinishedTestCategory extends IgnoreTestCategory{

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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);
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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)){}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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();
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.PageFactory;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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) {

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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) {

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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) {

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import io.appium.java_client.android.AndroidDriver;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.models;
import org.openqa.selenium.support.PageFactory;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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\")")));
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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()));
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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();
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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();

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites;
import org.junit.experimental.categories.Categories.ExcludeCategory;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.test.ui.testSuites;
import org.junit.experimental.categories.Categories.ExcludeCategory;

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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());
}