/**
   * Test: AONE-6554:Hidden files
   *
   * <ul>
   *   <li>Map Alfresco Webdav as a network drive
   *   <li>Create a folder with the name started with dot (e.g. '.folder new')
   *   <li>Create a file with the name started with dot (e.g. '.test.txt')
   *   <li>Log into Share
   *   <li>Verify the presence of the file and folder
   *   <li>The file and folder are not displayed
   * </ul>
   *
   * @throws Exception
   */
  @AlfrescoTest(testlink = "AONE-6554")
  @Test(
      groups = {"WEBDAVWindowsClient", "EnterpriseOnly"},
      timeOut = 600000)
  public void AONE_6554() throws Exception {

    if (!CifsUtil.checkDirOrFileExists(10, 200, networkDrive + sitesPath)) {
      Assert.fail("Mapping was not done " + testUser);
    }
    // Alfresco WebDAV connection is established
    String docLib = "\\documentLibrary";
    // Alfresco WebDAV connection is established
    String fullPath = networkDrive + sitesPath + siteName.toLowerCase() + docLib + "\\";

    explorer.openWindowsExplorer();
    explorer.openFolder(fullPath);

    // The space / the site's doclib is opened via WebDAV
    String windowName = ldtpUtil.findWindowName("documentLibrary");
    explorer.activateApplicationWindow(windowName);

    // Create a folder with the name started with dot (e.g. '.folder new')
    explorer.createNewFolderMenu(folderName);

    // Create a file with the name started with dot (e.g. '.test.txt')
    explorer.rightClickCreate("documentLibrary", fileName, Application.TEXTFILE);

    explorer.activateApplicationWindow(windowName);

    Ldtp newLdtp = new Ldtp(windowName);
    String[] objects = newLdtp.getObjectList();
    Assert.assertTrue(
        Arrays.asList(objects).contains(fileNameCheck),
        "Expected file '" + fileName + "' isn't displayed");
    Assert.assertTrue(
        Arrays.asList(objects).contains(folderNameCheck),
        "Expected folder '" + folderName + "' isn't displayed");
    logger.info("Close window");
    explorer.closeExplorer();

    // Log into Share
    ShareUser.login(drone, testUser);
    DocumentLibraryPage docLibPage = ShareUser.openSitesDocumentLibrary(drone, siteName);

    int fileCount = docLibPage.getFiles().size();

    ShareUser.logout(drone);

    // The file and folder are not displayed
    Assert.assertTrue(
        fileCount == 0, "Some file isn't hidden in Document Library. MNT-13125 and MNT-8116");
  }
  @BeforeMethod(groups = "setup", timeOut = 150000)
  public void precondition() throws Exception {

    // Create user
    String[] testUserInfo = new String[] {testUser};
    CreateUserAPI.CreateActivateUser(drone, ADMIN_USERNAME, testUserInfo);

    ShareUser.logout(drone);

    String networkPathNew = networkPath.concat("webdav");

    mapConnect =
        "cmd /c start /WAIT net use"
            + " "
            + networkDrive
            + " "
            + networkPathNew
            + " "
            + "/user:"******" "
            + DEFAULT_PASSWORD;

    // Runtime.getRuntime().exec(mapConnect);
    Process process = Runtime.getRuntime().exec(mapConnect);
    // waitProcessEnd(process);
    process.waitFor();

    if (CifsUtil.checkDirOrFileExists(10, 200, networkDrive + sitesPath)) {
      logger.info("----------Mapping succesfull " + testUser);
    } else {
      logger.error("----------Mapping was not done " + testUser);
      Assert.fail("Mapping was not done " + testUser);
    }

    // Any site is created
    ShareUser.login(drone, testUser);
    ShareUser.createSite(drone, siteName, SITE_VISIBILITY_PUBLIC);
    ShareUser.logout(drone);
  }