recover admin interface
[pithos] / test / gr / ebs / gss / client / selenium / webDriver / NewFolder.java
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.webDriver;
20
21
22
23 import org.apache.commons.logging.Log;
24 import org.apache.commons.logging.LogFactory;
25 import org.openqa.selenium.By;
26 import org.openqa.selenium.WebDriver;
27
28
29
30 public class NewFolder {
31                 
32         private static Log logger = LogFactory.getLog(NewFolder.class);
33         
34         private ActionFactory action;
35         
36         String folderName;
37         
38         /**
39          * @param aDriver
40          */
41         public NewFolder(ActionFactory anAction, WebDriver aDriver){
42                 action = anAction;
43                 action = new ActionFactory(aDriver);            
44         }
45         
46         public void makeNewFolder(String aFolderName){
47                 
48                 try{
49                         //Click the home folder
50                         action.click(By.id("past@ebs.gr"));
51                                         
52                         //Click the top file menu
53                         action.click(By.id("topMenu.file"));                    
54                         
55                         //Click the New Folder option from the file menu
56                         action.click(By.id("topMenu.file.newFolder"));
57                                                 
58                         //In the popup dialog click on the Name textBox and type the folder name                
59                         action.type(By.id("folderPropertiesDialog.textBox.name"), aFolderName);
60                         
61                         //Submit 
62                         action.click(By.id("folderPropertiesDialog.button.ok"));
63                         
64                 }catch(Exception e){
65                         logger.debug("The creation of a new folder didn't succeeded");
66                         e.printStackTrace();
67                 }
68         }
69         
70         public String checkNewFolder(String aFolderName){
71                 String res = action.getText(By.id("past@ebs.gr." + aFolderName));
72                 if(res == null){
73                         return ("Creation of the folder " + aFolderName + "FAILED!!");
74                 }
75                 return ("SUCCESSful creation of " + res);
76                 
77         }
78         
79         public void quit(){
80                 action.quit();          
81         }
82
83 }