new test cases about login and check that there are some files

This commit is contained in:
purigarcia 2015-06-05 13:23:03 +02:00
parent 23af1d2310
commit 171ae0b574
7 changed files with 59 additions and 12 deletions

View 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(); MenuList menulist = fileListView.clickOnMenuButton();
SettingsView settingView = menulist.clickOnSettingsButton(); SettingsView settingView = menulist.clickOnSettingsButton();
deleteAccount(settingView); deleteAccount(accountPosition,settingView);
} }
public static void deleteAccount (SettingsView settingsView) { public static void deleteAccount (int accountPosition, SettingsView settingsView) {
settingsView.tapOnAccountElement(1, 1000); settingsView.tapOnAccountElement(accountPosition,1, 1000);
settingsView.clickOnDeleteAccountElement(); settingsView.clickOnDeleteAccountElement();
} }

View file

@ -59,11 +59,13 @@ public class SettingsView {
PageFactory.initElements(new AppiumFieldDecorator(driver), this); PageFactory.initElements(new AppiumFieldDecorator(driver), this);
} }
public void tapOnAccountElement (int fingers, int milliSeconds) { public void tapOnAccountElement (int accountPosition, int fingers, int milliSeconds) {
accountElement.tap(fingers, milliSeconds); if(accountPosition==1)
accountElement.tap(fingers, milliSeconds);
else
accountElement2.tap(fingers, milliSeconds);
} }
public void tapOnAddAccount (int fingers, int milliSeconds) { public void tapOnAddAccount (int fingers, int milliSeconds) {
addAccountElement.tap(fingers, milliSeconds); addAccountElement.tap(fingers, milliSeconds);
} }
@ -87,7 +89,7 @@ public class SettingsView {
PassCodeView passcodeview = new PassCodeView(driver); PassCodeView passcodeview = new PassCodeView(driver);
return passcodeview; return passcodeview;
} }
public PassCodeView DisablePassCode(){ public PassCodeView DisablePassCode(){
if(passcodeCheckbox.isSelected()){ if(passcodeCheckbox.isSelected()){
passcodeCheckbox.click(); passcodeCheckbox.click();

View file

@ -158,6 +158,9 @@ public class Common{
} }
protected void assertIsInFileListView() throws InterruptedException { protected void assertIsInFileListView() throws InterruptedException {
//waitForTextPresent("Wrong username or password",
// changePasswordForm.getAuthStatusText());
Thread.sleep(2000);
assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver assertTrue(waitForTextPresent("ownCloud", (AndroidElement) driver
.findElementByAndroidUIAutomator("new UiSelector()" .findElementByAndroidUIAutomator("new UiSelector()"
+ ".resourceId(\"android:id/action_bar_title\")"))); + ".resourceId(\"android:id/action_bar_title\")")));

View file

@ -39,9 +39,12 @@ public final class Config {
public static final String gmailAccount = "gmailAccountVar"; 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 fileToTestName = "test";
public static final String bigFileToTestName = "test";
public static final String fileToTestSendByEmailName = "test"; public static final String fileToTestSendByEmailName = "test";
public static final String bigFileToTestName = "test";
public static final String passcode1 = "passcode1"; public static final String passcode1 = "passcode1";
public static final String passcode2 = "passcode2"; public static final String passcode2 = "passcode2";

View file

@ -72,6 +72,20 @@ public class LoginTestSuite{
common.assertIsInFileListView(); 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 @Test
@Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
@ -91,6 +105,31 @@ public class LoginTestSuite{
common.assertIsInSettingsView(); common.assertIsInSettingsView();
} }
@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 @Test
@Category({NoIgnoreTestCategory.class}) @Category({NoIgnoreTestCategory.class})
public void test4ExistingAccountRotate () throws Exception { public void test4ExistingAccountRotate () throws Exception {
@ -121,7 +160,7 @@ public class LoginTestSuite{
common.assertIsInFileListView(); common.assertIsInFileListView();
MenuList menu = fileListView.clickOnMenuButton(); MenuList menu = fileListView.clickOnMenuButton();
SettingsView settingsView = menu.clickOnSettingsButton(); SettingsView settingsView = menu.clickOnSettingsButton();
settingsView.tapOnAccountElement(1, 1000); settingsView.tapOnAccountElement(1,1, 1000);
LoginForm changePasswordForm = settingsView LoginForm changePasswordForm = settingsView
.clickOnChangePasswordElement(); .clickOnChangePasswordElement();
changePasswordForm.typePassword("WrongPassword"); changePasswordForm.typePassword("WrongPassword");

View file

@ -60,7 +60,7 @@ public class LogoutTestSuite{
common.assertIsInFileListView(); common.assertIsInFileListView();
MenuList menulist = fileListView.clickOnMenuButton(); MenuList menulist = fileListView.clickOnMenuButton();
SettingsView settingsView = menulist.clickOnSettingsButton(); SettingsView settingsView = menulist.clickOnSettingsButton();
settingsView.tapOnAccountElement(1, 1000); settingsView.tapOnAccountElement(1,1, 1000);
LoginForm loginForm = settingsView.clickOnDeleteAccountElement(); LoginForm loginForm = settingsView.clickOnDeleteAccountElement();
assertEquals("Server address https://…", assertEquals("Server address https://…",
loginForm.gethostUrlInput().getText()); loginForm.gethostUrlInput().getText());

View file

@ -108,7 +108,7 @@ public class UploadTestSuite{
@Test @Test
@Category({UnfinishedTestCategory.class, InProgressCategory.class}) @Category({UnfinishedTestCategory.class})
public void testUploadBigFile () throws Exception { public void testUploadBigFile () throws Exception {
FileListView fileListView = Actions.login(Config.URL, Config.user, FileListView fileListView = Actions.login(Config.URL, Config.user,