Beispiel #1
0
 def clickPolicyEntryActionsViewLog(self, retryCount=3, timeout=10):
     self.checkElementonPage(
         locatorName=self.getPolicyEntryActionsViewLog(),
         locatorMessage='Delete Option Visible',
         retryCount=retryCount,
         timeout=timeout)
     SeleniumDP.click(self.driver, self.getPolicyEntryActionsViewLog())
Beispiel #2
0
 def validatePolicyCreationFailure(self, retryCount=3, timeout=5):
     assert self.checkElementonPage(
         locatorName=self.getPolicyCreationFailMessage(
             returnLocatorName=True),
         locatorMessage='Policy Creation Fail Message Visible',
         retryCount=retryCount,
         timeout=timeout)
     assert self.checkElementonPage(
         locatorName=self.getPolicyCreationErrorDetails(
             returnLocatorName=True),
         locatorMessage="Policy Creation Error Details Button Visible",
         retryCount=retryCount,
         timeout=timeout)
     SeleniumDP.click(self.driver, self.getPolicyCreationErrorDetails())
     assert self.checkElementonPage(
         locatorName=self.getPolicyCreationFailDialog(
             returnLocatorName=True),
         locatorMessage="Policy Creation Fail Dialog Visible",
         retryCount=retryCount,
         timeout=timeout)
     assert self.checkElementonPage(
         locatorName=self.getdlmModalDialogOKButton(returnLocatorName=True),
         locatorMessage="OK Button Visible",
         retryCount=retryCount,
         timeout=timeout)
     SeleniumDP.click(self.driver, self.getdlmModalDialogOKButton())
    def clickToGoToPolicyLandingPage(self, policyType):

        IS_HUMBOLDT = Machine.isWindows()
        global serviceName, service_name_type_dict, service_name_type_dict_for_Humboldt

        service_name_type_dict_for_Humboldt = {
            'hadoop': 'hadoopdev',
            'hive': 'hivedev',
            'hbase': 'hbasedev',
            'knox': 'knoxdev',
            'storm': 'stormdev'
        }
        service_name_type_dict = {
            'hadoop': xa_testenv.getEnv("XA_HDFS_REPO_NAME", "hadoopdev"),
            'hive': xa_testenv.getEnv("XA_HIVE_REPO_NAME", "hivedev"),
            'hbase': xa_testenv.getEnv("XA_HBASE_REPO_NAME", "hbasedev"),
            'knox': xa_testenv.getEnv("XA_KNOX_REPO_NAME", "knoxdev"),
            'storm': xa_testenv.getEnv("XA_STORM_REPO_NAME", "stormdev")
        }

        if IS_HUMBOLDT:
            logger.info("Its a Humboldt cluster !!")
            serviceName = service_name_type_dict_for_Humboldt[policyType]
        else:
            logger.info("Its NOT a Humboldt cluster !!")
            serviceName = service_name_type_dict[policyType]
        logger.info("serviceName: " + serviceName)
        SeleniumDP.click(self.driver, self.getServiceLink(policyType, serviceName))
Beispiel #4
0
 def selectClusterToEdit(self, clusterName):
     self.isInfraLandingPage(retryCount=2)
     clusterInfoTableExists = self.checkElementonPage(
         locatorName=self.getClusterInfoTable(returnLocatorName=True),
         locatorMessage='Clusters info table',
         retryCount=5)
     if clusterInfoTableExists:
         tries = 5
         while tries > 0:
             try:
                 clusterInfoTableBody = self.findElement(
                     *self.locator_dictionary[self.getClusterInfoTableBody(
                         returnLocatorName=True)])
                 for row in clusterInfoTableBody.find_elements(
                         By.TAG_NAME, 'tr'):
                     columns = row.find_elements(By.TAG_NAME, 'td')
                     if clusterName.lower() == columns[1].text.lower():
                         actionsButton = columns[7].find_element(
                             By.TAG_NAME, 'button')
                         SeleniumDP.click(self.driver, actionsButton)
                         dropDownMenuElement = columns[7].find_element(
                             By.TAG_NAME, 'ul')
                         dropDownOptions = dropDownMenuElement.find_elements(
                             By.TAG_NAME, 'li')
                         for option in dropDownOptions:
                             entries = option.find_elements(
                                 By.TAG_NAME, 'a')
                             for entry in entries:
                                 if entry.text.lower() == 'edit':
                                     SeleniumDP.click(self.driver, entry)
                                     return
             except:
                 tries = tries - 1
Beispiel #5
0
 def clickRefreshCluster(self, rowNum, retryNum=3):
     try:
         SeleniumDP.click(self.driver,
                          self.getClusterRefreshClickableElement())
         return True
     except Exception as e:
         # We might reach this point only if StaleElementReferenceException
         # is seen where-in we might need to invoke the whole process again
         logger.error(
             "Caught an exception: %s, Let's retry to try our luck !!!" % e)
         if retryNum > 0:
             logger.info("Retry Attempt:  %s" % retryNum)
             logger.info(
                 "Invoking clickClusterButtonAndValidateHoverVisibility"
                 "for Row: %s since refresh caused cache to loose state" %
                 rowNum)
             if self.clickClusterButtonAndValidateHoverVisibility(
                     rowNum=rowNum):
                 logger.info(
                     "Hover visible in clickRefreshCluster, Proceeding to click now"
                 )
                 return self.clickRefreshCluster(rowNum, retryNum - 1)
             else:
                 logger.error(
                     "No point proceeding further ... Failing the test")
                 return False
         else:
             logger.info("Retry Attempts failed")
             return False
Beispiel #6
0
    def enableDSS(self, smartsenseId="A-12341234-C-12341234"):
        # Click SideNav
        self.clickSideNavServices()

        # Verify DSS Service Box is visible
        self.checkElementonPage(
            locatorName=self.getDssServiceBox(returnLocatorName=True),
            locatorMessage='DSS Service Box',
            retryCount=4)

        # Click DSS service box to Enable the DSS Button, then click that Button
        self.clickDssServiceBox()
        self.clickEnableDssButton()

        # Verify the next screen for Smartsense Id is visible
        self.checkElementonPage(
            locatorName=self.getSmartsenseId(returnLocatorName=True),
            locatorMessage='Smartsense ID Input Field',
            retryCount=4)
        SeleniumDP.sendKeys(self.getSmartsenseId(), smartsenseId)

        # Click Next Button
        self.clickNextButton()

        # Verify the message that service is enabled is displayed
        self.checkElementonPage(
            locatorName=self.getSuccessHeading(returnLocatorName=True),
            locatorMessage=
            'Success Heading for DSS Service Enablement Displayed',
            retryCount=4)
Beispiel #7
0
 def clickDestinationClusterDropdownItem1(self):
     self.checkElementonPage(
         locatorName=self.getDestinationClusterDropdownItem1(
             returnLocatorName=True),
         locatorMessage='Destination Cluster Dropdown Item #1 Visible')
     SeleniumDP.click(self.driver,
                      self.getDestinationClusterDropdownItem1())
Beispiel #8
0
 def clickPolicyEntryActionsDropdown(self, retryCount=3, timeout=10):
     self.checkElementonPage(
         locatorName=self.getPolicyEntryActionsDropdown(),
         locatorMessage='Policy Entry Drop Down Present',
         retryCount=retryCount,
         timeout=timeout)
     SeleniumDP.click(self.driver, self.getPolicyEntryActionsDropdown())
Beispiel #9
0
 def clickClusterDetailsDropDownClusterOne(self):
     self.checkElementonPage(
         locatorName=self.getClusterDetailsDropDownClusterOne(
             returnLocatorName=True),
         locatorMessage='Clusters Details DropDown',
         retryCount=2)
     SeleniumDP.click(self.driver,
                      self.getClusterDetailsDropDownClusterOne())
Beispiel #10
0
 def viewPolicyLog(self, policyName):
     SeleniumDP.sendKeys(self.getFilterInput(), policyName + '\n')
     self.clickPolicyEntryActionsDropdown()
     self.checkElementonPage(
         locatorName=self.getPolicyEntryActionsViewLog(),
         locatorMessage='Suspend Action Button Visible',
         retryCount=3,
         timeout=5)
     SeleniumDP.click(self.driver, self.getPolicyEntryActionsViewLog())
Beispiel #11
0
 def signOutUnauthorizedUser(self):
     unauthorizedUserNotificationTitleExists = self.checkElementonPage(
         locatorName=self.getUnauthorizedNotificationTitleElement(
             returnLocatorName=True),
         locatorMessage='User Status label ',
         retryCount=15)
     if unauthorizedUserNotificationTitleExists:
         SeleniumDP.click(self.driver,
                          self.getUnauthorizedNotificationSignOutElement())
Beispiel #12
0
 def getLoggedInUserName(self):
     SeleniumDP.click(self.driver, self.getLogoutMenu())
     self.checkElementonPage(
         locatorName=self.getLoggedInUser(returnLocatorName=True),
         locatorMessage='Logout Button',
         retryCount=4,
         timeout=0.5)
     loggedInUser = self.getLoggedInUser().text
     SeleniumDP.click(self.driver, self.getLoggedInUser())
     return loggedInUser
Beispiel #13
0
 def setCustomMaskingOption(self, driver, customMaskValue):
     self.clickOnAddMaskingOptionsBtn(driver)
     self.waitForElement(
         self,
         self.getMaskingOptionHeadingInMaskingPopup(returnLocatorName=True))
     self.clickOnCustomMaskOptionRadioBtnInPopup(driver)
     self.clickOnTickBtnToAddMaskOptionsInPopup(driver)
     self.waitForElement(
         self,
         self.getInputBoxForEnteringCustomMaskValue(returnLocatorName=True))
     SeleniumDP.sendKeys(self.getInputBoxForEnteringCustomMaskValue(),
                         customMaskValue)
Beispiel #14
0
 def clickClusterTableSortableHeader(self, clickableElement):
     """
     Clicks the Cluster Table Header element which comes in as the input
     argument
     """
     try:
         SeleniumDP.click(self.driver, clickableElement)
         logger.info("Clicked the element")
         return True
     except Exception as e:
         logger.info("Caught Exception: %s" % e)
         return False
Beispiel #15
0
 def checkIfSearchFilterElementIsClickable(self, searchFilterElement):
     if searchFilterElement.is_enabled():
         logger.info(
             "searchFilterElement is available and clickable, Proceeding to click ..."
         )
         SeleniumDP.click(self.driver, searchFilterElement)
         self.take_screenshot("checkIfSearchFilterElementIsClickable")
         return True
     else:
         logger.error("SearchFilterElement: %s is not enabled yet" %
                      searchFilterElement.text)
         return False
Beispiel #16
0
 def clickClusterDetailsDropDownClusterOneHdfsBrowserTmpDirElement(self):
     # First time loading of HDFS data is slow
     self.checkElementonPage(
         locatorName=self.
         getClusterDetailsDropDownClusterOneHdfsBrowserTmpDirElement(
             returnLocatorName=True),
         locatorMessage='HDFS Browser tmp Dir Displayed',
         timeout=10,
         retryCount=5)
     SeleniumDP.click(
         self.driver,
         self.getClusterDetailsDropDownClusterOneHdfsBrowserTmpDirElement())
Beispiel #17
0
 def clickClusterRowButton(self, buttonRowNum):
     xpathForRowButton = "//table/tbody/tr[%s]/td[8]/button" % buttonRowNum
     InfraLandingPage.locator_dictionary["clusterRowButton"] = (
         By.XPATH, xpathForRowButton)
     if self.getClusterRowButton().is_enabled():
         logger.info(
             "Button is available and clickable, Proceeding to click ...")
         SeleniumDP.click(self.driver, self.getClusterRowButton())
         return True
     else:
         logger.error(
             "ClusterRowButton not clickable, might need a retry !!!")
         return False
Beispiel #18
0
 def validatePolicyStatusOnUI(self, policyName, action):
     if action == 'Delete':
         SeleniumDP.sendKeys(self.getFilterInput(), policyName)
         assert self.checkElementonPage(
             locatorName=self.getElement('policyDoesntExistInFilter',
                                         returnLocatorName=True),
             locatorMessage='No Data to Show Message',
             retryCount=3,
             timeout=5)
     elif action == 'Suspend':
         assert self.getPolicyStatusOnUI(policyName).text == 'SUSPENDED'
     elif action == 'Activate':
         assert self.getPolicyStatusOnUI(policyName).text == 'ACTIVE'
Beispiel #19
0
 def removeAllSearchFiltersApplied(self):
     """
     Removes all the search filters applied on the cluster table
     """
     searchFiltersApplied = self.getAllSearchFiltersApplied()
     if searchFiltersApplied:
         for searchFilter in searchFiltersApplied:
             SeleniumDP.click(self.driver, searchFilter)
         logger.info("%s filter/s removed" % len(searchFiltersApplied))
         return True
     else:
         logger.info("No filters are applied")
         return False
Beispiel #20
0
 def policyAction(self, policyName, action):
     self.checkElementonPage(
         locatorName=self.getFilterInput(returnLocatorName=True),
         locatorMessage='Filter field visible',
         retryCount=3)
     SeleniumDP.sendKeys(self.getFilterInput(), policyName + '\n')
     self.clickPolicyEntryActionsDropdown()
     if action == 'Delete':
         self.clickPolicyEntryActionsDelete()
     elif action == 'Suspend':
         self.clickPolicyEntryActionsSuspend()
     elif action == 'Activate':
         self.clickPolicyEntryActionsActivate()
     self.clickPolicyDialogYesButton()
Beispiel #21
0
 def createHiveReplicationPolicy(self,
                                 policyName,
                                 dbname,
                                 policyDescription='',
                                 policyFrequency='2',
                                 policyFrequencyUnit='minute'):
     self.clickAddPolicyButton()
     self.checkElementonPage(
         locatorName=self.getPolicyName(returnLocatorName=True),
         locatorMessage='Create Replication Policies Page',
         retryCount=1)
     SeleniumDP.sendKeys(self.getPolicyName(), policyName)
     SeleniumDP.sendKeys(self.getPolicyDescription(), policyDescription)
     self.clickPolicyTypeHive()
     self.clickSourceClusterDropdown()
     self.clickSourceClusterDropdownItem1()
     self.clickDestinationClusterDropdown()
     self.clickDestinationClusterDropdownItem1()
     SeleniumDP.sendKeys(self.getDBSearch(), dbname)
     self.clickDBEntry()
     self.clickPolicyStartFromNow()
     SeleniumDP.sendKeys(self.getPolicyFrequency(), policyFrequency)
     self.clickPolicyUnitDropdown()
     if policyFrequencyUnit == 'minute':
         self.clickPolicyUnitDropdownMinute()
     elif policyFrequencyUnit == 'hour':
         self.clickPolicyUnitDropdownHour()
     elif policyFrequencyUnit == 'day':
         self.clickPolicyUnitDropdownDay()
     else:
         self.clickPolicyUnitDropdownWeek()
     self.clickPolicySubmitButton()
     self.clickPolicySubmitButton()
Beispiel #22
0
 def switchUserStatusToInactive(self):
     userStatusLabelExists = self.checkElementonPage(
         locatorName=self.getStatusSwitchLabelElement(
             returnLocatorName=True),
         locatorMessage='User Status label ',
         retryCount=15)
     if userStatusLabelExists:
         currentStatus = self.findElement(
             *self.locator_dictionary[self.getStatusSwitchLabelElement(
                 returnLocatorName=True)]).text
         if currentStatus.lower() == 'active':
             SeleniumDP.click(self.driver,
                              self.getStatusSwitchToggleElement())
         else:
             logger.info("--- Current user status is Inactive")
Beispiel #23
0
 def editClusterDatacenter(self, newClusterDatacenter):
     editClusterLocationExists = self.checkElementonPage(
         locatorName=self.getEditClusterLocationElement(
             returnLocatorName=True),
         locatorMessage='Edit Cluster Location',
         retryCount=2)
     editClusterDatacenterExists = self.checkElementonPage(
         locatorName=self.getEditClusterDatacenterElement(
             returnLocatorName=True),
         locatorMessage='Edit Cluster Datacenter',
         retryCount=2)
     if editClusterLocationExists and editClusterDatacenterExists:
         SeleniumDP.sendKeys(self.getEditClusterDatacenterElement(),
                             newClusterDatacenter)
         return
Beispiel #24
0
 def viewClusterDetails(self, clusterName):
     self.isInfraLandingPage(retryCount=2)
     clusterInfoTableExists = self.checkElementonPage(
         locatorName=self.getClusterInfoTable(returnLocatorName=True),
         locatorMessage='Clusters info table',
         retryCount=5)
     if clusterInfoTableExists:
         clusterInfoTableBody = self.findElement(
             *self.locator_dictionary[self.getClusterInfoTableBody(
                 returnLocatorName=True)])
         for row in clusterInfoTableBody.find_elements(By.TAG_NAME, 'tr'):
             columns = row.find_elements(By.TAG_NAME, 'td')
             if clusterName.lower() == columns[1].text.lower():
                 SeleniumDP.click(self.driver, columns[1])
                 break
Beispiel #25
0
    def addCluster(self, ambariURL, clusterLocation, dataCenter, tags, description, clickAddAndNewButton=False):

        self.enterAmbariURLAndValidate(ambariURL)

        SeleniumDP.sendKeys(self.getClusterLocationField(), clusterLocation)
        time.sleep(2)
        SeleniumDP.clickUsingClickable(self.getClusterLocationAutoComplete())
        SeleniumDP.sendKeys(self.getDataCenterField(), dataCenter)
        SeleniumDP.sendKeys(self.getTagsField(), tags)
        SeleniumDP.sendKeys(self.getDescriptionField(), description)
        if clickAddAndNewButton:
            self.clickAddAndNewButton()
            if self.isClearButtonDisplayed():
                self.waitForElement(self.getGoButton(returnLocatorName=True))
        else:
            self.clickAddButton()
Beispiel #26
0
 def editUser(self, username):
     self.isUsersPage()
     userInfoTableExists = self.checkElementonPage(
         locatorName=self.getUsersInfoTableBody(returnLocatorName=True),
         locatorMessage='Users info table',
         retryCount=15)
     if userInfoTableExists:
         userInfoTable = self.findElement(
             *self.locator_dictionary[self.getUsersInfoTableBody(
                 returnLocatorName=True)])
         for row in userInfoTable.find_elements(By.TAG_NAME, 'tr'):
             columns = row.find_elements(By.TAG_NAME, 'td')
             if username.lower() == columns[0].text.lower():
                 SeleniumDP.click(self.driver, columns[0])
                 self.take_screenshot("editUser")
                 break
Beispiel #27
0
    def enableDLM(self,
                  smartsenseId="A-12341234-C-12341234",
                  verifyInvalidSmartSenseId=False):
        # Click SideNav
        self.clickSideNavServices()

        # Verify Dlm Service Box is visible
        self.checkElementonPage(
            locatorName=self.getDlmServiceBox(returnLocatorName=True),
            locatorMessage='DLM Service Box',
            retryCount=4,
            timeout=0.5)

        # Click DlmServiceBox to Enable the DLM Button, then click that Button
        self.clickDlmServiceBox()
        self.clickEnableDlmButton()

        # Verify the next screen for Smartsense Id is visible
        self.checkElementonPage(
            locatorName=self.getSmartsenseId(returnLocatorName=True),
            locatorMessage='Smartsense ID Input Field',
            retryCount=4,
            timeout=0.5)
        SeleniumDP.sendKeys(self.getSmartsenseId(), smartsenseId)

        # Verify Invalid SmartSenseId
        if verifyInvalidSmartSenseId:
            self.clickVerifyButton()
            assert self.checkElementonPage(
                locatorName=self.getSmartsenseIdIncorrectFormat(
                    returnLocatorName=True),
                locatorMessage=
                'Smartsense ID Incorrect Format Message Displayed',
                retryCount=1)
            self.clickCancelButton()
            return

        # Click Next Button
        self.clickNextButton()

        # Verify the message that service is enabled is displayed
        self.checkElementonPage(
            locatorName=self.getSuccessHeading(returnLocatorName=True),
            locatorMessage=
            'Success Heading for DLM Service Enablement Displayed',
            retryCount=4,
            timeout=2)
Beispiel #28
0
 def enterGroup(self, group, attempts=2):
     SeleniumDP.sendKeys(self.getGroupsInputField(), group)
     if self.checkElementonPage(
             locatorName=self.getGroupsDropdownSearchingRow(
                 returnLocatorName=True),
             locatorMessage='Groups DropDown Searching Row Visible',
             retryCount=1,
             timeout=1):
         self.waitForElementInvisibility(
             self.getGroupsDropdownSearchingRow(returnLocatorName=True))
     if self.checkElementonPage(
             locatorName=self.getGroupsDropdownRow(returnLocatorName=True),
             locatorMessage='Groups DropDown Visible',
             retryCount=1,
             timeout=1):
         SeleniumDP.click(self.driver, self.getGroupsDropdownRow())
     else:
         self.enterGroup(group, attempts=attempts - 1)
Beispiel #29
0
 def validateInvalidPolicyPath(self):
     self.clickAddPolicyButton()
     self.checkElementonPage(
         locatorName=self.getPolicyName(returnLocatorName=True),
         locatorMessage='Create Replication Policies Page',
         retryCount=1)
     SeleniumDP.sendKeys(self.getPolicyName(), "Invalid")
     self.clickPolicyTypeHdfs()
     self.clickSourceClusterDropdown()
     self.clickSourceClusterDropdownItem1()
     self.clickDestinationClusterDropdown()
     self.clickDestinationClusterDropdownItem1()
     SeleniumDP.sendKeys(self.getFolderPathInput(), "/AAAAA###BBTTT")
     self.clickFolderPathInputForm()
     time.sleep(2)
     self.clickFolderPathInputForm()
     assert self.checkElementonPage(
         locatorName=self.getFolderPathInputErrorMessage(
             returnLocatorName=True),
         locatorMessage='Invalid Path Error Message Visible',
         retryCount=2)
Beispiel #30
0
 def editClusterLocation(self, newClusterLocation):
     editClusterLocationExists = self.checkElementonPage(
         locatorName=self.getEditClusterLocationElement(
             returnLocatorName=True),
         locatorMessage='Edit Cluster Location',
         retryCount=2)
     if editClusterLocationExists:
         tries = 5
         while tries > 0:
             try:
                 SeleniumDP.sendKeys(self.getEditClusterLocationElement(),
                                     newClusterLocation)
                 clusterLocationDropdownVisible = self.waitForElement(
                     locatorName=self.getClusterLocationDropdownElement(
                         returnLocatorName=True))
                 if clusterLocationDropdownVisible:
                     clusterLocationDropdown = self.findElement(
                         *self.locator_dictionary[
                             self.getClusterLocationDropdownElement(
                                 returnLocatorName=True)])
                     options = clusterLocationDropdown.find_elements(
                         By.TAG_NAME, 'li')
                     for option in options:
                         if option:
                             SeleniumDP.sendKeys(
                                 self.getEditClusterLocationElement(),
                                 newClusterLocation + Keys.ENTER)
                             if self.checkElementonPage(
                                     locatorName=self.
                                     getEditClusterLocationErrorTextElement(
                                         returnLocatorName=True),
                                     locatorMessage='Cluster Location Error'
                             ):
                                 raise ValueError(
                                     'Cluster Location Error text found')
                             return
             except:
                 self.take_screenshot("editClusterLocation")
                 tries = tries - 1