void createDownloadLink(String[] link, boolean forceDownload) {
String downloadURL = getDownloadURL();
if (!downloadURL.isEmpty()) {
- link[0] = "<a class='hidden-link' href='" + downloadURL
+ link[0] = "<a id ='topMenu.file.download' class='hidden-link' href='" + downloadURL
+ (forceDownload ? "&dl=1" : "") + "' target='_blank'>";
link[1] = "</a>";
}
contextMenu.addItem(newFolderItem);
}
if(uploadVisible){
- MenuItem uploadItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
- uploadItem.getElement().setId("topMenu.file.upload");
+ MenuItem uploadItem = new MenuItem("<span id='topMenu.file.upload'>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
contextMenu.addItem(uploadItem);
}
if (downloadVisible) {
MenuItem downloadItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
contextMenu.addItem(downloadItem);
- downloadItem.getElement().setId("topMenu.file.download");
createDownloadLink(link, true);
- MenuItem saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
- saveAsItem.getElement().setId("topMenu.file.saveAs");
+ MenuItem saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(images.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
contextMenu.addItem(saveAsItem);
}
MenuItem emptyTrashItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + " Empty Trash</span>", true, new EmptyTrashCommand(this));
final HorizontalPanel vPanel2 = new HorizontalPanel();\r
\r
versioned.setValue(file.isVersioned());\r
- versioned.getElement().setId("filePropertiesDialog.versioned");\r
+ versioned.getElement().setId("filePropertiesDialog.chechBox.versioned");\r
inner.add(generalPanel, "General");\r
inner.add(permPanel, "Sharing");\r
inner.add(verPanel, "Versions");\r
generalTable.setText(4, 0, "Tags");\r
name.setWidth("100%");\r
name.setText(file.getName());\r
+ name.getElement().setId("filePropertiesDialog.textBox.name");\r
generalTable.setWidget(0, 1, name);\r
name.addChangeHandler(new ChangeHandler() {\r
\r
tagsBuffer.delete(tagsBuffer.length() - 2, tagsBuffer.length() - 1);\r
initialTagText = tagsBuffer.toString();\r
tags.setWidth("100%");\r
+ tags.getElement().setId("filePropertiesDialog.textBox.tags");\r
tags.setText(initialTagText);\r
generalTable.setWidget(4, 1, tags);\r
generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");\r
} \r
}\r
});\r
+ ok.getElement().setId("filePropertiesDialog.button.ok"); \r
buttons.add(ok);\r
buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);\r
// Create the 'Cancel' button, along with a listener that hides the\r
closeDialog();\r
}\r
});\r
+ cancel.getElement().setId("filePropertiesDialog.button.cancel");\r
buttons.add(cancel);\r
buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);\r
buttons.setSpacing(8);\r
dlg.center();\r
}\r
});\r
+ add.getElement().setId("filePropertiesDialog.button.addGroup");\r
permButtons.add(add);\r
permButtons.setCellHorizontalAlignment(add, HasHorizontalAlignment.ALIGN_CENTER);\r
\r
dlg.center();\r
}\r
});\r
+ add.getElement().setId("filePropertiesDialog.button.addUser");\r
permButtons.add(addUser);\r
permButtons.setCellHorizontalAlignment(addUser, HasHorizontalAlignment.ALIGN_CENTER);\r
\r
readForAllNote.setStylePrimaryName("gss-readForAllNote");\r
\r
readForAll = new CheckBox();\r
+ readForAll.getElement().setId("filePropertiesDialog.checkBox.public");\r
readForAll.setValue(file.isReadForAll());\r
readForAll.addClickHandler(new ClickHandler() {\r
@Override\r
\r
});\r
path.setText(file.getUri());\r
+ path.getElement().setId("filePropertiesDialog.textBox.link");\r
path.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)");\r
path.setWidth("100%");\r
path.setReadOnly(true);\r
HorizontalPanel fileUloadPanel = new HorizontalPanel();
fileUloadPanel.add(filenameLabel);
fileUloadPanel.add(upload);
+ upload.getElement().setId("fileUploadDiallog.uploadPanel");
Grid generalTable = new Grid(2, 2);
generalTable.setText(0, 0, "Folder");
generalTable.setText(1, 0, "File");
prepareAndSubmit();
}
});
+ submit.getElement().setId("fileUploadDialog.button.upload");
buttons.add(submit);
buttons.setCellHorizontalAlignment(submit, HasHorizontalAlignment.ALIGN_CENTER);
// Create the 'Cancel' button, along with a listener that hides the
hide();
}
});
+ cancel.getElement().setId("fileUploadDialog.button.cancel");
buttons.add(cancel);
buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
buttons.setSpacing(8);
package gr.ebs.gss.client.selenium.tests;
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+
import org.openqa.selenium.By;
public class FileUtils extends GeneralPurposeUtils{
- public void clickAFile(String aFileName){
- action.click(By.id("fileList."+ aFileName));
- }
-
public void rightClickOnFile(String aFileName){
action.sendRightClick(By.id("fileList." + aFileName));
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
- *
- */
-
- public void downloadFile() throws InterruptedException{
+
+ public void downloadFile() throws InterruptedException, AWTException{
selectTopMenu("file");
Thread.sleep(1000);
selectAnOptionInTopMenu("file","download");
- selectConfirmation("ok");
+ /**
+ * TODO: Solve the problem of not opening the dialog boxes
+ */
+ Thread.sleep(3000);
+ Robot robot = new Robot();
+ //Alt + S to select save
+ robot.keyPress(KeyEvent.VK_ALT);
+ robot.keyPress(KeyEvent.VK_S);
+ robot.keyRelease(KeyEvent.VK_ALT);
+ System.out.println("window = " + driver.getWindowHandle());
+ Thread.sleep(3000);
+ //Then press enter
+ robot.keyPress(KeyEvent.VK_ENTER);
+
+ // and save the file in the indicated location
+ // using Alt + S
+ robot.keyPress(KeyEvent.VK_ALT);
+ robot.keyPress(KeyEvent.VK_S);
+ robot.keyPress(KeyEvent.VK_S);
+ robot.keyRelease(KeyEvent.VK_ALT);
+
+
+
+ Thread.sleep(3000);
+ //TODO: confirm download - how??
}
- /** TODO: Save As Assert
+ /**
* This action performs the same results to the above 'Download' option
*/
selectAnOptionInTopMenu("file","saveAs");
+ //TODO: confirm save As - how??
+
}
- /**
- * TODO: assert somehow
- * @param aUserName
- * @param aFolderName
- * @param aFileName
- */
+
public void refreshFile(String aUserName, String aFolderName, String aFileName){
selectFolderBelowHome(aUserName, aFolderName);
- clickAFile(aFileName);
+ selectFile(aFileName);
//Click top edit menu
selectTopMenu("file");
//Click move to trash option
selectAnOptionInTopMenu("file","refresh");
+ //TODO: confirm refresh
+
}
- /**
- * TODO: . Cut file
- * > select a file
- * > select Edit > 'Cut'
- * > select a destination folder
- * > click Edit > Paste on the destination folder
- */
public void cutFile(String aFileName){
//Click a file
- clickAFile(aFileName);
+ selectFile(aFileName);
//Click the top file menu
selectTopMenu("edit");
}
- /** TODO: . Copy file
- * > select a file
- * > select Edit > 'Copy'
- * > select a destination folder
- * > click Edit > 'Paste' on the destination folder
- *
- */
public void copyFile(String aFileName){
//Click a file
- clickAFile(aFileName);
+ selectFile(aFileName);
//Click the top file menu
selectTopMenu("edit");
*/
public void pasteFile(String aUserName, String aFolderDestination, String aFileName){
//Click a file
- clickAFile(aFileName);
+ selectFile(aFileName);
//Click on the folder destination which is below home folder
selectFolderBelowHome(aUserName, aFolderDestination);
//Click the New Folder option from the file menu
selectAnOptionInTopMenu("edit","paste");
+ /**
+ * TODO: expand the folder that paste option was performed
+ * and confirm the existence of the file
+ */
+
}
-
- /** TODO: . Move to Trash
- * > select a file
- * > select Edit > 'Move to Trash'
- * > select Trash folder and your file is in the Trash
- */
-
+
public void moveToTrashFile(String aFileName){
//Click a file
- clickAFile(aFileName);
+ selectFile(aFileName);
//Click the top file menu
selectTopMenu("edit");
//Click the New Folder option from the file menu
selectAnOptionInTopMenu("edit","moveToTrash");
+
+ /**
+ * TODO: expand Trash and confirm the existence of the file
+ */
}
- /**. Delete
- * > select a file
- * > select Edit > 'Move to Trash'
- * > click Delete to confirm
- * */
public void deleteFile(String aFileName) throws InterruptedException{
- clickAFile(aFileName);
+ selectFile(aFileName);
selectTopMenu("edit");
//Click ok button in the confirmation dialog box
selectConfirmation("ok");
+
+ /**
+ * TODO: assert deletion
+ */
}
-
- /** TODO:. Select All
- * > select a file
- * > select Edit > 'Select All' this action results to select all files that are inside home folder
- */
+
public void selectAllFile(String aFileName) throws InterruptedException{
- clickAFile(aFileName);
+ selectFile(aFileName);
selectTopMenu("edit");
selectAnOptionInTopMenu("edit","selectAll");
Thread.sleep(1000);
+ /**
+ * TODO: assert
+ */
+
}
- /** TODO:. Unselect All
- * > select a file
- * > select Edit > 'Unselect All' this action results to unselect all files that are inside home folder
- */
public void unSelectAllFile(String aFileName) throws InterruptedException{
- clickAFile(aFileName);
+ selectFile(aFileName);
selectTopMenu("edit");
selectAnOptionInTopMenu("edit","unSelectAll");
Thread.sleep(1000);
+ /**
+ * TODO: assert
+ */
}
}
*/
package gr.ebs.gss.client.selenium.tests;
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+
+import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
}
//TODO: upload file to a folder
- public void upload(){
+ public void upload() throws AWTException{
+ action.click(By.id("fileUploadDiallog.uploadPanel"));
+
+ Robot robot = new Robot();
+ robot.keyPress(KeyEvent.VK_ALT);
+ robot.keyPress(KeyEvent.VK_S);
+ robot.keyRelease(KeyEvent.VK_ALT);
+
+ //<button type="button" class="gwt-Button">Browse...</button>
+
+ /**
+ * /home/Desktop/links.txt
+ */
+
+ }
+ @Test
+ public void testUpload() throws InterruptedException{
+ selectFolderBelowHome(userName, folderName);
+ selectTopMenu("file");
+ Thread.sleep(1000);
+ selectAnOptionInTopMenu("file","upload");
+ action.click(By.id("fileUploadDiallog.uploadPanel"));
+ Thread.sleep(5000);
}
public String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
- public String fileName = "darth_vader.jpg";
+ public String fileName = "anakin.jpg";
+
+ public String newFileName = "darth_vader.jpg";
+
+ public String fileToDownload = "David Bowie - All the Young Dudes.mp3";
public String groupName = "Wookiees";
}
- public void selectConfirmation(String anOption){
-
+ public void selectConfirmation(String anOption){
action.click(By.id("confirmation."+ anOption));
}
Thread.sleep(1000);
selectAnOptionInTopMenu("file","emptyTrash");
-
}
-
+
+ public void selectFile(String aFileName){
+ action.click(By.id("fileList."+ aFileName));
+ }
+
}
package gr.ebs.gss.client.selenium.tests;
+import java.awt.AWTException;
+
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
public class TestFileBasics extends FileUtils{
- @Test
+// @Test
public void testClickAFile(){
selectFolderBelowHome(userName, folderName);
- clickAFile(fileName);
+ selectFile(fileName);
rightClickOnFile(fileName);
selectFileContextMenuOption("refresh");
}
- @Test
+// @Test
public void testRightClickOnFile() throws InterruptedException{
/**
* Q: The "onchange" event doesn't fire after a call "sendKeys"
}
+ @Test
+ public void testDownloadFile() throws InterruptedException, AWTException{
+ selectFolderBelowHome(userName, folderName);
+ Thread.sleep(1000);
+ selectFile(fileToDownload);
+ Thread.sleep(1000);
+ downloadFile();
+ Thread.sleep(3000);
+ }
+
+ public void testFileProperties() throws InterruptedException{
+ selectFolderBelowHome(userName, folderName);
+ Thread.sleep(1000);
+ selectFile(fileToDownload);
+ Thread.sleep(1000);
+
+ selectTopMenu("file");
+ Thread.sleep(1000);
+ selectAnOptionInTopMenu("file","properties");
+ }
}
*/
package gr.ebs.gss.client.selenium.tests;
+import org.openqa.selenium.By;
+import org.junit.Test;
-
-
-/**
- * @author natasa
- *
- */
public class TestFileProperties extends TestFileBasics{
- /** TODO:. Rename a file
- * > select a file
- * > select File > 'Properties'
- * > type a new file name in the Name input box
- * > click 'Ok'
- */
+ public void renameFile() throws InterruptedException{
+ action.click(By.id("filePropertiesDialog.textBox.name"));
+ Thread.sleep(1000);
+ action.type(By.id("filePropertiesDialog.textBox.name"), fileToDownload);
+ Thread.sleep(2000);
+ action.click(By.id("filePropertiesDialog.button.ok"));
+
+ }
+
+
+// @Test
+ public void testRenameFile() throws InterruptedException{
+
+ selectFolderBelowHome(userName, folderName);
+ Thread.sleep(1000);
+ selectFile(fileName);
+ Thread.sleep(1000);
+ selectTopMenu("file");
+ Thread.sleep(1000);
+ selectAnOptionInTopMenu("file", "properties");
+ Thread.sleep(1000);
+ renameFile();
+
+ //TODO:assert new name
+ }
/** TODO:. Add a Tag to a file
* > select a file