d99a4a611b999bb4f6a702ee2f5163925eead4a2
[pub/Android/ownCloud.git] / automationTest / src / test / java / com / owncloud / android / test / ui / testSuites / LogoutTestSuite.java
1 /**
2 * ownCloud Android client application
3 *
4 * @author purigarcia
5 * Copyright (C) 2015 ownCloud Inc.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2,
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 package com.owncloud.android.test.ui.testSuites;
22
23
24 import static org.junit.Assert.*;
25 import io.appium.java_client.android.AndroidDriver;
26
27 import org.junit.After;
28 import org.junit.Before;
29 import org.junit.Rule;
30 import org.junit.Test;
31 import org.junit.experimental.categories.Category;
32 import org.junit.rules.TestName;
33
34 import com.owncloud.android.test.ui.actions.Actions;
35 import com.owncloud.android.test.ui.groups.NoIgnoreTestCategory;
36 import com.owncloud.android.test.ui.groups.SmokeTestCategory;
37 import com.owncloud.android.test.ui.models.LoginForm;
38 import com.owncloud.android.test.ui.models.FileListView;
39 import com.owncloud.android.test.ui.models.MenuList;
40 import com.owncloud.android.test.ui.models.SettingsView;
41
42 public class LogoutTestSuite{
43
44 AndroidDriver driver;
45 Common common;
46
47 @Rule public TestName name = new TestName();
48
49 @Before
50 public void setUp() throws Exception {
51 common=new Common();
52 driver=common.setUpCommonDriver();
53 }
54
55 @Test
56 @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class})
57 public void testLogout () throws Exception {
58 FileListView fileListView = Actions.login(Config.URL, Config.user,
59 Config.password, Config.isTrusted, driver);
60 common.assertIsInFileListView();
61 MenuList menulist = fileListView.clickOnMenuButton();
62 SettingsView settingsView = menulist.clickOnSettingsButton();
63 settingsView.tapOnAccountElement(1, 1000);
64 LoginForm loginForm = settingsView.clickOnDeleteAccountElement();
65 assertEquals("Server address https://…",
66 loginForm.gethostUrlInput().getText());
67 assertEquals("Username", loginForm.getUserNameInput().getText());
68 assertEquals("", loginForm.getPasswordInput().getText());
69 }
70
71 @After
72 public void tearDown() throws Exception {
73 common.takeScreenShotOnFailed(name.getMethodName());
74 //driver.removeApp("com.owncloud.android");
75 driver.quit();
76 }
77 }