/// <summary>
 /// Converts the keyboard keys to a readable string name
 /// </summary>
 /// <param name="key">Key to convert to string name</param>
 /// <returns></returns>
 private String KeyInputName(String key) {
   if (key.equals(Keys.ADD.toString())) {
     return "Add";
   } else if (key.equals(Keys.ALT.toString())) {
     return "Alt";
   } else if (key.equals(Keys.ARROW_DOWN.toString())) {
     return "ArrowDown";
   } else if (key.equals(Keys.ARROW_LEFT.toString())) {
     return "ArrowLeft";
   } else if (key.equals(Keys.ARROW_RIGHT.toString())) {
     return "ArrowRight";
   } else if (key.equals(Keys.ARROW_UP.toString())) {
     return "ArrowUp";
   } else if (key.equals(Keys.BACK_SPACE.toString())) {
     return "Backspace";
   } else if (key.equals(Keys.CANCEL.toString())) {
     return "Cancel";
   } else if (key.equals(Keys.CLEAR.toString())) {
     return "Clear";
   } else if (key.equals(Keys.COMMAND.toString())) {
     return "Command";
   } else if (key.equals(Keys.CONTROL.toString())) {
     return "Control";
   } else if (key.equals(Keys.DECIMAL.toString())) {
     return "Decimal";
   } else if (key.equals(Keys.DELETE.toString())) {
     return "Delete";
   } else if (key.equals(Keys.DIVIDE.toString())) {
     return "Divide";
   } else if (key.equals(Keys.DOWN.toString())) {
     return "Down";
   } else if (key.equals(Keys.END.toString())) {
     return "End";
   } else if (key.equals(Keys.ENTER.toString())) {
     return "Enter";
   } else if (key.equals(Keys.EQUALS.toString())) {
     return "Equal";
   } else if (key.equals(Keys.ESCAPE.toString())) {
     return "Escape";
   } else if (key.equals(Keys.F1.toString())) {
     return "F1";
   } else if (key.equals(Keys.F10.toString())) {
     return "F10";
   } else if (key.equals(Keys.F11.toString())) {
     return "F11";
   } else if (key.equals(Keys.F12.toString())) {
     return "F12";
   } else if (key.equals(Keys.F2.toString())) {
     return "F2";
   } else if (key.equals(Keys.F3.toString())) {
     return "F3";
   } else if (key.equals(Keys.F4.toString())) {
     return "F4";
   } else if (key.equals(Keys.F5.toString())) {
     return "F5";
   } else if (key.equals(Keys.F6.toString())) {
     return "F6";
   } else if (key.equals(Keys.F7.toString())) {
     return "F7";
   } else if (key.equals(Keys.F8.toString())) {
     return "F8";
   } else if (key.equals(Keys.F9.toString())) {
     return "F9";
   } else if (key.equals(Keys.HELP.toString())) {
     return "Help";
   } else if (key.equals(Keys.HOME.toString())) {
     return "Home";
   } else if (key.equals(Keys.INSERT.toString())) {
     return "Insert";
   } else if (key.equals(Keys.LEFT.toString())) {
     return "Left";
   } else if (key.equals(Keys.LEFT_ALT.toString())) {
     return "LeftAlt";
   } else if (key.equals(Keys.LEFT_CONTROL.toString())) {
     return "LeftControl";
   } else if (key.equals(Keys.LEFT_SHIFT.toString())) {
     return "LeftShift";
   } else if (key.equals(Keys.META.toString())) {
     return "Meta";
   } else if (key.equals(Keys.MULTIPLY.toString())) {
     return "Multiply";
   } else if (key.equals(Keys.NULL.toString())) {
     return "Null";
   } else if (key.equals(Keys.NUMPAD0.toString())) {
     return "NumberPad0";
   } else if (key.equals(Keys.NUMPAD1.toString())) {
     return "NumberPad1";
   } else if (key.equals(Keys.NUMPAD2.toString())) {
     return "NumberPad2";
   } else if (key.equals(Keys.NUMPAD3.toString())) {
     return "NumberPad3";
   } else if (key.equals(Keys.NUMPAD4.toString())) {
     return "NumberPad4";
   } else if (key.equals(Keys.NUMPAD5.toString())) {
     return "NumberPad5";
   } else if (key.equals(Keys.NUMPAD6.toString())) {
     return "NumberPad6";
   } else if (key.equals(Keys.NUMPAD7.toString())) {
     return "NumberPad7";
   } else if (key.equals(Keys.NUMPAD8.toString())) {
     return "NumberPad8";
   } else if (key.equals(Keys.NUMPAD9.toString())) {
     return "NumberPad9";
   } else if (key.equals(Keys.PAGE_DOWN.toString())) {
     return "PageDown";
   } else if (key.equals(Keys.PAGE_UP.toString())) {
     return "PageUp";
   } else if (key.equals(Keys.PAUSE.toString())) {
     return "Pause";
   } else if (key.equals(Keys.RETURN.toString())) {
     return "Return";
   } else if (key.equals(Keys.RIGHT.toString())) {
     return "Right";
   } else if (key.equals(Keys.SEMICOLON.toString())) {
     return "Semicolon";
   } else if (key.equals(Keys.SEPARATOR.toString())) {
     return "Separator";
   } else if (key.equals(Keys.SHIFT.toString())) {
     return "Shift";
   } else if (key.equals(Keys.SPACE.toString())) {
     return "Space";
   } else if (key.equals(Keys.SUBTRACT.toString())) {
     return "Subtract";
   } else if (key.equals(Keys.TAB.toString())) {
     return "Tab";
   } else if (key.equals(Keys.UP.toString())) {
     return "Up";
   } else {
     return key;
   }
 }
  @Test
  public void сopyToMyWorkspaceWithChangesTest() throws Exception {
    IDE.EXPLORER.waitOpened();
    IDE.OPEN.openProject(PROJECT);
    IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened();
    IDE.MENU.runCommand(MenuCommands.Share.SHARE, MenuCommands.Share.FACTORY_URL);
    IDE.FACTORY_URL.waitFactoryURLFormOpened();
    IDE.FACTORY_URL.clickOnNextFactoryButton();
    IDE.FACTORY_URL.waitForFinishCreationPage();
    String factoryURL = IDE.FACTORY_URL.getDirectSharingURL();
    IDE.FACTORY_URL.clickOnFinishButtonInFactoryURLForm();
    IDE.LOGIN.logout();

    driver.get(LOGIN_URL);
    Thread.sleep(1000);
    waitIdeLoginPage();
    IDE.LOGIN.waitTenantAllLoginPage();
    IDE.LOGIN.tenantLogin(NOT_ROOT_USER_NAME, USER_PASSWORD);

    if (IDE.SELECT_WORKSPACE.isSelectWorkspacePageOpened() == true) {
      IDE.SELECT_WORKSPACE.waitWorkspaceInSelectWorkspacePage(TENANT_NAME);
      IDE.SELECT_WORKSPACE.clickOnWorkspaceName(TENANT_NAME);
    }

    driver.get(factoryURL);
    IDE.LOADER.waitClosed();
    IDE.FACTORY_URL.waitWelcomeIframe();
    IDE.selectMainFrame();
    // do some changes
    IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(PROJECT);
    IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened();
    IDE.PACKAGE_EXPLORER.selectItemInPackageExplorer(PROJECT);

    IDE.RENAME.rename(NEW_PRJ_NAME);
    IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(NEW_PRJ_NAME);
    IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("pom.xml");
    IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("pom.xml");
    IDE.EDITOR.waitActiveFile();
    IDE.EDITOR.typeTextIntoEditor(Keys.CONTROL.toString() + Keys.END.toString());
    IDE.EDITOR.typeTextIntoEditor("<!-- thisIsChange -->");
    IDE.EDITOR.waitFileContentModificationMark("pom.xml");
    // check copy to my WS with not saved files
    IDE.FACTORY_URL.waitCopyToMyWorkspaceButton();
    IDE.FACTORY_URL.clickOnCopyToMyWorkspaceButton();
    IDE.INFORMATION_DIALOG.waitOpened();
    IDE.INFORMATION_DIALOG.waitMessage("Please, save all changes before copying projects.");
    IDE.INFORMATION_DIALOG.clickOk();
    IDE.TOOLBAR.runCommand(ToolbarCommands.File.SAVE);
    IDE.LOADER.waitClosed();
    IDE.EDITOR.waitNoContentModificationMark("pom.xml");
    // deleting project on regular WS
    VirtualFileSystemUtils.delete(PROJECT);
    // check that project was deleted
    assertTrue(
        VirtualFileSystemUtils.get(REST_URL + "itembypath/" + PROJECT).getStatusCode() == 404);

    IDE.FACTORY_URL.waitCopyToMyWorkspaceButton();
    IDE.FACTORY_URL.clickOnCopyToMyWorkspaceButton();
    if (IDE.SELECT_WORKSPACE.isSelectWorkspacePageOpened() == true) {
      IDE.SELECT_WORKSPACE.waitWorkspaceInSelectWorkspacePage(TENANT_NAME);
      IDE.SELECT_WORKSPACE.clickOnWorkspaceName(TENANT_NAME);
    }

    IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened();
    IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(NEW_PRJ_NAME);
    Assert.assertTrue(driver.getCurrentUrl().equals(WORKSPACE_URL));
    IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("pom.xml");
    IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("pom.xml");
    IDE.EDITOR.waitActiveFile();
    IDE.EDITOR.waitContentIsPresent("<!-- thisIsChange -->");
  }