|
@@ -6,15 +6,14 @@ import org.junit.runners.MethodSorters;
|
|
import org.junit.FixMethodOrder;
|
|
import org.junit.FixMethodOrder;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.openqa.selenium.ScreenOrientation;
|
|
import org.openqa.selenium.ScreenOrientation;
|
|
-
|
|
|
|
-
|
|
|
|
import androidtest.actions.Actions;
|
|
import androidtest.actions.Actions;
|
|
import androidtest.models.LoginForm;
|
|
import androidtest.models.LoginForm;
|
|
import androidtest.models.MainView;
|
|
import androidtest.models.MainView;
|
|
|
|
+import androidtest.models.MenuList;
|
|
import androidtest.models.SettingsView;
|
|
import androidtest.models.SettingsView;
|
|
|
|
|
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
|
-public class LoginTestSuite extends CommonTest{
|
|
|
|
|
|
+public class LoginTestSuite extends Common{
|
|
|
|
|
|
@Before
|
|
@Before
|
|
public void setUp() throws Exception {
|
|
public void setUp() throws Exception {
|
|
@@ -23,98 +22,67 @@ public class LoginTestSuite extends CommonTest{
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void test1LoginPortrait () throws Exception {
|
|
public void test1LoginPortrait () throws Exception {
|
|
-
|
|
|
|
- System.out.println("Hello" + Config.server);
|
|
|
|
- String testName = "loginPortrait";
|
|
|
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
-
|
|
|
|
- MainView mainView = login(Config.URL, Config.user,Config.password);
|
|
|
|
|
|
+
|
|
|
|
+ MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
- //TO DO. detect in which view is. it can be files view or settings view
|
|
|
|
- /*if(mainView.getTitleTextElement().equals("ownCloud") || mainView.getTitleTextElement().equals("Settings")){
|
|
|
|
- if(mainView.getTitleTextElement().getText().equals("ownCloud")){
|
|
|
|
- assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
|
|
- }else{
|
|
|
|
- assertTrue(waitForTextPresent("Settings", mainView.getTitleTextElement()));
|
|
|
|
- }
|
|
|
|
- fail(testName);
|
|
|
|
- }*/
|
|
|
|
- Actions.deleteAccount(mainView);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void test2LoginLandscape () throws Exception {
|
|
public void test2LoginLandscape () throws Exception {
|
|
-
|
|
|
|
- String testName = "loginLandscape";
|
|
|
|
driver.rotate(ScreenOrientation.LANDSCAPE);
|
|
driver.rotate(ScreenOrientation.LANDSCAPE);
|
|
- MainView mainView = login(Config.URL, Config.user,Config.password);
|
|
|
|
|
|
+ MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
//TO DO. detect in which view is. it can be files view or settings view
|
|
//TO DO. detect in which view is. it can be files view or settings view
|
|
- Actions.deleteAccount(mainView);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void test3MultiAccountRotate () throws Exception {
|
|
public void test3MultiAccountRotate () throws Exception {
|
|
-
|
|
|
|
- String testName = "MultiAccountRotate";
|
|
|
|
driver.rotate(ScreenOrientation.LANDSCAPE);
|
|
driver.rotate(ScreenOrientation.LANDSCAPE);
|
|
- MainView mainView = login(Config.URL, Config.user,Config.password);
|
|
|
|
|
|
+ MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
|
|
|
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
- mainView.clickOnMenuButton();
|
|
|
|
- SettingsView settingsView = mainView.clickOnSettingsButton();
|
|
|
|
|
|
+ MenuList menu = mainView.clickOnMenuButton();
|
|
|
|
+ SettingsView settingsView = menu.clickOnSettingsButton();
|
|
settingsView.tapOnAddAccount(1, 1000);
|
|
settingsView.tapOnAddAccount(1, 1000);
|
|
- mainView = login(Config.URL, Config.user2,Config.password2);
|
|
|
|
|
|
+ mainView = Actions.login(Config.URL2, Config.user2,Config.password2, Config.isTrusted2, driver);
|
|
|
|
|
|
assertTrue(waitForTextPresent("Settings", mainView.getTitleTextElement()));
|
|
assertTrue(waitForTextPresent("Settings", mainView.getTitleTextElement()));
|
|
//TO DO. detect in which view is. it can be files view or settings view
|
|
//TO DO. detect in which view is. it can be files view or settings view
|
|
//Actions.deleteAccount(mainView);
|
|
//Actions.deleteAccount(mainView);
|
|
- Actions.deleteAccount(settingsView);
|
|
|
|
//TO DO. Delete the second user
|
|
//TO DO. Delete the second user
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void test4ExistingAccountRotate () throws Exception {
|
|
public void test4ExistingAccountRotate () throws Exception {
|
|
-
|
|
|
|
- String testName = "ExistingAccountRotate";
|
|
|
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
- MainView mainView = login(Config.URL, Config.user,Config.password);
|
|
|
|
|
|
+ MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
|
|
|
|
driver.rotate(ScreenOrientation.LANDSCAPE);
|
|
driver.rotate(ScreenOrientation.LANDSCAPE);
|
|
- mainView.clickOnMenuButton();
|
|
|
|
- SettingsView settingsView = mainView.clickOnSettingsButton();
|
|
|
|
|
|
+ MenuList menu = mainView.clickOnMenuButton();
|
|
|
|
+ SettingsView settingsView = menu.clickOnSettingsButton();
|
|
settingsView.tapOnAddAccount(1, 1000);
|
|
settingsView.tapOnAddAccount(1, 1000);
|
|
- LoginForm loginForm = new LoginForm(driver);
|
|
|
|
- loginForm.typeHostUrl(Config.URL);
|
|
|
|
- loginForm.clickOnUserName();
|
|
|
|
- waitForTextPresent("Secure connection established", loginForm.getServerStatusTextElement());
|
|
|
|
- assertTrue(waitForTextPresent("Secure connection established", loginForm.getServerStatusTextElement()));
|
|
|
|
- loginForm.typeUserName(Config.user);
|
|
|
|
- loginForm.typePassword(Config.password);
|
|
|
|
- mainView = loginForm.clickOnConnectButton();
|
|
|
|
|
|
|
|
|
|
+ LoginForm loginForm = new LoginForm(driver);
|
|
|
|
+ mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
|
|
assertTrue(waitForTextPresent("An account for the same user and server already exists in the device", loginForm.getAuthStatusText()));
|
|
assertTrue(waitForTextPresent("An account for the same user and server already exists in the device", loginForm.getAuthStatusText()));
|
|
- driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
|
|
|
|
- Actions.deleteAccount(settingsView);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public void test5ChangePasswordWrong () throws Exception {
|
|
public void test5ChangePasswordWrong () throws Exception {
|
|
|
|
|
|
- MainView mainView = login(Config.URL, Config.user,Config.password);
|
|
|
|
|
|
+ MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver);
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
assertTrue(waitForTextPresent("ownCloud", mainView.getTitleTextElement()));
|
|
- mainView.clickOnMenuButton();
|
|
|
|
- SettingsView settingView = mainView.clickOnSettingsButton();
|
|
|
|
- settingView.tapOnAccountElement(1, 1000);
|
|
|
|
- LoginForm changePasswordForm = settingView.clickOnChangePasswordElement();
|
|
|
|
|
|
+ MenuList menu = mainView.clickOnMenuButton();
|
|
|
|
+ SettingsView settingsView = menu.clickOnSettingsButton();
|
|
|
|
+ settingsView.tapOnAccountElement(1, 1000);
|
|
|
|
+ LoginForm changePasswordForm = settingsView.clickOnChangePasswordElement();
|
|
changePasswordForm.typePassword("WrongPassword");
|
|
changePasswordForm.typePassword("WrongPassword");
|
|
changePasswordForm.clickOnConnectButton();
|
|
changePasswordForm.clickOnConnectButton();
|
|
assertTrue(waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText()));
|
|
assertTrue(waitForTextPresent("Wrong username or password", changePasswordForm.getAuthStatusText()));
|
|
- driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_BACK);
|
|
|
|
- Actions.deleteAccount(settingView);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|