class SetUp(): __driver = None __wait = None def __init__(self): self.__driver = DriverManager().get_instance().get_driver() self.__wait = DriverManager().get_instance().get_wait() def open_browser(self): self.__driver.get(HomePageURL) def close_browser(self): self.__driver.close()
def __init__(self): self.__driver = DriverManager().get_instance().get_driver() #self.open_browser(HomePageURL) self.__wait = DriverManager().get_instance().get_wait()
class MyAccount: __driver = None __wait = None __account_link = (By.LINK_TEXT, "ACCOUNT") __loggin_button = (By.NAME, "send") __pass_textbox = (By.ID, "pass") __email_textbox = (By.ID, "email") __invalid_pass_label = (By.CSS_SELECTOR ,"li > span") __create_account_link = (By.LINK_TEXT, "Create an Account") def __init__(self): self.__driver = DriverManager().get_instance().get_driver() #self.open_browser(HomePageURL) self.__wait = DriverManager().get_instance().get_wait() def select_a_link_of_my_account_menu(self,valor): self.__wait.until(EC.visibility_of_element_located(self.__account_link), "Error,") #self.__driver.find_element(self._account_link).click() self.__driver.find_element(By.LINK_TEXT, "ACCOUNT").click() self.__driver.find_element(By.LINK_TEXT, valor).click() def set_account_crendetials(self, email, password): self.__set_email_address(email) self.__set_password(password) def __set_email_address(self, email): self.__driver.find_element(*self.__email_textbox).send_keys(email) def __set_password(self, password): self.__driver.find_element(*self.__pass_textbox).send_keys(password) def click_login(self): self.__driver.find_element(*self.__loggin_button).click() def click_create_account(self): self.__driver.find_element(*self.__create_account_link).click() def validate_if_the_invalid_credentialsMSG_is_displayed(self): self.__wait.until(EC.visibility_of_element_located(self.__account_link), "Error,") actual_result = self.__driver.find_element(*self.__invalid_pass_label).text expected_result = "Invalid login or password." BuiltIn().should_be_equal(actual_result, expected_result, 'Error, the message is not displayed: ' + "Invalid login or password.")
def __init__(self): self.__driver = DriverManager().get_instance().get_driver() self.__wait = DriverManager().get_instance().get_wait()
class CreateAccount: __driver = None __wait = None __register_button = (By.CSS_SELECTOR, "div.buttons-set > button.button") __create_account_form = (By.ID, "form-validate") __validate_hello = (By.CSS_SELECTOR, "p.hello > strong") __firstname_text = (By.ID, "firstname") __lastname_text = (By.ID, "lastname") __email_address_text = (By.ID, "email_address") __password_text = (By.ID, "password") __confirmation_text = (By.ID, "confirmation") def __init__(self): self.__driver = DriverManager().get_instance().get_driver() #self.open_browser(HomePageURL) self.__wait = DriverManager().get_instance().get_wait() def create_new_account(self, firstName, lastName, emailAddress, passw, confirmPassw): self.__wait.until(EC.visibility_of_element_located(self.__create_account_form), "Error,") #self.__wait.until(EC.presence_of_all_elements_located(self.__create_account_form), "Error,") self.__driver.find_element(*self.__firstname_text).send_keys(firstName) self.__driver.find_element(*self.__lastname_text).send_keys(lastName) self.__driver.find_element(*self.__email_address_text).send_keys(emailAddress) self.__driver.find_element(*self.__password_text).send_keys(passw) self.__driver.find_element(*self.__confirmation_text).send_keys(confirmPassw) def click_register(self): self.__driver.find_element(*self.__register_button).click() def validate_if_the_My_Dashboard_page_is_displayed(self, firstname, lastname): self.__wait.until(EC.visibility_of_element_located(self.__validate_hello), "Error,") actual_result = self.__driver.find_element(*self.__validate_hello).text expected_result = "Hello, "+firstname+" "+lastname+"!" BuiltIn().should_be_equal(actual_result, expected_result, 'Error, the message is not displayed: ' + "Invalid login or password.")