Ejemplo n.º 1
0
  @AfterMethod(alwaysRun = true)
  public void afterMethod() throws HarnessException {
    logger.info("Checking for the Move Dialog ...");

    // Check if the "Move Dialog is still open
    DialogMove dialog = new DialogMove(app, ((AppAjaxClient) app).zPageBriefcase);
    if (dialog.zIsActive()) {
      logger.warn(dialog.myPageName() + " was still active.  Cancelling ...");
      dialog.zClickButton(Button.B_CANCEL);
    }

    // This step is necessary because next test may be uploading the same
    // file
    // if account is not reset, ZCS will be confused, and the next
    // uploaded file
    // will be deleted per previous command.
    ZimbraAccount.ResetAccountZWC();
  }
Ejemplo n.º 2
0
  @Test(
      description = "Upload file through RestUtil - move & verify through GUI",
      groups = {"smoke"})
  public void MoveFile_01() throws HarnessException {
    ZimbraAccount account = app.zGetActiveAccount();

    FolderItem folderItem = FolderItem.importFromSOAP(account, SystemFolder.Briefcase);

    String name = "folder" + ZimbraSeleniumProperties.getUniqueString();

    // Create a subfolder to move the message into i.e. Briefcase/subfolder
    String briefcaseFolderId = folderItem.getId();

    account.soapSend(
        "<CreateFolderRequest xmlns='urn:zimbraMail'>"
            + "<folder name='"
            + name
            + "' l='"
            + briefcaseFolderId
            + "'/>"
            + "</CreateFolderRequest>");

    FolderItem subFolder = FolderItem.importFromSOAP(account, name);

    // refresh briefcase page
    app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, folderItem, true);

    // Click on created subfolder
    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());
    app.zPageBriefcase.zWaitForDesktopLoadingSpinner(5000);
    app.zPageBriefcase.zListItem(Action.A_LEFTCLICK, subFolder);

    // Create file item
    String filePath = ZimbraSeleniumProperties.getBaseDirectory() + "/data/public/other/putty.log";

    FileItem fileItem = new FileItem(filePath);

    // Upload file to server through RestUtil
    String attachmentId = account.uploadFile(filePath);

    // Save uploaded file to briefcase through SOAP
    account.soapSend(
        "<SaveDocumentRequest xmlns='urn:zimbraMail'>"
            + "<doc l='"
            + folderItem.getId()
            + "'>"
            + "<upload id='"
            + attachmentId
            + "'/>"
            + "</doc>"
            + "</SaveDocumentRequest>");

    // account.soapSelectNode("//mail:SaveDocumentResponse", 1);

    GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());
    app.zPageBriefcase.zWaitForDesktopLoadingSpinner(5000);

    // refresh briefcase page
    app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, folderItem, true);

    // Click on created document
    app.zPageBriefcase.zListItem(Action.A_LEFTCLICK, fileItem);

    // Click on Move selected item icon in toolbar
    DialogMove chooseFolder =
        (DialogMove) app.zPageBriefcase.zToolbarPressButton(Button.B_MOVE, fileItem);

    // Click OK on Confirmation dialog
    chooseFolder.zClickTreeFolder(subFolder);
    chooseFolder.zClickButton(Button.B_OK);

    // refresh briefcase page
    app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, folderItem, false);

    // Verify document was moved from the folder
    ZAssert.assertFalse(
        app.zPageBriefcase.isPresentInListView(fileItem.getName()),
        "Verify document was moved from the folder");

    // click on subfolder in tree view
    app.zTreeBriefcase.zTreeItem(Action.A_LEFTCLICK, subFolder, true);

    // Verify document was moved to the selected folder
    boolean present = app.zPageBriefcase.isPresentInListView(fileItem.getName());

    ZAssert.assertTrue(present, "Verify document was moved to the selected folder");
  }