ccf9bd4e16959f61a38e8ce7bdcd9c4d6c48fca6
[pub/Android/ownCloud.git] / automationTest / src / test / java / com / owncloud / android / test / ui / models / ElementMenuOptions.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.models;
22
23 import io.appium.java_client.android.AndroidDriver;
24 import io.appium.java_client.android.AndroidElement;
25 import io.appium.java_client.pagefactory.AndroidFindBy;
26 import io.appium.java_client.pagefactory.AppiumFieldDecorator;
27
28 import org.openqa.selenium.support.PageFactory;
29
30 public class ElementMenuOptions {
31
32 final AndroidDriver driver;
33
34 @AndroidFindBy(name = "Share link")
35 private AndroidElement shareLinkElement;
36
37 @AndroidFindBy(name = "Details")
38 private AndroidElement detailsFileElement;
39
40 @AndroidFindBy(name = "Rename")
41 private AndroidElement renameFileElement;
42
43 @AndroidFindBy(name = "Remove")
44 private AndroidElement removeFileElement;
45
46 @AndroidFindBy(name = "Move")
47 private AndroidElement moveElement;
48
49 public ElementMenuOptions (AndroidDriver driver) {
50 this.driver = driver;
51 PageFactory.initElements(new AppiumFieldDecorator(driver), this);
52 }
53
54 public FileDetailsView clickOnDetails () {
55 detailsFileElement.click();
56 FileDetailsView fileDetailsView = new FileDetailsView(driver);
57 return fileDetailsView;
58 }
59
60 public RemoveConfirmationView clickOnRemove () {
61 removeFileElement.click();
62 RemoveConfirmationView removeConfirmationView =
63 new RemoveConfirmationView(driver);
64 return removeConfirmationView;
65 }
66
67
68 public MoveView clickOnMove () {
69 moveElement.click();
70 MoveView moveView = new MoveView(driver);
71 return moveView;
72 }
73
74 public NewFolderPopUp clickOnRename () {
75 renameFileElement.click();
76 NewFolderPopUp newFolderPopUp = new NewFolderPopUp(driver);
77 return newFolderPopUp;
78 }
79
80 public ShareView clickOnShareLinkElement () {
81 shareLinkElement.click();
82 ShareView shareView = new ShareView(driver);
83 return shareView;
84 }
85 }