/** * 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: 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); }