/** CaseID 65862, 67863, 67862, 67861 Create, edit, execute, delete query in Advanced search */
  @Test
  public void test03_04_05_CreateQueryInAdvancedSearch() {
    String node1 = "test03Create";
    String nameQuery = "Query test03";
    String query =
        "select * from nt:base where jcr:path like '/sites/%' order by exo:dateCreated DESC";
    String edit =
        "select * from nt:base where jcr:primaryType like 'nt:file' order by exo:dateCreated DESC";
    By bNode1 = By.xpath(siteExp.ELEMENT_SE_NODE.replace("{$node}", node1));

    info("Create, edit, execute, delete query in Advanced search");
    actBar.goToAddNewContent();
    cTemplate.createNewFile(node1, node1, node1);

    // CaseID 65862 - Create query
    aSearch.goToNewQuery();
    aSearch.addQuery(nameQuery, "SQL", query);

    // CaseID 67863 - Edit query
    aSearch.goToEditQuery(nameQuery);
    aSearch.editQuery("", "SQL", edit);

    // CaseID 67862 execute query
    aSearch.executeQuery(nameQuery);
    waitForAndGetElement(aSearch.ELEMENT_SEARCH_RESULT_TEXT.replace("${result}", node1));
    btn.closeWindow();

    // CaseID 67861 - Delete query
    aSearch.deleteQuery(nameQuery);

    // Delete data
    click(siteExp.ELEMENT_SIDEBAR_FILE_EXPLORER);
    cMenu.deleteDocument(bNode1);
  }
  /**
   * Qmetry ID: 102081 Rename form ui Note: [Main area] and [Left panel] are displayed in Sites
   * Management View
   */
  @Test
  public void test11_RenameFormUI() {
    String filePath = "TestData/test.txt";
    // By mFile = By.xpath(siteExp.ELEMENT_DOCUMENT_TITLE.replace("${title}", "test.txt"));
    By eFile = By.xpath(siteExp.ELEMENT_SE_NODE.replace("{$node}", "test.txt"));

    info("-- Test case: Rename Form UI --");

    // Go to Personal Drive
    navToolBar.goToSiteExplorer();
    actBar.showDrives();

    // Test Data > Upload a file: filename.txt
    // click(siteExp.ELEMENT_SIDEBAR_SITES_MANAGEMENT);
    click(siteExp.ELEMENT_SIDEBAR_PERSONAL_DOCUMENTS);
    // ecms.uploadFile(filePath);
    if (waitForAndGetElement(ecms.ELEMENT_ACTION_BAR_UPLOAD_BTN, DEFAULT_TIMEOUT, 2000, 0)
        == null) {
      info("click on More link");
      click(ecms.ELEMENT_MORE_LINK_WITHOUT_BLOCK);
      info("click upload button");
      click(ecms.ELEMENT_ACTION_BAR_UPLOAD_BTN);
    } else click(ecms.ELEMENT_ACTION_BAR_UPLOAD_BTN);
    uploadFileUsingRobot(filePath);

    // Main area > Open rename form
    // rightClickOnElement(mFile);
    rightClickOnElement(cMenu.ELEMENT_MAIN_AREA_NODE.replace("${title}", "test.txt"));
    click(cMenu.ELEMENT_MENU_RENAME_NODE);
    waitForAndGetElement(cMenu.ELEMENT_INPUT_RENAME_NODE);
    waitForAndGetElement(button.ELEMENT_RENAME_BUTTON);
    waitForAndGetElement(button.ELEMENT_CANCEL_BUTTON);
    button.cancel();

    // Left panel > Open rename form
    // rightClickOnElement(eFile);
    rightClickOnElement(cMenu.ELEMENT_LEFT_PANEL_AREA_NODE.replace("${title}", "test.txt"));
    click(cMenu.ELEMENT_MENU_RENAME_NODE);
    waitForAndGetElement(cMenu.ELEMENT_INPUT_RENAME_NODE);
    waitForAndGetElement(button.ELEMENT_RENAME_BUTTON);
    waitForAndGetElement(button.ELEMENT_CANCEL_BUTTON);
    button.cancel();

    // Restore data
    cMenu.deleteDocument(eFile);
  }
  /** CaseID 65875 Simple Search Step 1: Simple Search */
  @Test
  public void test02_SimpleSearch() {
    String node1 = "test02SimpleSearch";
    String des = "test02 desc";
    By bNode1 = By.xpath(siteExp.ELEMENT_SE_NODE.replace("{$node}", node1));

    info("Simple search");
    // Create document
    actBar.goToAddNewContent();
    cTemplate.createNewFile(node1, node1, node1, des);

    // Simple search
    type(siteExp.ELEMENT_SIMPLESEARCH_TEXTBOX, node1, true);
    click(siteExp.ELEMENT_QUICKSEARCH_ICON);
    waitForAndGetElement(aSearch.ELEMENT_SEARCH_RESULT_TEXT.replace("${result}", node1));

    // Delete data
    cMenu.deleteDocument(bNode1);
  }
  /** CaseID 85825 Advanced search Step 1: Advanced search */
  @Test
  public void test01_AdvancedSearch() {
    String node1 = "test01AdvancedSearch";
    String des = "test01 desc";
    By bNode1 = By.xpath(siteExp.ELEMENT_SE_NODE.replace("{$node}", node1));

    info("Advanced search");
    // Create document
    actBar.goToAddNewContent();
    cTemplate.createNewFile(node1, node1, node1, des);

    // Advance search
    aSearch.goToAdvancedSearch();
    click(aSearch.ELEMENT_CONSTRAINT_FORM);
    aSearch.selectDocumentType("nt:file");
    aSearch.searchContent(node1);
    waitForAndGetElement(aSearch.ELEMENT_SEARCH_RESULT_TEXT.replace("${result}", node1));
    btn.closeWindow();

    // Delete data
    click(siteExp.ELEMENT_SIDEBAR_FILE_EXPLORER);
    cMenu.deleteDocument(bNode1);
  }