new test cases about login and check that there are some files
authorpurigarcia <pgarcia@solidgear.es>
Fri, 5 Jun 2015 11:23:03 +0000 (13:23 +0200)
committerpurigarcia <pgarcia@solidgear.es>
Fri, 5 Jun 2015 11:23:03 +0000 (13:23 +0200)
automationTest/src/test/java/com/owncloud/android/test/ui/actions/Actions.java
automationTest/src/test/java/com/owncloud/android/test/ui/models/SettingsView.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Common.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/Config.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LoginTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/LogoutTestSuite.java
automationTest/src/test/java/com/owncloud/android/test/ui/testSuites/UploadTestSuite.java

index 938d277..ecec7f5 100644 (file)
@@ -106,14 +106,14 @@ public class Actions {
        }
 
 
-       public static void deleteAccount (FileListView fileListView) {  
+       public static void deleteAccount (int accountPosition,FileListView fileListView) {      
                MenuList menulist = fileListView.clickOnMenuButton();
                SettingsView settingView = menulist.clickOnSettingsButton();
-               deleteAccount(settingView);
+               deleteAccount(accountPosition,settingView);
        }
 
-       public static void deleteAccount (SettingsView settingsView) {
-               settingsView.tapOnAccountElement(1, 1000);
+       public static void deleteAccount (int accountPosition, SettingsView settingsView) {
+               settingsView.tapOnAccountElement(accountPosition,1, 1000);
                settingsView.clickOnDeleteAccountElement();
        }
 
index 43d31ec..900c03b 100644 (file)
@@ -59,11 +59,13 @@ public class SettingsView {
                PageFactory.initElements(new AppiumFieldDecorator(driver), this);
        }
 
-       public void tapOnAccountElement (int fingers, int milliSeconds) {
-               accountElement.tap(fingers, milliSeconds);
+       public void tapOnAccountElement (int accountPosition, int fingers, int milliSeconds) {
+               if(accountPosition==1)
+                       accountElement.tap(fingers, milliSeconds);
+               else
+                       accountElement2.tap(fingers, milliSeconds);
        }
 
-
        public void tapOnAddAccount (int fingers, int milliSeconds) {
                addAccountElement.tap(fingers, milliSeconds);
        }
@@ -87,7 +89,7 @@ public class SettingsView {
                PassCodeView passcodeview = new PassCodeView(driver);
                return passcodeview;
        }
-       
+
        public PassCodeView DisablePassCode(){
                if(passcodeCheckbox.isSelected()){
                        passcodeCheckbox.click();
index 36287da..7510cd9 100644 (file)
@@ -158,6 +158,9 @@ public class Common{
        }
 
        protected void assertIsInFileListView() throws InterruptedException {
+               //waitForTextPresent("Wrong username or password", 
+                       //      changePasswordForm.getAuthStatusText());
+               Thread.sleep(2000);
                assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
                                .findElementByAndroidUIAutomator("new UiSelector()"
                                                + ".resourceId(\"android:id/action_bar_title\")")));
index d2ab77f..4674fab 100644 (file)
@@ -39,9 +39,12 @@ public final class Config {
 
        public static final String gmailAccount = "gmailAccountVar";
        
+       public static final String fileWhichIsInTheServer1 ="test";
+       public static final String fileWhichIsInTheServer2 ="test";
+       
        public static final String fileToTestName = "test";
-       public static final String bigFileToTestName = "test";
        public static final String fileToTestSendByEmailName = "test";
+       public static final String bigFileToTestName = "test";
        
        public static final String passcode1 = "passcode1";
        public static final String passcode2 = "passcode2";
index c017bcf..8f1bccf 100644 (file)
@@ -72,6 +72,20 @@ public class LoginTestSuite{
                common.assertIsInFileListView();
        }
        
+       @Test
+       @Category({NoIgnoreTestCategory.class})
+       public void testLoginAndShowFiles () throws Exception {
+               driver.rotate(ScreenOrientation.PORTRAIT);
+               
+               FileListView fileListView = Actions.login(Config.URL, Config.user,
+                               Config.password, Config.isTrusted, driver);
+               common.assertIsInFileListView();
+               
+               fileListView.scrollTillFindElement(Config.fileWhichIsInTheServer1);
+               assertTrue(fileListView.getFileElement().isDisplayed());
+       }
+       
+       
        
        @Test
        @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
@@ -92,6 +106,31 @@ public class LoginTestSuite{
        }
        
        @Test
+       @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
+       public void testMultiAccountAndShowFiles () throws Exception {
+               driver.rotate(ScreenOrientation.LANDSCAPE);
+               FileListView fileListView = Actions.login(Config.URL, Config.user,
+                               Config.password, Config.isTrusted, driver);
+               common.assertIsInFileListView();
+               fileListView.scrollTillFindElement(Config.fileWhichIsInTheServer1);
+               assertTrue(fileListView.getFileElement().isDisplayed());
+               
+               driver.rotate(ScreenOrientation.PORTRAIT);
+               MenuList menu = fileListView.clickOnMenuButton();
+               SettingsView settingsView = menu.clickOnSettingsButton();
+               
+               settingsView.tapOnAddAccount(1, 1000);
+               fileListView = Actions.login(Config.URL2, Config.user2,
+                               Config.password2, Config.isTrusted2, driver);
+               common.assertIsInSettingsView();
+               settingsView.tapOnAccountElement(2,1, 100);
+               common.assertIsInFileListView();
+               
+               fileListView.scrollTillFindElement(Config.fileWhichIsInTheServer2);
+               assertTrue(fileListView.getFileElement().isDisplayed());
+       }
+       
+       @Test
        @Category({NoIgnoreTestCategory.class})
        public void test4ExistingAccountRotate () throws Exception {
                driver.rotate(ScreenOrientation.PORTRAIT);
@@ -121,7 +160,7 @@ public class LoginTestSuite{
                common.assertIsInFileListView();
                MenuList menu = fileListView.clickOnMenuButton();
                SettingsView settingsView = menu.clickOnSettingsButton();
-               settingsView.tapOnAccountElement(1, 1000);
+               settingsView.tapOnAccountElement(1,1, 1000);
                LoginForm changePasswordForm = settingsView
                                .clickOnChangePasswordElement();
                changePasswordForm.typePassword("WrongPassword");
index d99a4a6..8927dac 100644 (file)
@@ -60,7 +60,7 @@ public class LogoutTestSuite{
                common.assertIsInFileListView();
                MenuList menulist = fileListView.clickOnMenuButton();
                SettingsView settingsView = menulist.clickOnSettingsButton();
-               settingsView.tapOnAccountElement(1, 1000);
+               settingsView.tapOnAccountElement(1,1, 1000);
                LoginForm loginForm = settingsView.clickOnDeleteAccountElement();
                assertEquals("Server address https://…",
                                loginForm.gethostUrlInput().getText());
index 287b43d..d8ffeff 100644 (file)
@@ -108,7 +108,7 @@ public class UploadTestSuite{
        
        
        @Test
-       @Category({UnfinishedTestCategory.class, InProgressCategory.class})
+       @Category({UnfinishedTestCategory.class})
        public void testUploadBigFile () throws Exception {
 
                FileListView fileListView = Actions.login(Config.URL, Config.user,