/**
  * This take an user from login page to user interface page using the url
  *
  * @param userName The user name
  * @param userPassword The user password
  * @return A user interface page
  */
 public static UserInterfacePage takeUserFromLoginToUserInterfaceViaUrl(
     String userName, String userPassword) {
   LoginCommon.login(userName, userPassword);
   WebDriverCommands.getDriver()
       .get(String.format("%s%s", getUrl(), new UserInterfacePage().getURLPage()));
   return new UserInterfacePage();
 }
  /**
   * Test Case Name: Dashboard actions for ZenOperaror role
   *
   * <p>Summary:
   *
   * <p>Pre-requisites: Create a user "zenoperator_user" with "ZenOperator" as role Login as
   * zenoperator_user
   *
   * <p>Post-requisites: User named "zenoperator_user" should be deleted
   *
   * <p>Author: Jennifer Castro
   *
   * @param testCaseId testlink ID
   * @param username zenoss username
   * @param password zenoss password
   * @param role User role
   * @param newUser New user name
   * @param newUserPassword New user password user
   * @param email New user email
   * @param dashboard Dashboard to use
   */
  @Test(groups = {"tc_20651", "dashboard_portlets_tests"})
  @Parameters({
    "tc_20651_testcaseid",
    "tc_20651_username",
    "tc_20651_password",
    "tc_20651_role",
    "tc_20651_useridtoadd",
    "tc_20651_usertoaddnewpassword",
    "tc_20651_email",
    "tc_20651_dashboard"
  })
  public void validateDashboardActionsForZenOperatorRole(
      String testCaseId,
      String username,
      String password,
      String role,
      String newUser,
      String newUserPassword,
      String email,
      String dashboard) {

    TestlinkCommands.setTestCaseID(testCaseId);
    CommonPage commonPage = new CommonPage();

    // ***Pre-Test
    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_PRETEST_LABEL);
    DashboardPage dashboardPage = LoginCommon.login(username, password);

    // Add a Dashboard to modify
    // todo

    // Select a specific Dashboard
    dashboardPage.selectDashboardsDropDownValue(dashboard);

    // Delete all portlets
    DashboardCommon.deleteAllPortlets(dashboardPage, ConstantsClass.PORTLET_DEFAULT_ID);

    // Add 3 portlets
    DashboardCommon.addPortlet(dashboardPage, ConstantsClass.PORTLET_WATCH_LIST_ID);
    Utilities.waitTime(ConstantsClass.TIMEOUT_1_SECONDS);
    Assert.assertTrue(
        dashboardPage.isWatchListPortletDisplayed(""), "Watch List Portlet is not displayed");

    DashboardCommon.addPortlet(dashboardPage, ConstantsClass.PORTLET_DEVICE_ISSUES_ID);
    Utilities.waitTime(ConstantsClass.TIMEOUT_1_SECONDS);
    Assert.assertTrue(
        dashboardPage.isDeviceIssuesPortletDisplayed(""), "Device Issues Portlet is not displayed");

    DashboardCommon.addPortlet(dashboardPage, ConstantsClass.PORTLET_GOOGLE_MAP_ID);
    Utilities.waitTime(ConstantsClass.TIMEOUT_1_SECONDS);
    Assert.assertTrue(
        dashboardPage.isGoogleMapsPortletDisplayed(""), "Google Maps Portlet is not displayed");
    commonPage.signOut();

    // Log in with the new user
    addUserPreTestSteps(commonPage, username, password, newUser, newUserPassword, role, email);
    dashboardPage = LoginCommon.login(newUser, newUserPassword);

    // Select a specific Dashboard
    dashboardPage.selectDashboardsDropDownValue(dashboard);

    // Test
    setTestCaseSection(TEST_CASE_SECTION_TEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_TEST_LABEL);

    // Validate Dashboard buttons
    Assert.assertFalse(
        dashboardPage.isAddButtonDisplayed(),
        "'+' Add button IS displayed on right-top of Dashboard page");
    Assert.assertFalse(
        dashboardPage.isRemoveButtonDisplayed(),
        "'-' Add button IS displayed on right-top of Dashboard page");
    Assert.assertFalse(
        dashboardPage.isGearButtonDisplayed(),
        "Gear button IS displayed on right-top of Dashboard page");

    // Validation of default portlets
    Assert.assertTrue(
        dashboardPage.isWatchListPortletDisplayed(""), "Watch List Portlet is not displayed");
    Assert.assertTrue(
        dashboardPage.isDeviceIssuesPortletDisplayed(""), "Device Issues Portlet is not displayed");
    Assert.assertTrue(
        dashboardPage.isGoogleMapsPortletDisplayed(""), "Google Maps Portlet is not displayed");

    // Post Test
    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_POSTTEST_LABEL);
    LoginPage loginPage = commonPage.signOut();
    Assert.assertTrue(loginPage.checkPage(), "Login page is not displayed");
    deleteUserPostTestSteps(commonPage, username, password, newUser);
  }
  /**
   * Test Case Name: Service actions for zenoperator role (Edit a Dynamic service)
   *
   * <p>Summary: This test case is intended to verify that user with zenOperator role can view
   * services but cannot execute basicpage actions in the Services page, in this case, editing a
   * service.
   *
   * <p>Pre-requisites: Create a user "zenoperator_user" with "zenoperator" as role Login as
   * zenoperator_user Service "TestService" must be created
   *
   * <p>Post-requisites: User named "zenoperator_user" should be deleted Service "TestService" must
   * be deleted
   *
   * <p>Author: Jennifer Castro
   *
   * @param testCaseId Test case ID
   * @param username Username to login
   * @param password Password of the user to login
   * @param newUsername Username of the user to add
   * @param newUserPassword Password of the user to add
   * @param userRole Type of the user to add e.g: manager
   * @param userEmail Email of the user
   * @param testService Logical node name
   */
  @Test(groups = {"tc_21018", "impact_services_tests"})
  @Parameters({
    "tc_21018_testcaseid",
    "tc_21018_username",
    "tc_21018_password",
    "tc_21018_newusername",
    "tc_21018_newuserpassword",
    "tc_21018_userrole",
    "tc_21018_useremail",
    "tc_21018_testservice",
    "ds_root_tree_node_name"
  })
  public void editDynamicServiceAsZenoperator(
      String testCaseId,
      String username,
      String password,
      String newUsername,
      String newUserPassword,
      String userRole,
      String userEmail,
      String testService,
      String dsTreeNodeName)
      throws Exception {

    TestlinkCommands.setTestCaseID(testCaseId);

    CommonPage commonPage = new CommonPage();
    DynamicServicesCommon dynamicServicesCommon = new DynamicServicesCommon();
    testService = String.format("%s %d", testService, Utilities.getRandomNumber(1000));
    List<String> path = new ArrayList<String>();
    path.add(0, testService);

    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_PRETEST_LABEL);
    addUserPreTestSteps(
        commonPage, username, password, newUsername, newUserPassword, userRole, userEmail);
    dynamicServicesCommon.addDynamicServicePreTestSteps(
        commonPage, username, password, testService);
    LoginCommon.login(newUsername, newUserPassword);

    setTestCaseSection(TEST_CASE_SECTION_TEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_TEST_LABEL);

    TestlinkCommands.addStepDescription("- Go to Services Page");
    DynamicServicesPage dynamicServicesPage =
        (DynamicServicesPage) commonPage.navigateTo(SERVICES_PAGE);
    Assert.assertTrue(dynamicServicesPage.checkPage(), "Dynamic Service page is not displayed");

    Assert.assertTrue(
        dynamicServicesPage.isItemInDynamicServiceTreeHighlighted(dsTreeNodeName),
        String.format("Dynamic service root node: %s is not highlighted", dsTreeNodeName));
    functions.waitTime(TIMEOUT_2_SECONDS);

    TestlinkCommands.addStepDescription(
        String.format("- Click on the service called \"%s\"", testService));
    DynamicServicesCommon.reachElementInsideTree(path, dynamicServicesPage, true, true);
    functions.waitTime(TIMEOUT_2_SECONDS);

    // Validation: Service "TestService" is highlighted to show that it is selected.
    Assert.assertTrue(
        dynamicServicesPage.isItemInDynamicServiceTreeHighlighted(testService),
        String.format("Dynamic service: %s is not highlighted", testService));
    functions.waitTime(TIMEOUT_2_SECONDS);

    // Validation: Add and delete buttons are disabled on the right frame.
    Assert.assertFalse(
        dynamicServicesPage.isAddToServiceButtonEnabled(),
        "Add to service (+) button is NOT disabled");

    Assert.assertFalse(
        dynamicServicesPage.isDeleteToServiceButtonEnabled(),
        "Delete to service (-) button is NOT disabled");

    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_POSTTEST_LABEL);
    LoginPage loginPage = commonPage.signOut();
    Assert.assertTrue(loginPage.checkPage(), "Login page is not displayed");
    dynamicServicesCommon.deleteDynamicServicePostTestSteps(
        commonPage, username, password, testService, path);
    deleteUserPostTestSteps(commonPage, username, password, newUsername);
  }
  /**
   * Test Case Name: Report actions for zenmanager role (Quantity of Reports)
   *
   * <p>Summary: This test case is intended to verify that user with Zenmanager role can view the
   * quantity expected for reports
   *
   * <p>Pre-requisites: Create a user "zenmanager_user" with "ZenManager" as role Login as
   * manager_user
   *
   * <p>Post-requisites: User named "zenmanager_user" should be deleted
   *
   * <p>Author: Juan Polanco
   *
   * @param testCaseId testlink ID
   * @param username zenoss username
   * @param password zenoss password
   * @param userRole User role
   * @param newUser New user name
   * @param newUserPassword New user password user
   * @param managerEmail New user email
   */
  @Test(groups = {"tc_21895"})
  @Parameters({
    "tc_21895_testcaseid",
    "tc_21895_username",
    "tc_21895_password",
    "tc_21895_userrole",
    "tc_21895_newusername",
    "tc_21895_newuserpassword",
    "tc_21895_useremail"
  })
  public void reportActionsAsZenOperator(
      String testCaseId,
      String username,
      String password,
      String userRole,
      String newUser,
      String newUserPassword,
      String managerEmail) {

    TestlinkCommands.setTestCaseID(testCaseId);
    CommonPage commonPage = new CommonPage();
    SettingsSubMenuPage settingsSubMenuPage = new SettingsSubMenuPage();
    LoginPage loginPage = new LoginPage();

    // ***Pre-Test
    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_PRETEST_LABEL);
    addUserPreTestSteps(
        commonPage, username, password, newUser, newUserPassword, userRole, managerEmail);

    // ***Test
    setTestCaseSection(TEST_CASE_SECTION_TEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_TEST_LABEL);
    Assert.assertTrue(loginPage.checkPage(), "Login Page is not displayed");
    LoginCommon.login(newUser, password);
    TestlinkCommands.addStepDescription("- Go to Reports Page");
    ReportsPage reportsPage = (ReportsPage) commonPage.navigateTo(ConstantsClass.REPORTS_PAGE);
    Assert.assertTrue(reportsPage.checkPage(), "Reports Page is not displayed");
    TestlinkCommands.addStepDescription(
        String.format(
            "- Title Tree [%s] Verification", ConstantsClass.REPORTS_ZEN_OPERATOR_TABLE_TITLE));
    Assert.assertTrue(
        reportsPage.isReportsTableTitleDisplayed(ConstantsClass.REPORTS_ZEN_OPERATOR_TABLE_TITLE),
        "Reports Table is not displayed");
    TestlinkCommands.addStepDescription("- Verify the organizer quantity");
    // Assert.assertTrue(reportsPage.areNumberOfOrganizersDisplayed(ConstantsClass.REPORTS_ZEN_OPERTATOR_ORGANIZER_NUMBER));
    Assert.assertTrue(
        reportsPage.getTotalReportOrganizersNumber()
            >= ConstantsClass.REPORTS_ZEN_OPERTATOR_ORGANIZER_NUMBER,
        String.format(
            "The number of organizers is les than %s",
            ConstantsClass.REPORTS_ZEN_OPERTATOR_ORGANIZER_NUMBER));

    // ***Post Test
    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_POSTTEST_LABEL);
    loginPage = commonPage.signOut();
    Assert.assertTrue(loginPage.checkPage(), "Login Page is not displayed");
    LoginCommon.login(username, password);
    SettingsPage settingsPage = (SettingsPage) commonPage.navigateTo(ConstantsClass.ADVANCE_PAGE);
    Assert.assertTrue(settingsPage.checkPage(), "Settings page is not displayed");
    UsersPage usersPage =
        (UsersPage)
            settingsSubMenuPage.navigateToSettingsSubMenus(ConstantsClass.ADVANCED_USERS_SUBMENU);
    Assert.assertTrue(usersPage.checkPage(), "Users page is not displayed");
    deleteUser(usersPage, newUser);
  }
  /**
   * Test Case Name: Service actions for zenoperator role (Add a Logical Node)
   *
   * <p>Summary: This test case is intended to verify that user with zenoperator role cannot execute
   * basicpage actions in the Logical Nodes page, in this case Add a logical node
   *
   * <p>Pre-requisites: Create a user "zenoperator_user" with "zenoperator" as role Login as
   * zenoperator_user Service "TestService" must be created
   *
   * <p>Post-requisites: User named "zenoperator_user" must be deleted
   *
   * <p>Author: Juan Polanco
   *
   * @param testCaseId testlink ID
   * @param username zenoss username
   * @param password zenoss password
   * @param userRole User role
   * @param newUser New user name
   * @param newUserPassword New user password user
   * @param managerEmail New user email
   */
  @Test(groups = {"tc_21020", "impact_services_tests"})
  @Parameters({
    "tc_21020_testcaseid",
    "tc_21020_username",
    "tc_21020_password",
    "tc_21020_userrole",
    "tc_21020_newusername",
    "tc_21020_newuserpassword",
    "tc_21020_useremail",
    "ln_root_tree_node_name"
  })
  public void addLogicalNodeAsZenOperator(
      String testCaseId,
      String username,
      String password,
      String userRole,
      String newUser,
      String newUserPassword,
      String managerEmail,
      String lnTreeNodeName) {

    TestlinkCommands.setTestCaseID(testCaseId);
    CommonPage commonPage = new CommonPage();
    ServicesSubMenuPage servicesSubMenuPage = new ServicesSubMenuPage();
    LoginPage loginPage = new LoginPage();

    // ***Pre-Test
    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_PRETEST_LABEL);
    addUserPreTestSteps(
        commonPage, username, password, newUser, newUserPassword, userRole, managerEmail);

    // ***Test
    setTestCaseSection(TEST_CASE_SECTION_TEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_TEST_LABEL);
    TestlinkCommands.addStepDescription(String.format("- Logi as [%s]", newUser));
    LoginCommon.login(newUser, newUserPassword);
    TestlinkCommands.addStepDescription("-Go to Dynamic Services ");
    DynamicServicesPage dynamicServicesPage =
        (DynamicServicesPage) commonPage.navigateTo(ConstantsClass.SERVICES_PAGE);
    Assert.assertTrue(dynamicServicesPage.checkPage(), "Dynamic services page is not displayed");
    LogicalNodesPage logicalNodesPage =
        (LogicalNodesPage)
            servicesSubMenuPage.navigateTo(ConstantsClass.LOGICAL_NODES_SUBMENU_PAGE);
    Assert.assertTrue(logicalNodesPage.checkPage(), "Logical nodes page is not displayed");
    TestlinkCommands.addStepDescription(
        String.format("- Checking if footer buttons are displayed"));
    Assert.assertFalse(
        logicalNodesPage.isAddLogicalNodeButtonDisplayed(), "Add logical node button displayed");
    Assert.assertFalse(
        logicalNodesPage.isDeleteLogicalNodeButtonDisplayed(),
        "Delete logical node button displayed");
    Assert.assertFalse(logicalNodesPage.isLogicaNodeGearButtonDisplayed(), "Gear button displayed");
    Assert.assertTrue(logicalNodesPage.isLogicalNodeHighlighted(lnTreeNodeName));

    // ***Post test
    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_POSTTEST_LABEL);
    commonPage.signOut();
    Assert.assertTrue(loginPage.checkPage(), "Login page is not displayed");

    deleteUserPostTestSteps(commonPage, username, password, newUser);
  }
  /**
   * Test Case Name: Actions for zenoperator role (Add a service)
   *
   * <p>Summary: This test case is intended to verify that user with zenOperator role can view
   * services but cannot execute basicpage actions in the Services page, in this case, adding a
   * service.
   *
   * <p>Pre-requisites: Create a user "zenoperator_user" with "zenoperator" as role Login as
   * zenoperator_user Service "TestService" must be created
   *
   * <p>Post-requisites: User named "zenoperator_user" should be deleted Service "TestService" must
   * be deleted
   *
   * <p>Author: Juan Polanco
   *
   * @param testCaseId testlink ID
   * @param username zenoss username
   * @param password zenoss password
   * @param userRole User role
   * @param newUser New user name
   * @param newUserPassword New user password user
   * @param managerEmail New user email
   * @param serviceName Dynamic service name
   */
  @Test(groups = {"tc_21016", "impact_services_tests"})
  @Parameters({
    "tc_21016_testcaseid",
    "tc_21016_username",
    "tc_21016_password",
    "tc_21016_userrole",
    "tc_21016_newusername",
    "tc_21016_newuserpassword",
    "tc_21016_useremail",
    "tc_21016_servicename"
  })
  public void zenOperatorRoleActionAddService(
      String testCaseId,
      String username,
      String password,
      String userRole,
      String newUser,
      String newUserPassword,
      String managerEmail,
      String serviceName) {

    TestlinkCommands.setTestCaseID(testCaseId);
    CommonPage commonPage = new CommonPage();
    LoginPage loginPage = new LoginPage();
    DynamicServicesCommon dynamicServicesCommon = new DynamicServicesCommon();
    serviceName = String.format("%s %d", serviceName, Utilities.getRandomNumber(1000));
    List<String> path = new ArrayList<String>();
    path.add(0, serviceName);

    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_PRETEST_LABEL);
    addUserPreTestSteps(
        commonPage, username, password, newUser, newUserPassword, userRole, managerEmail);
    dynamicServicesCommon.addDynamicServicePreTestSteps(
        commonPage, username, password, serviceName);
    LoginCommon.login(newUser, newUserPassword);

    setTestCaseSection(TEST_CASE_SECTION_TEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_TEST_LABEL);

    TestlinkCommands.addStepDescription("-Go to Dynamic Services ");
    DynamicServicesPage dynamicServicesPage =
        (DynamicServicesPage) commonPage.navigateTo(SERVICES_PAGE);
    Assert.assertTrue(dynamicServicesPage.checkPage(), "Dynamic Service page is not displayed");

    Assert.assertFalse(
        dynamicServicesPage.isAddDynamicServicesButtonDisplayed(),
        "Add dynamic services button is displayed");
    Assert.assertFalse(
        dynamicServicesPage.isDynamicServicesGearButtonDisplayed(), "Gears button is displayed");
    Assert.assertFalse(
        dynamicServicesPage.isRemoveDynamicServicesButtonDisplayed(),
        "Remove dynamic services button is displayed");

    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_POSTTEST_LABEL);
    TestlinkCommands.addStepDescription(String.format("- Logout as a [%s]", newUser));
    commonPage.signOut();
    Assert.assertTrue(loginPage.checkPage(), "Login page is not displayed");
    dynamicServicesCommon.deleteDynamicServicePostTestSteps(
        commonPage, username, password, serviceName, path);
    deleteUserPostTestSteps(commonPage, username, password, newUser);
  }
  /**
   * Test Case Name: Service actions for zenoperator role (Edit a Logical Node)
   *
   * <p>Summary: This test case is intended to verify that user with zenoperator role can view
   * logical nodes but cannot execute basicpage actions in the Logical Nodes page, in this case,
   * editing a logical node.
   *
   * <p>Pre-requisites: Create a user "zenoperator_user" with "zenoperator" as role Login as
   * zenoperator_user Create a logical node with the name "Testnode"
   *
   * <p>Post-requisites: User named "zenoperator_user" must be deleted Logical node with the name
   * "Testnode" must be deleted
   *
   * <p>Author: Jennifer Castro
   *
   * @param testCaseId Test case ID
   * @param username Username to login
   * @param password Password of the user to login
   * @param newUsername Username of the user to add
   * @param newUserPassword Password of the user to add
   * @param userRole Type of the user to add e.g: manager
   * @param userEmail Email of the user
   * @param testNode Logical node name
   */
  @Test(groups = {"tc_21032", "impact_services_tests"})
  @Parameters({
    "tc_21032_testcaseid",
    "tc_21032_username",
    "tc_21032_password",
    "tc_21032_newusername",
    "tc_21032_newuserpassword",
    "tc_21032_userrole",
    "tc_21032_useremail",
    "tc_21032_testnode",
    "tc_21032_nodedescription",
    "ln_root_tree_node_name"
  })
  public void editLogicalNodeAsZenoperator(
      String testCaseId,
      String username,
      String password,
      String newUsername,
      String newUserPassword,
      String userRole,
      String userEmail,
      String testNode,
      String nodeDescription,
      String lnTreeNodeName) {

    TestlinkCommands.setTestCaseID(testCaseId);

    CommonPage commonPage = new CommonPage();
    ServicesSubMenuPage servicesSubMenuPage = new ServicesSubMenuPage();
    LogicalNodesCommon logicalNodesCommon = new LogicalNodesCommon();
    testNode = String.format("%s %d", testNode, Utilities.getRandomNumber(1000));

    List<String> path = new ArrayList<String>();
    path.add(testNode);

    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_PRETEST_LABEL);
    addUserPreTestSteps(
        commonPage, username, password, newUsername, newUserPassword, userRole, userEmail);

    logicalNodesCommon.addLogicalNodePreTestSteps(
        commonPage, servicesSubMenuPage, username, password, testNode, path);

    LoginCommon.login(newUsername, newUserPassword);

    setTestCaseSection(TEST_CASE_SECTION_TEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_TEST_LABEL);
    TestlinkCommands.addStepDescription("- Go to Services Page");
    DynamicServicesPage dynamicServicesPage =
        (DynamicServicesPage) commonPage.navigateTo(SERVICES_PAGE);
    Assert.assertTrue(dynamicServicesPage.checkPage(), "Dynamic Service page is not displayed");

    TestlinkCommands.addStepDescription("- Go to Logical Nodes Page");
    LogicalNodesPage logicalNodesPage =
        (LogicalNodesPage) servicesSubMenuPage.navigateTo(LOGICAL_NODES_SUBMENU_PAGE);
    Assert.assertTrue(logicalNodesPage.checkPage(), "Logical Node page is not displayed");

    Assert.assertTrue(
        logicalNodesPage.isLogicalNodeHighlighted(lnTreeNodeName),
        String.format("Logical root node: %s is not highlighted", lnTreeNodeName));
    Utilities.waitTime(TIMEOUT_2_SECONDS);

    TestlinkCommands.addStepDescription(
        String.format("- Click on \"%s\" on the left frame", testNode));
    logicalNodesCommon.reachElementInsideTree(path, logicalNodesPage, true, true);

    // Validation: Logical Node is highlighted to show that it is selected.
    Assert.assertTrue(
        logicalNodesPage.isLogicalNodeHighlighted(testNode),
        String.format("Logical node: %s is not highlighted", testNode));

    logicalNodesPage.editBasicLogicalNodeinformation("", nodeDescription);
    functions.waitTime(TIMEOUT_2_SECONDS);

    // Validation: Save button is disabled
    Assert.assertFalse(logicalNodesPage.isSaveButtonEnabled(), "Save button is NOT disabled");

    // Validation: Cancel button is enabled on the right frame of the page.
    Assert.assertTrue(logicalNodesPage.isCancelButtonEnabled(), "Cancel button is NOT enabled");

    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    TestlinkCommands.addStepDescription(TEST_CASE_SECTION_POSTTEST_LABEL);
    LoginPage loginPage = commonPage.signOut();
    Assert.assertTrue(loginPage.checkPage(), "Login page is not displayed");

    logicalNodesCommon.deleteLogicalNodePostTestSteps(
        commonPage, servicesSubMenuPage, username, password, testNode, path);

    deleteUserPostTestSteps(commonPage, username, password, newUsername);
  }
  /**
   * Test Case Name: Verify VIC vHBAs components
   *
   * <p>Summary: This test case verifies details of VIC vHBAs component of CiscoUCS/C- Series
   * device.
   *
   * <p>Pre-requisites: Add a new ucs device
   *
   * <p>Post-requisites: Remove the UCS device
   *
   * <p>Author Oscar Valerio
   *
   * @param testCaseId The TC id
   * @param adminUserName The admin user
   * @param adminUserPassword The admin password
   * @param deviceName The UCS device name to use
   * @param ucsType The ucs type
   * @param ucsUserName The ucs user name
   * @param ucsPass The ucs user pass
   * @param ucsCollectorName The ucs collector to assign
   * @throws Exception
   */
  @Test(
      groups = {"tc_1259"},
      priority = 0)
  @Parameters({
    "tc_1259_testcaseid", "tc_1259_username", "tc_1259_password", "tc_1259_device",
    "tc_1259_ucstype", "tc_1259_ucsusername", "tc_1259_ucsuserpass", "tc_1259_ucscollector",
    "tc_1259_ucscomponenttoverify", "tc_1259_ucsexpectdheaders", "tc_1259_ucsexpectddisplayoptions"
  })
  public void verifyVirtualHBAComponents(
      String testCaseId,
      String adminUserName,
      String adminUserPassword,
      String deviceName,
      String ucsType,
      String ucsUserName,
      String ucsPass,
      String ucsCollectorName,
      String ucsComponentToVerify,
      String ucsExpectedHeaders,
      String ucsexpectedDisplayOptions)
      throws Exception {

    CommonPage commonPage = new CommonPage();
    Autoinstall autoinstall = new Autoinstall();
    String[] expectedHeaders = ucsExpectedHeaders.split(ConstantsClass.CHAR_SEPARATOR_ARRAY);
    String[] expectedDisplayOptions =
        ucsexpectedDisplayOptions.split(ConstantsClass.CHAR_SEPARATOR_ARRAY);

    // ** Pre-test
    TestlinkCommands.setTestCaseID(testCaseId);
    setTestCaseSection(TEST_CASE_SECTION_PRETEST);
    LoginCommon.login(adminUserName, adminUserPassword);

    // Remove UCS device if exists
    Assert.assertTrue(
        autoinstall.deleteDevice(getEndPoint(), getTargetNameSpace(), getHostName(), deviceName),
        String.format("[WebService] Error. Device %s was NOT deleted", deviceName));

    // Go to infrastructure page
    DevicesPage devicesPage =
        (DevicesPage) commonPage.navigateTo(ConstantsClass.INFRASTRUCTURE_PAGE);
    Assert.assertTrue(
        devicesPage.checkPage(), "Infrastructure page was not displayed as expected.");

    // Add an UCS device
    DevicesCommon.addUCSDeviceAndWaitForJobToFinish(
        devicesPage, ucsType, deviceName, ucsUserName, ucsPass, ucsCollectorName);
    devicesPage.clickOnRefreshButton();

    // Select the ucs device
    DevicesCommon.selectDeviceInList(devicesPage, deviceName, ConstantsClass.DEVICE_FILTER);
    OverviewPage overviewPage = devicesPage.clickDeviceLink(deviceName);
    Assert.assertTrue(
        overviewPage.checkPage(deviceName), "Overview page was not displayed as expected");

    // Check values
    DeviceDetailPage deviceDetailPage = new DeviceDetailPage();
    Assert.assertEquals(
        deviceDetailPage.getDeviceStatus(),
        ConstantsClass.DEVICE_STATUS_UP,
        "The device status is not Up");

    // ** Test
    setTestCaseSection(TEST_CASE_SECTION_TEST);

    // Select component
    VirtualHBAsPage virtualHBAsPage =
        (VirtualHBAsPage) deviceDetailPage.clickOnDeviceComponents(ucsComponentToVerify);

    // Check headers
    VirtualHBAsCommons.checkComponentTableColumnValues(virtualHBAsPage, expectedHeaders);

    // Check display options
    VirtualHBAsCommons.checkComponentDisplayOPtions(virtualHBAsPage, expectedDisplayOptions);

    // Check collected data
    List<String> VirtualHBANames = virtualHBAsPage.getVirtualHBAColumnValues();
    Assert.assertTrue(VirtualHBANames.size() > 0, "The Virtual HBA table is not displaying data");

    for (String name : VirtualHBANames) {
      softAssert.assertTrue(!name.isEmpty(), "The Virtual HBA name is not defined. It is empty");
    }
    softAssert.assertAll();
    softAssert.clear();

    // *** Post Test
    setTestCaseSection(TEST_CASE_SECTION_POSTTEST);
    Assert.assertTrue(
        autoinstall.deleteDevice(getEndPoint(), getTargetNameSpace(), getHostName(), deviceName),
        String.format("[WebService] Error. Device %s was NOT deleted", deviceName));
  }