GSS.get().getSearchResults().clearSelectedRows();
}
};
- cutItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
+ cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
cutItem.getElement().setId("fileContextMenu.cut");
copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
contextMenu.addItem(trashItem);
contextMenu.addItem(deleteItem);
- MenuItem refresh = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
- refresh.getElement().setId("fileContextMenu.refresh");
+ MenuItem refresh = new MenuItem("<span id='fileContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+// refresh.getElement().setId("fileContextMenu.refresh");
contextMenu.addItem(refresh);
contextMenu.addItem(sharingItem);
images = newImages;
pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
+ pasteItem.getElement().setId("folderContextMenu.paste");
MenuBar contextMenu = new MenuBar(true);
\r
import java.util.List;\r
\r
+import com.gargoylesoftware.htmlunit.javascript.host.KeyboardEvent;\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.dom.client.NativeEvent;\r
import com.google.gwt.event.dom.client.ContextMenuEvent;\r
sinkEvents(Event.ONCONTEXTMENU);\r
sinkEvents(Event.ONMOUSEUP);\r
sinkEvents(Event.ONDBLCLICK);\r
+ sinkEvents(Event.KEYEVENTS);\r
}\r
\r
\r
* @return the resultant HTML\r
*/\r
private HTML imageItemHTML(final ImageResource imageProto, final String title,final TreeItem item) {\r
- final HTML link = new HTML("<a id='groupsList."+title+"' class='hidden-link' href='javascript:;'>" + "<span>" + AbstractImagePrototype.create(imageProto).getHTML() + " " + title + "</span>" + "</a>"){\r
+ final HTML link = new HTML("<a class='hidden-link' href='javascript:;'>" + "<span id='groupsList."+title+"'>" + AbstractImagePrototype.create(imageProto).getHTML() + " " + title + "</span>" + "</a>"){\r
@Override\r
public void onBrowserEvent(Event event) {\r
switch (DOM.eventGetType(event)) {\r
super.onBrowserEvent(event);\r
\r
}\r
- }; \r
+ }; \r
link.sinkEvents(Event.ONMOUSEDOWN);\r
link.sinkEvents(Event.ONCONTEXTMENU);\r
link.sinkEvents(Event.ONCLICK);\r
- link.sinkEvents(Event.ONKEYDOWN);\r
+ link.sinkEvents(Event.ONKEYDOWN); \r
return link;\r
}\r
\r
--- /dev/null
+/*
+ * Copyright 2011 Electronic Business Systems Ltd.
+ *
+ * This file is part of GSS.
+ *
+ * GSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package gr.ebs.gss.client.selenium.file;
+
+import gr.ebs.gss.client.selenium.folder.ActionUtils;
+import gr.ebs.gss.client.selenium.folder.FolderUtils;
+
+import org.junit.After;
+import org.junit.Before;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+
+
+public class FileUtils {
+
+ protected ActionUtils action;
+
+ protected WebDriver driver;
+
+ protected String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
+
+ protected String fileName = "darth_vader.jpg";
+
+ protected String groupName = "Wookiees";
+
+ protected String userName = "lakis@ebs.gr";
+
+ protected String addUserName = "past@ebs.gr";
+
+
+ protected String folderName = "Alderaan";
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+
+ driver = new FirefoxDriver();
+
+ action = new ActionUtils(driver);
+
+ action.getUrl(url);
+
+ // Necessary delay in order all dom elements to be created
+ Thread.sleep(3000);
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+ action.quit();
+ }
+
+ protected void clickAFile(String aFileName){
+ action.click(By.id("fileList."+ aFileName));
+ }
+
+ protected void selectFileMenu() {
+ //Click the top file menu
+ action.click(By.id("topMenu.file"));
+
+ }
+
+ protected void selectAnOptionFromFileMenu(String anOption) {
+
+ //Click the New Folder option from the file menu
+ action.click(By.id("topMenu.file."+ anOption));
+
+ }
+
+ protected void selectAnOptionFromEditMenu(String anOption) {
+
+ //Click the New Folder option from the file menu
+ action.click(By.id("topMenu.edit."+ anOption));
+
+ }
+
+ protected void selectConfirmation(String anOption){
+
+ action.click(By.id("confirmation."+ anOption));
+
+ }
+
+ /**
+ * TODO: Check what's going on with the method scope in the FolderUtils
+ *
+ * @param aUserName
+ * @param aFolderName
+ */
+ public void selectFolderBelowHome(String aUserName, String aFolderName){
+ action.click(By.id(aUserName+ "." + aFolderName));
+ }
+
+ protected void rightClickOnFile(String aFileName){
+ action.sendRightClick(By.id("fileList." + aFileName));
+
+ }
+
+ protected void selectFileContextMenuOption(String anOption){
+ action.click(By.id("fileContextMenu." + anOption));
+ }
+
+
+ /**
+ * TODO: Download a file below in a folder
+ * > select a file
+ * > select File > 'Download'
+ * > save file from the popup window to your hdd
+ *
+ */
+
+ protected void download() throws InterruptedException{
+ selectFileMenu();
+
+ Thread.sleep(1000);
+
+ selectAnOptionFromFileMenu("download");
+
+ selectConfirmation("ok");
+ }
+
+
+ /** TODO: Save As
+ * **** This action performs the same results to the above 'Download' option
+ */
+
+ /** TODO:Empty Trash
+ * > select a file
+ * > select File > 'Empty Trash'
+ * *** Notice: There is no confirmation before performing this action
+ */
+
+
+ /** TODO:. Refresh
+ * > select a file
+ * > select File > 'Refresh'
+ */
+
+ /**
+ * TODO: . Cut file
+ * > select a file
+ * > select Edit > 'Cut'
+ * > select a destination folder
+ * > click Edit > Paste on the destination folder
+ */
+
+ /** TODO: . Copy file
+ * > select a file
+ * > select Edit > 'Copy'
+ * > select a destination folder
+ * > click Edit > 'Paste' on the destination folder
+ *
+ */
+
+ /** TODO: . Move to Trash
+ * > select a file
+ * > select Edit > 'Move to Trash'
+ * > select Trash folder and your file is in the Trash
+ */
+ /**. Delete
+ * > select a file
+ * > select Edit > 'Move to Trash'
+ * > click Delete to confirm
+ * */
+
+ /** TODO:. Select All
+ * > select a file
+ * > select Edit > 'Select All' this action results to select all files that are inside home folder
+ */
+
+ /** TODO:. Unselect All
+ * > select a file
+ * > select Edit > 'Unselect All' this action results to unselect all files that are inside home folder
+ */
+
+}
*/
package gr.ebs.gss.client.selenium.file;
+import org.junit.Test;
-import gr.ebs.gss.client.selenium.folder.ActionUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.firefox.FirefoxDriver;
-/**
- * @author natasa
- *
- */
-public class TestFileBasics {
-
- ActionUtils action;
-
- WebDriver driver;
-
- String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
-
- String fileName = "";
+public class TestFileBasics extends FileUtils{
- String groupName = "Wookiees";
-
- String userName = "past@ebs.gr";
-
- String addUserName = "lakis@ebs.gr";
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
-
- driver = new FirefoxDriver();
-
- action = new ActionUtils(driver);
+ @Test
+ public void testClickAFile(){
+ selectFolderBelowHome(userName, folderName);
+ clickAFile(fileName);
- action.getUrl(url);
-
- // Necessary delay in order all dom elements to be created
- Thread.sleep(3000);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- action.quit();
- }
-
- public void clickAFile(String aFileName){
- action.click(By.id(""));
- }
- public void selectFileMenu(){
+ rightClickOnFile(fileName);
+ selectFileContextMenuOption("refresh");
}
- /**
- * TODO: Download a file below in a folder
- * > select a file
- * > select File > 'Download'
- * > save file from the popup window to your hdd
- *
- */
- /** TODO: Save As
- * **** This action performs the same results to the above 'Download' option
- */
-
- /** TODO:Empty Trash
- * > select a file
- * > select File > 'Empty Trash'
- * *** Notice: There is no confirmation before performing this action
- */
-
-
- /** TODO:. Refresh
- * > select a file
- * > select File > 'Refresh'
- */
-
- /**
- * TODO: . Cut file
- * > select a file
- * > select Edit > 'Cut'
- * > select a destination folder
- * > click Edit > Paste on the destination folder
- */
-
- /** TODO: . Copy file
- * > select a file
- * > select Edit > 'Copy'
- * > select a destination folder
- * > click Edit > 'Paste' on the destination folder
- *
- */
-
- /** TODO: . Move to Trash
- * > select a file
- * > select Edit > 'Move to Trash'
- * > select Trash folder and your file is in the Trash
- */
- /**. Delete
- * > select a file
- * > select Edit > 'Move to Trash'
- * > click Delete to confirm
- * */
-
- /** TODO:. Select All
- * > select a file
- * > select Edit > 'Select All' this action results to select all files that are inside home folder
- */
-
- /** TODO:. Unselect All
- * > select a file
- * > select Edit > 'Unselect All' this action results to unselect all files that are inside home folder
- */
-
}
--- /dev/null
+/*
+ * Copyright 2011 Electronic Business Systems Ltd.
+ *
+ * This file is part of GSS.
+ *
+ * GSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package gr.ebs.gss.client.selenium.folder;
+
+import org.junit.After;
+import org.junit.Before;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+
+
+
+/**
+ * @author natasa
+ *
+ */
+public class FolderUtils {
+
+ public ActionUtils action;
+
+ public WebDriver driver;
+
+ protected String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
+
+ public String folderName = "Alderaan";
+
+ public String userName = "lakis@ebs.gr";
+ //"past@ebs.gr";
+
+ protected String folderDestination = "Naboo";
+
+ protected String newFolderName = "Mustafar";
+
+ /**
+ * Initialize the driver, the actionUtils, the application's url
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+
+ driver = new FirefoxDriver();
+
+ action = new ActionUtils(driver);
+
+ action.getUrl(url);
+
+ // Necessary delay in order all dom elements to be created
+ Thread.sleep(3000);
+ }
+
+ /**
+ * Quit the driver
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ action.quit();
+ }
+
+ /**
+ * Select the user's home folder
+ *
+ * @param aUserName
+ */
+ protected void selectHomeFolder(String aUserName){
+ action.click(By.id(aUserName));
+ }
+
+ /**
+ * Select any folder below the user's home folder
+ *
+ * @param aUserName
+ * @param aFolderName
+ */
+ public void selectFolderBelowHome(String aUserName, String aFolderName){
+ action.click(By.id(aUserName+ "." + aFolderName));
+ }
+
+ /**
+ * Select the Trash folder
+ */
+ protected void selectTrash(){
+ action.click(By.id("Trash"));
+ }
+
+ /**
+ * Select the My Shared folder
+ */
+ protected void selectMyShared(){
+ action.click(By.id("My Shared"));
+ }
+
+ /**
+ * Select the Other's Shared folder
+ */
+ protected void selectOthersShared(){
+ action.click(By.id("others"));
+ }
+
+ protected void expandTree(){
+// ERROR: Compound class names are not supported. Consider searching for one class name and filtering the results.
+// action.click(By.className("GK31MSKBDF GK31MSKBLF"));
+// action.click(By.xpath("//span[@id='Trash']/../../.."));
+// action.click(By.xpath("//div[@id='']/img"));
+// action.click(By.xpath("//span[@id='Trash']/.."));
+// action.click(By.xpath("ancestor:://span[@id='Trash']"));// Error not legal expression
+// action.click(By.xpath("//div[@class='GK31MSKBCF GK31MSKBKF gwtQuery-draggable gwtQuery-droppable']"));
+ action.click(By.xpath("/html/body/table/tbody/tr[4]/td/div/div/div/div/div/div/div/div[2]/div/div"));
+ //selenium.click("//*/img[contains(@src,'telpfeil.gif')]");
+// return action.clickAndSendText(By.xpath("//span[@id='Trash']/.."));
+
+ }
+
+
+ /**
+ * Create a new folder under the root folder
+ * @param aFolderName
+ * @throws InterruptedException
+ */
+ protected void makeNewFolder(String aUserName, String aFolderName) throws InterruptedException{
+ //Click the home folder
+ selectHomeFolder(aUserName);
+
+ //Click the top file menu
+ action.click(By.id("topMenu.file"));
+
+ Thread.sleep(1000);
+
+ //Click the New Folder option from the file menu
+ action.click(By.id("topMenu.file.newFolder"));
+
+ Thread.sleep(1000);
+
+ //In the popup dialog click on the Name textBox and type the folder name
+ action.type(By.id("folderPropertiesDialog.textBox.name"), aFolderName);
+
+ //Submit
+ action.click(By.id("folderPropertiesDialog.button.ok"));
+
+ }
+
+ /**
+ * Delete a folder with the given folderName
+ * that lies below the root folder
+ *
+ * @param aFolderName
+ * @throws InterruptedException
+ */
+ protected void deleteFolder(String aUserName, String aFolderName) throws InterruptedException{
+ //Click the home folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ //Click top edit menu
+ action.click(By.id("topMenu.edit"));
+
+
+ //Click move to trash option
+ action.click(By.id("topMenu.edit.delete"));
+ Thread.sleep(1000);
+
+ //Click ok button in the confirmation dialog box
+ action.click(By.id("confirmation.ok"));
+
+ }
+ /**
+ * Moving a folder which lies under the root folder to trash folder
+ *
+ * @param aFolderName
+ */
+ protected void moveToTrash(String aUserName, String aFolderName){
+ //Click the home folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ //Click top edit menu
+ action.click(By.id("topMenu.edit"));
+
+ //Click move to trash option
+ action.click(By.id("topMenu.edit.moveToTrash"));
+
+ }
+
+ /**
+ * Emptying the trash folder using right click action
+ *
+ * @throws InterruptedException
+ */
+ protected void emptyTrash() throws InterruptedException{
+
+ selectTrash();
+
+ Thread.sleep(1000);
+
+ action.click(By.id("topMenu.file"));
+
+ Thread.sleep(1000);
+
+ action.click(By.id("topMenu.file.emptyTrash"));
+
+ /**
+ * TODO: Examine right click on a folder
+ */
+
+// action.sendRightClick(By.id("Trash"));
+
+ //Select emptyTrash from context menu
+// action.click(By.id("folderContextMenu.emptyTrash"));
+
+ }
+
+ protected void refresh(String aUserName, String aFolderName){
+ //Click a folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ //Click top edit menu
+ action.click(By.id("topMenu.file"));
+
+ //Click move to trash option
+ action.click(By.id("topMenu.file.refresh"));
+
+ }
+
+ //TODO: upload file to a folder
+ protected void upload(){
+
+ }
+
+ /**
+ * Method that cuts a folder below home folder
+ * using the top Edit menu
+ * @param aUserName
+ */
+ protected void cutFolder(String aUserName, String aFolderName){
+
+ //Click a folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ //Click the top file menu
+ action.click(By.id("topMenu.edit"));
+
+ //Click the New Folder option from the file menu
+ action.click(By.id("topMenu.edit.cut"));
+
+ }
+
+ /**
+ * Method that copies a folder name
+ * @param aUserName
+ * @param aFolderName
+ */
+ protected void copy(String aUserName, String aFolderName){
+ //Click a folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ //Click the top file menu
+ action.click(By.id("topMenu.edit"));
+
+ //Click the New Folder option from the file menu
+ action.click(By.id("topMenu.edit.copy"));
+
+ }
+
+ /**
+ * Method that pastes a folder of a user using @param aUserName
+ * to a @param aFolderDestination
+ */
+ protected void paste(String aUserName, String aFolderDestination){
+ //Click on the folder destination which is below home folder
+ selectFolderBelowHome(aUserName, aFolderDestination);
+
+ //Click the top file menu
+ action.click(By.id("topMenu.edit"));
+
+ //Click the New Folder option from the file menu
+ action.click(By.id("topMenu.edit.paste"));
+ }
+
+ /**
+ * Method that clicks on the folder and the from the top menu File > Properties
+ *
+ * @param aUserName
+ * @param aFolderName
+ * @throws InterruptedException
+ */
+ protected void clickFolderProperties(String aUserName, String aFolderName) throws InterruptedException{
+ //Click on a folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ action.click(By.id("topMenu.file"));
+ Thread.sleep(1000);
+ action.click(By.id("topMenu.file.properties"));
+ Thread.sleep(1000);
+ }
+
+ /**
+ * Methods thats sends right click to the selected folder
+ * @param aUserName
+ * @param aFolderName
+ */
+
+ protected void rightClickOnFolder(String aUserName, String aFolderName){
+ //Click on a folder
+ selectFolderBelowHome(aUserName, aFolderName);
+
+ action.sendRightClick(By.id(aUserName+ "." + aFolderName));
+
+ }
+
+ protected void selectFolderContextMenuOption(String anOption){
+ action.click(By.id("folderContextMenu." + anOption));
+ }
+
+
+
+}
import org.openqa.selenium.firefox.FirefoxDriver;
-public class TestFolderBasics {
+public class TestFolderBasics extends FolderUtils{
- protected ActionUtils action;
-
- protected WebDriver driver;
-
- protected String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
-
- protected String folderName = "Alderaan";
-
- protected String userName = "past@ebs.gr";
-
- protected String folderDestination = "Naboo";
-
- private String newFolderName = "Mustafar";
-
- /**
- * Initialize the driver, the actionUtils, the application's url
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
-
- driver = new FirefoxDriver();
-
- action = new ActionUtils(driver);
-
- action.getUrl(url);
-
- // Necessary delay in order all dom elements to be created
- Thread.sleep(3000);
- }
-
- /**
- * Quit the driver
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- action.quit();
- }
-
- /**
- * Select the user's home folder
- *
- * @param aUserName
- */
- protected void selectHomeFolder(String aUserName){
- action.click(By.id(aUserName));
- }
-
- /**
- * Select any folder below the user's home folder
- *
- * @param aUserName
- * @param aFolderName
- */
- protected void selectFolderBelowHome(String aUserName, String aFolderName){
- action.click(By.id(aUserName+ "." + aFolderName));
- }
-
- /**
- * Select the Trash folder
- */
- private void selectTrash(){
- action.click(By.id("Trash"));
- }
-
- /**
- * Select the My Shared folder
- */
- private void selectMyShared(){
- action.click(By.id("My Shared"));
- }
-
- /**
- * Select the Other's Shared folder
- */
- private void selectOthersShared(){
- action.click(By.id("others"));
- }
-
- private void expandTree(){
-// ERROR: Compound class names are not supported. Consider searching for one class name and filtering the results.
-// action.click(By.className("GK31MSKBDF GK31MSKBLF"));
-// action.click(By.xpath("//span[@id='Trash']/../../.."));
-// action.click(By.xpath("//div[@id='']/img"));
-// action.click(By.xpath("//span[@id='Trash']/.."));
-// action.click(By.xpath("ancestor:://span[@id='Trash']"));// Error not legal expression
-// action.click(By.xpath("//div[@class='GK31MSKBCF GK31MSKBKF gwtQuery-draggable gwtQuery-droppable']"));
- action.click(By.xpath("/html/body/table/tbody/tr[4]/td/div/div/div/div/div/div/div/div[2]/div/div"));
- //selenium.click("//*/img[contains(@src,'telpfeil.gif')]");
-// return action.clickAndSendText(By.xpath("//span[@id='Trash']/.."));
-
- }
-
-
- /**
- * Create a new folder under the root folder
- * @param aFolderName
- * @throws InterruptedException
- */
- private void makeNewFolder(String aUserName, String aFolderName) throws InterruptedException{
- //Click the home folder
- selectHomeFolder(aUserName);
-
- //Click the top file menu
- action.click(By.id("topMenu.file"));
-
- Thread.sleep(1000);
-
- //Click the New Folder option from the file menu
- action.click(By.id("topMenu.file.newFolder"));
-
- Thread.sleep(1000);
-
- //In the popup dialog click on the Name textBox and type the folder name
- action.type(By.id("folderPropertiesDialog.textBox.name"), aFolderName);
-
- //Submit
- action.click(By.id("folderPropertiesDialog.button.ok"));
-
- }
-
- /**
- * Delete a folder with the given folderName
- * that lies below the root folder
- *
- * @param aFolderName
- */
- private void deleteFolder(String aUserName, String aFolderName){
- //Click the home folder
- selectFolderBelowHome(aUserName, aFolderName);
-
- //Click top edit menu
- action.click(By.id("topMenu.edit"));
-
-
- //Click move to trash option
- action.click(By.id("topMenu.edit.delete"));
-
- //Click ok button in the confirmation dialog box
- action.click(By.id("confirmation.ok"));
-
- }
- /**
- * Moving a folder which lies under the root folder to trash folder
- *
- * @param aFolderName
- */
- private void moveToTrash(String aUserName, String aFolderName){
- //Click the home folder
- selectFolderBelowHome(aUserName, aFolderName);
-
- //Click top edit menu
- action.click(By.id("topMenu.edit"));
-
- //Click move to trash option
- action.click(By.id("topMenu.edit.moveToTrash"));
-
- }
-
- /**
- * Emptying the trash folder using right click action
- *
- * @throws InterruptedException
- */
- private void emptyTrash() throws InterruptedException{
-
- selectTrash();
-
- action.sendRightClick(By.id("Trash"));
-
-// Thread.sleep(8000);
-
- //Select emptyTrash from context menu
- action.click(By.id("folderContextMenu.emptyTrash"));
-
- }
-
- private void refesh(String aUserName, String aFolderName){
- //Click a folder
- selectFolderBelowHome(aUserName, aFolderName);
-
- //Click top edit menu
- action.click(By.id("topMenu.file"));
-
- //Click move to trash option
- action.click(By.id("topMenu.file.refresh"));
-
- }
-
- //TODO: upload file to a folder
- private void upload(){
-
- }
-
- /**
- * Method that cuts a folder below home folder
- * using the top Edit menu
- * @param aUserName
- */
- private void cutFolder(String aUserName, String aFolderName){
-
- //Click a folder
- selectFolderBelowHome(aUserName, aFolderName);
-
- //Click the top file menu
- action.click(By.id("topMenu.edit"));
-
- //Click the New Folder option from the file menu
- action.click(By.id("topMenu.edit.cut"));
-
- }
-
- /**
- * Method that copies a folder name
- * @param aUserName
- * @param aFolderName
- */
- private void copy(String aUserName, String aFolderName){
- //Click a folder
- selectFolderBelowHome(aUserName, aFolderName);
-
- //Click the top file menu
- action.click(By.id("topMenu.edit"));
-
- //Click the New Folder option from the file menu
- action.click(By.id("topMenu.edit.copy"));
-
- }
-
- /**
- * Method that pastes a folder of a user using @param aUserName
- * to a @param aFolderDestination
- */
- private void paste(String aUserName, String aFolderDestination){
- //Click on the folder destination which is below home folder
- selectFolderBelowHome(aUserName, aFolderDestination);
-
- //Click the top file menu
- action.click(By.id("topMenu.edit"));
-
- //Click the New Folder option from the file menu
- action.click(By.id("topMenu.edit.paste"));
- }
-
- /**
- * Method that clicks on the folder and the from the top menu File > Properties
- *
- * @param aUserName
- * @param aFolderName
- * @throws InterruptedException
- */
- public void clickFolderProperties(String aUserName, String aFolderName) throws InterruptedException{
- //Click on a folder
- selectFolderBelowHome(aUserName, aFolderName);
-
- action.click(By.id("topMenu.file"));
- Thread.sleep(1000);
- action.click(By.id("topMenu.file.properties"));
- Thread.sleep(1000);
- }
+/**
+ * ---------------------------------------Tests ------------------------------------------------
+ *
+ */
-// @Test
- public void testRenameFolder() throws InterruptedException{
- //select the folder you want to rename and click Properties
- clickFolderProperties(userName, folderName);
-
- //in the input box add the new folderName
- action.type(By.id("folderPropertiesDialog.textBox.name"), newFolderName);
-
- //click OK
- action.click(By.id("folderPropertiesDialog.button.ok"));
-
- Thread.sleep(2000);
-
- Assert.assertEquals(newFolderName, action.getText(By.id("past@ebs.gr."+newFolderName)));
-
- }
-
-// @Test (expected=org.openqa.selenium.NoSuchElementException.class)
- public void testMakeNewFolderAndDelete() throws InterruptedException{
+ @Test
+ public void testMakeNewFolder() throws InterruptedException{
//Create the folder with the given folderName
makeNewFolder(userName, folderName);
+// makeNewFolder(userName, folderDestination);
//Necessary delay
Thread.sleep(2000);
-
+
+ Assert.assertEquals(folderName, action.getText(By.id(userName + "." + folderName)));
+
+ }
+
+ @Test (expected=org.openqa.selenium.NoSuchElementException.class)
+ public void deleteFolder() throws InterruptedException{
+
//Delete the folder
deleteFolder(userName, folderName);
//the test is successful if that condition fails
- Assert.assertEquals(folderName, action.getText(By.id("past@ebs.gr."+folderName)));
+ Assert.assertEquals(folderName, action.getText(By.id(userName + "." + folderName)));
}
// @Test
- public void testCreateFolderAndMoveToTrash() throws InterruptedException{
- //Create a new folder
- makeNewFolder(userName, folderName);
-
- //Necessary delay
- Thread.sleep(2000);
-
+ public void testMoveToTrash(){
+ //Select the desired folder
+ selectFolderBelowHome(userName,folderName);
+
//Move to Trash
moveToTrash(userName, folderName);
}
// @Test
- public void testCreateFolderAndMoveToTrashAndEmptyTrash() throws InterruptedException{
-
- //Create a new folder
- makeNewFolder(userName, folderName);
-
- //Necessary delay
- Thread.sleep(3000);
-
- //Move to Trash
- moveToTrash(userName, folderName);
-
+ public void testEmptyTrash() throws InterruptedException{
+
emptyTrash();
/**
}
+// @Test
+ public void testRenameFolder() throws InterruptedException{
+ //select the folder you want to rename and click Properties
+ //clickFolderProperties(userName, folderName);
+ clickFolderProperties(userName, newFolderName);
+
+ //in the input box add the new folderName
+ action.type(By.id("folderPropertiesDialog.textBox.name"), newFolderName);
+
+ //click OK
+ action.click(By.id("folderPropertiesDialog.button.ok"));
+
+ Thread.sleep(2000);
+
+ Assert.assertEquals(newFolderName, action.getText(By.id(userName + "." + newFolderName)));
+
+ }
+ /**
+ * TODO: Make it run!!!!
+ * @throws InterruptedException
+ */
+// @Test
+ public void testRightClickOnFolder() throws InterruptedException{
+ rightClickOnFolder(userName, folderName);
+
+ Thread.sleep(500);
+
+ selectFolderContextMenuOption("refresh");
+ Thread.sleep(1000);
+ }
+
}
public class TestFolderSharing extends TestFolderBasics {
- String addUserName = "lakis@ebs.gr";
+ protected String addUserName = "lakis@ebs.gr";
- public void clickFolderSharing(String aUserName, String aFolderName) throws InterruptedException{
+ protected void clickFolderSharing(String aUserName, String aFolderName) throws InterruptedException{
//Click on a folder
selectFolderBelowHome(aUserName, aFolderName);
}
@Test
- public void testAddGroupToPermissionFolder() throws InterruptedException{
+ protected void testAddGroupToPermissionFolder() throws InterruptedException{
//Click sharing option for the folder @folderName
clickFolderSharing(userName, folderName);
* > click Update
*/
// @Test
- public void testAddUserToPermissionFolder() throws InterruptedException{
+ protected void testAddUserToPermissionFolder() throws InterruptedException{
//Click sharing option for the folder @folderName
clickFolderSharing(userName, folderName);
*/
// @Test
- public void testMakePublicFolder() throws InterruptedException{
+ protected void testMakePublicFolder() throws InterruptedException{
//Click sharing option for the folder @folderName
clickFolderSharing(userName, folderName);
String groupName = "Wookiees";
- String userName = "past@ebs.gr";
+ String userName = "lakis@ebs.gr";
- String addUserName = "lakis@ebs.gr";
+ String addUserName = "past@ebs.gr";
*/
action.sendRightClick(By.id("groupsList.tree"));
-
- Thread.sleep(2000);
//select 'Delete' option from right click context menu
action.click(By.id("groupContextMenu.delete"));