Statistics
| Branch: | Tag: | Revision:

root / test / gr / ebs / gss / client / selenium / file / FileUtils.java @ 67a0315c

History | View | Annotate | Download (4.5 kB)

1
/*
2
 * Copyright 2011 Electronic Business Systems Ltd.
3
 *
4
 * This file is part of GSS.
5
 *
6
 * GSS is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * GSS 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 GSS.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
package gr.ebs.gss.client.selenium.file;
20

    
21
import gr.ebs.gss.client.selenium.folder.ActionUtils;
22
import gr.ebs.gss.client.selenium.folder.FolderUtils;
23

    
24
import org.junit.After;
25
import org.junit.Before;
26
import org.openqa.selenium.By;
27
import org.openqa.selenium.WebDriver;
28
import org.openqa.selenium.firefox.FirefoxDriver;
29

    
30

    
31
public class FileUtils {
32
        
33
        protected ActionUtils action;
34
        
35
        protected WebDriver driver;
36
        
37
        protected String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
38
        
39
        protected String fileName = "darth_vader.jpg";
40
        
41
        protected String groupName = "Wookiees";
42
        
43
        protected String userName = "lakis@ebs.gr";
44
        
45
        protected String addUserName = "past@ebs.gr";
46
                
47
        
48
        protected String folderName = "Alderaan";
49

    
50
        /**
51
         * @throws java.lang.Exception
52
         */
53
        @Before
54
        public void setUp() throws Exception {
55
                
56
                driver = new FirefoxDriver();
57
                
58
                action = new ActionUtils(driver);
59
                
60
                action.getUrl(url);
61
                
62
                // Necessary delay in order all dom elements to be created
63
                Thread.sleep(3000);
64
        }
65

    
66
        
67
        @After
68
        public void tearDown() throws Exception {
69
                action.quit();
70
        }
71
        
72
        protected void clickAFile(String aFileName){                
73
                action.click(By.id("fileList."+ aFileName));
74
        }
75
        
76
        protected void selectFileMenu() {
77
                //Click the top file menu
78
                action.click(By.id("topMenu.file"));                
79
                                
80
        }
81
        
82
        protected void selectAnOptionFromFileMenu(String anOption) {
83
                
84
                //Click the New Folder option from the file menu
85
                action.click(By.id("topMenu.file."+ anOption));
86
                
87
        }
88
        
89
        protected void selectAnOptionFromEditMenu(String anOption) {
90
                
91
                //Click the New Folder option from the file menu
92
                action.click(By.id("topMenu.edit."+ anOption));
93
                
94
        }
95
        
96
        protected void selectConfirmation(String anOption){
97
                
98
                action.click(By.id("confirmation."+ anOption));
99
                
100
        }
101
        
102
        /**
103
         * TODO: Check what's going on with the method scope in the FolderUtils 
104
         * 
105
         * @param aUserName
106
         * @param aFolderName
107
         */
108
        public void selectFolderBelowHome(String aUserName, String aFolderName){
109
                action.click(By.id(aUserName+ "." + aFolderName));
110
        }
111
        
112
        protected void rightClickOnFile(String aFileName){
113
                action.sendRightClick(By.id("fileList." + aFileName));
114
                
115
        }
116
        
117
        protected void selectFileContextMenuOption(String anOption){
118
                action.click(By.id("fileContextMenu." + anOption));
119
        }
120
        
121
        
122
        /**
123
         * TODO: Download a file below in a folder
124
         * > select a file
125
         * > select File > 'Download'
126
         * > save file from the popup window to your hdd
127
         *         
128
         */
129
        
130
        protected void download() throws InterruptedException{
131
                selectFileMenu();
132
                
133
                Thread.sleep(1000);
134
                
135
                selectAnOptionFromFileMenu("download");
136
                
137
                selectConfirmation("ok");
138
        }
139

    
140
        
141
        /** TODO: Save As
142
         * **** This action performs the same results to the above 'Download' option
143
         */
144
         
145
        /** TODO:Empty Trash
146
         * > select a file
147
         * > select File > 'Empty Trash' 
148
         * *** Notice: There is no confirmation before performing this action
149
         */
150
           
151

    
152
        /** TODO:. Refresh
153
         * > select a file
154
         * > select File > 'Refresh'
155
         */
156
        
157
        /**
158
         * TODO: . Cut file
159
         * > select a file
160
         * > select Edit > 'Cut'
161
         * > select a destination folder
162
         * > click Edit > Paste on the destination folder 
163
         */
164
        
165
        /** TODO: . Copy file
166
         * > select a file
167
         * > select Edit > 'Copy'
168
         * > select a destination folder
169
         * > click Edit > 'Paste' on the destination folder
170
         * 
171
         */
172
           
173
        /** TODO: . Move to Trash
174
         * > select a file
175
         * > select Edit > 'Move to Trash'
176
         * > select Trash folder and your file is in the Trash
177
         */
178
        /**. Delete
179
         * > select a file
180
         * > select Edit > 'Move to Trash'
181
         * > click Delete to confirm
182
         * */
183

    
184
        /** TODO:. Select All
185
         * > select a file
186
         * > select Edit > 'Select All' this action results to select all files that are inside home folder
187
         */
188
           
189
        /** TODO:. Unselect All
190
         * > select a file
191
         * > select Edit > 'Unselect All'     this action results to unselect all files that are inside home folder
192
         */
193

    
194
}