Ejemplo n.º 1
0
    def login_using_sso(self, user_name, password):
        '''
        Method to use when SSO is enabled. It will login using knox login form

        :param user_name:
        :param password:
        :return:
        '''
        logger.info("Logging with Username = {0}".format(user_name))
        username_xpath = SPARK_XPATH.sso_username
        password_xpath = SPARK_XPATH.sso_password
        login_btn_xpath = SPARK_XPATH.sso_login_btn
        login_error_xpath = SPARK_XPATH.sso_login_error
        assert Selenium.isElementVisibleInSometime(
            self.driver, xpath=username_xpath), "username field is not visible"
        username_field = Selenium.getElement(self.driver, xpath=username_xpath)
        Selenium.sendKeys(username_field, user_name)

        assert Selenium.isElementVisibleInSometime(
            self.driver, xpath=password_xpath), "password field is not visible"
        password_field = Selenium.getElement(self.driver, xpath=password_xpath)
        Selenium.sendKeys(password_field, password)

        assert Selenium.isElementVisibleInSometime(
            self.driver, xpath=login_btn_xpath), "login button is not visible"
        login_button = Selenium.getElement(self.driver, xpath=login_btn_xpath)
        Selenium.click(self.driver, login_button)
        logger.info("Clicked on login button")
        Selenium.waitTillElementDisappears(driver=self.driver,
                                           xpath=username_xpath,
                                           maxWait=20)
        assert not Selenium.isElementCurrentlyDisplayed(driver=self.driver, xpath=login_error_xpath), \
            "Login failed due to Invalid Username/password"
Ejemplo n.º 2
0
 def validate_job_page(self, user):
     '''
     Method to validate the contents of jobs page
     :param user:
     :return:
     '''
     assert "Completed Jobs" in Selenium.getElement(
         driver=self.driver,
         xpath=SPARK_XPATH.complted_job_info).text.strip()
     assert user in Selenium.getElement(
         driver=self.driver, xpath=SPARK_XPATH.user_info).text.strip()
     assert Selenium.isElementCurrentlyDisplayed(
         driver=self.driver, xpath=SPARK_XPATH.completed_job_table)
Ejemplo n.º 3
0
 def validate_stages_page(self):
     '''
     Method to validate the contents of stages page
     :return:
     '''
     assert "Completed Stages" in Selenium.getElement(
         driver=self.driver,
         xpath=SPARK_XPATH.complted_stage_info).text.strip()
     assert Selenium.isElementCurrentlyDisplayed(
         driver=self.driver, xpath=SPARK_XPATH.completed_stage_table)