Since WebDriver instance is common for both FileUtils and FolderUtils a new class...
[pithos] / test / gr / ebs / gss / client / selenium / tests / TestFolderSharing.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.tests;
20
21
22 import org.junit.Test;
23 import org.openqa.selenium.By;
24
25
26
27 public class TestFolderSharing extends TestFolderBasics {
28         
29
30         
31         @Test
32         protected void testAddGroupToPermissionFolder() throws InterruptedException{
33                 
34                 //Click sharing option for the folder @folderName
35                 clickFolderSharing(userName, folderName);
36                 
37                 //Click the "Add Group" option in the FolderProperties dialog box
38                 action.click(By.id("folderPropertiesDialog.button.addGroup"));
39                 
40                 //Select from drop down menu the preferred group
41                 //TODO: add an id in the elements in the dropDown menu in order this click in the droppDown to work
42 //              action.click(By.id("addPermission.dropDown"));
43                 
44                 //Add a read permission to the group
45                 action.click(By.id("addPermission.read"));
46                 
47                 //Press OK
48                 action.click(By.id("addPermission.button.ok"));
49                 
50                 //Press ok to close the dialog box
51                 
52                 //Assert that the group name you added permission to is displayed to the permissions table
53                 action.click(By.id("permissionsList.Wookiees"));
54                 
55         }
56         /**
57          * TODO: Share a folder to a user
58          * > select a folder
59          * > select File > 'Sharing'
60          * > click Add User
61          * > Type a valid username (a full version e.g john@doe.com)
62          * > Add permissions to the selected user
63          * > click OK
64          * > click Update
65          */
66 //      @Test
67         protected void testAddUserToPermissionFolder() throws InterruptedException{
68                 
69                 //Click sharing option for the folder @folderName
70                 clickFolderSharing(userName, folderName);
71                 
72                 //Click the "Add User" option in the FolderProperties dialog box
73                 action.click(By.id("folderPropertiesDialog.button.addUser"));
74                 
75                 //type the username in the input textBox
76                 action.type(By.id("addPermission.textBox"), addUserName);
77                 
78                 //Add a read permission to the group
79                 //TODO: this should be toggle :(
80                 action.click(By.id("addPermission.read"));
81                 
82                 //Press OK
83                 action.click(By.id("addPermission.button.ok"));
84                 
85                 //Press ok to close the dialog box
86                 
87                 //Assert that the group name you added permission to is displayed to the permissions table
88                 action.click(By.id("permissionsList." + addUserName));
89                 
90                 //folderPropertiesDialog.button.ok
91                 
92         }
93         
94         /**
95          * TODO: . Make a folder public for all
96          * > select a folder
97          * > select File > 'Sharing'
98          * > check 'Public' check box
99          * > click OK
100          * > click Update
101          */
102                 
103 //      @Test
104         protected void testMakePublicFolder() throws InterruptedException{
105                 
106                 //Click sharing option for the folder @folderName
107                 clickFolderSharing(userName, folderName);
108                 
109                 //Click the "Public" checkBox
110                 //TODO: this should be toggle :(
111                 action.click(By.id("folderPropertiesDialog.checkBox.public"));
112                 
113                 //Press OK
114                 action.click(By.id("folderPropertiesDialog.button.ok"));
115                                 
116                 /**
117                  * TODO: Check public link validity
118                  * > select a folder
119                  * > select File > 'Sharing'
120                  * > Select pubic link
121                  * > click Cancel
122                  * > Open a new browser with the above copied link
123                  */
124                 
125         }
126         
127
128 }