class ForgotPasswordPage: def __init__(self, browser: Remote): self._browser = browser self._users_email = PersonalDetails(browser) def open(self, device: Device) -> None: self._browser.get( f"https://{device.connections.main.ip}/index.php?route=account/forgotten" ) def loaded(self) -> bool: return "Forgot Your Password?" in self._browser.title def fill_email(self, email: str) -> None: self._users_email.type_email(email) def press_continue_button(self) -> None: self._browser.find_element_by_xpath( "//*[@id='content']/form/div/div[2]/input").click()
class LoginPage(Page): def __init__(self, browser: Remote) -> None: self._browser = browser self._email = PersonalDetails(browser) self._password = Password(browser) def load(self, device: Device) -> None: self._browser.get( f"https://{device.connections.main.ip}/index.php?route=account/login" ) def available(self) -> bool: return "Account Login" in self._browser.title def fill_credentials(self, email_address: str, password: str) -> None: self._email.type_email(email_address) self._password.type_password(password) def press_login_button(self) -> None: self._browser.find_element_by_xpath('//input[@value="Login"]').click()
class ContactUsPage(Page): def __init__(self, browser: Remote) -> None: self._browser = browser self._details = ContactDetails(browser) self._email = PersonalDetails(browser) def open(self, device: Device) -> None: self._browser.get( f"https://{device.connections.main.ip}/index.php?route=information/contact" ) def loaded(self) -> bool: return "Contact Us" in self._browser.title def fill_contact_details(self, your_name: str, email: str, enquiry: str) -> None: self._details.type_your_name(your_name) self._email.type_email(email) self._details.type_enquiry(enquiry) def press_submit(self) -> None: self._browser.find_element_by_css_selector("input.btn").click()
class ReturnsPage(Page): def __init__(self, browser: Remote) -> None: self._browser = browser self.personal_details = PersonalDetails(browser) self._order_details = OrderDetails(browser) self._product_details = ProductDetails(browser) def open(self, device: Device) -> None: self._browser.get( f"https://{device.connections.main.ip}/index.php?route=account/return/add" ) def loaded(self) -> bool: return "Account Login" in self._browser.title def fill_personal_details( self, first_name: str, last_name: str, email: str, telephone: str ) -> None: self.personal_details.type_first_name(first_name) self.personal_details.type_last_name(last_name) self.personal_details.type_email(email) self.personal_details.type_telephone(telephone) def fill_order_details(self, order_id: str, order_date: str) -> None: self._order_details.type_order_id(order_id) self._order_details.type_order_date(order_date) def fill_product_details( self, product_name: str, product_code: str, quantity: str, faulty: str ) -> None: self._product_details.type_product_name(product_name) self._product_details.type_product_code(product_code) self._product_details.type_quantity(quantity) self._product_details.type_faulty(faulty) def choose_reason_and_condition(self, reason: Reason, product_condition: Condition) -> None: self._browser.find_element_by_xpath( f"//*[contains(@name, 'return_reason_id') and contains(@value, {reason.value})]" ).click() self._browser.find_element_by_xpath( f"//*[contains(@name, 'opened') and contains(@value, {product_condition.value})]" ).click() def press_submit(self) -> None: self._browser.find_element_by_xpath("//input[@value='Submit']").click()
class RegisterAffiliatePage(Page): def __init__(self, browser: Remote) -> None: self._browser = browser self._personal_details = PersonalDetails(browser) self._information = AffiliateInformation(browser) self._password = Password(browser) self._press_continue = RegisterAccountPage(browser) def open(self, device: Device) -> None: self._browser.get( f"https://{device.connections.main.ip}/index.php?route=affiliate/register" ) def loaded(self) -> bool: return "Affiliate Program" in self._browser.title def fill_personal_details(self, first_name: str, last_name: str, email: str, telephone: str) -> None: self._personal_details.type_first_name(first_name) self._personal_details.type_last_name(last_name) self._personal_details.type_email(email) self._personal_details.type_telephone(telephone) def press_pay_method(self) -> None: self._browser.find_element_by_xpath( "/html/body/div[2]/div/div/form/fieldset[2]/div[4]/div/div[2]/label/input" ).click() def fill_information(self, company: str, website: str, tax: str, paypal: str) -> None: self._information.type_company(company) self._information.type_website(website) self._information.type_tax(tax) self._information.type_paypal(paypal) def fill_password(self, passwords: str) -> None: self._password.type_password(passwords) self._password.confirm_password(passwords) def press_continue(self) -> None: self._press_continue.press_continue()
def __init__(self, browser: Remote): self._browser = browser self._users_email = PersonalDetails(browser)
def __init__(self, browser: Remote) -> None: self._browser = browser self._email = PersonalDetails(browser) self._password = Password(browser)
def __init__(self, browser: Remote) -> None: self._browser = browser self._details = ContactDetails(browser) self._email = PersonalDetails(browser)
def __init__(self, browser: Remote) -> None: self._browser = browser self.personal_details = PersonalDetails(browser) self._order_details = OrderDetails(browser) self._product_details = ProductDetails(browser)
def __init__(self, browser: Remote) -> None: self._browser = browser self._personal_details = PersonalDetails(browser) self._information = AffiliateInformation(browser) self._password = Password(browser) self._press_continue = RegisterAccountPage(browser)