1 package com
.owncloud
.android
.test
.ui
.testSuites
;
3 import static org
.junit
.Assert
.*;
4 import io
.appium
.java_client
.android
.AndroidDriver
;
6 import org
.junit
.After
;
7 import org
.junit
.Before
;
9 import org
.junit
.experimental
.categories
.Category
;
10 import org
.junit
.rules
.TestName
;
11 import org
.junit
.runners
.MethodSorters
;
12 import org
.junit
.FixMethodOrder
;
13 import org
.junit
.Test
;
14 import org
.openqa
.selenium
.ScreenOrientation
;
16 import com
.owncloud
.android
.test
.ui
.actions
.Actions
;
17 import com
.owncloud
.android
.test
.ui
.groups
.*;
18 import com
.owncloud
.android
.test
.ui
.models
.LoginForm
;
19 import com
.owncloud
.android
.test
.ui
.models
.FileListView
;
20 import com
.owncloud
.android
.test
.ui
.models
.MenuList
;
21 import com
.owncloud
.android
.test
.ui
.models
.SettingsView
;
23 @FixMethodOrder(MethodSorters
.NAME_ASCENDING
)
24 public class LoginTestSuite
{
28 @Rule public TestName name
= new TestName();
31 public void setUp() throws Exception
{
33 driver
=common
.setUpCommonDriver();
37 @Category({NoIgnoreTestCategory
.class})
38 public void test1LoginPortrait () throws Exception
{
39 driver
.rotate(ScreenOrientation
.PORTRAIT
);
41 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
42 common
.assertIsInFileListView();
46 @Category({NoIgnoreTestCategory
.class})
47 public void test2LoginLandscape () throws Exception
{
48 driver
.rotate(ScreenOrientation
.LANDSCAPE
);
49 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
50 common
.assertIsInFileListView();
55 @Category({NoIgnoreTestCategory
.class, SmokeTestCategory
.class})
56 public void test3MultiAccountRotate () throws Exception
{
57 driver
.rotate(ScreenOrientation
.LANDSCAPE
);
58 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
59 common
.assertIsInFileListView();
61 driver
.rotate(ScreenOrientation
.PORTRAIT
);
62 MenuList menu
= fileListView
.clickOnMenuButton();
63 SettingsView settingsView
= menu
.clickOnSettingsButton();
65 settingsView
.tapOnAddAccount(1, 1000);
66 fileListView
= Actions
.login(Config
.URL2
, Config
.user2
,Config
.password2
, Config
.isTrusted2
, driver
);
67 common
.assertIsInSettingsView();
71 @Category({NoIgnoreTestCategory
.class})
72 public void test4ExistingAccountRotate () throws Exception
{
73 driver
.rotate(ScreenOrientation
.PORTRAIT
);
74 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
75 common
.assertIsInFileListView();
77 driver
.rotate(ScreenOrientation
.LANDSCAPE
);
78 MenuList menu
= fileListView
.clickOnMenuButton();
79 SettingsView settingsView
= menu
.clickOnSettingsButton();
80 settingsView
.tapOnAddAccount(1, 1000);
82 LoginForm loginForm
= new LoginForm(driver
);
83 fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
84 assertTrue(common
.waitForTextPresent("An account for the same user and server already exists in the device", loginForm
.getAuthStatusText()));
88 @Category({NoIgnoreTestCategory
.class})
89 public void test5ChangePasswordWrong () throws Exception
{
90 driver
.rotate(ScreenOrientation
.PORTRAIT
);
91 FileListView fileListView
= Actions
.login(Config
.URL
, Config
.user
,Config
.password
, Config
.isTrusted
, driver
);
92 common
.assertIsInFileListView();
93 MenuList menu
= fileListView
.clickOnMenuButton();
94 SettingsView settingsView
= menu
.clickOnSettingsButton();
95 settingsView
.tapOnAccountElement(1, 1000);
96 LoginForm changePasswordForm
= settingsView
.clickOnChangePasswordElement();
97 changePasswordForm
.typePassword("WrongPassword");
98 changePasswordForm
.clickOnConnectButton();
99 assertTrue(common
.waitForTextPresent("Wrong username or password", changePasswordForm
.getAuthStatusText()));
104 public void tearDown() throws Exception
{
105 common
.takeScreenShotOnFailed(name
.getMethodName());
106 driver
.removeApp("com.owncloud.android");