from .base_page import BasePage
from selenium.webdriver.common.by import By
from .locators import LoginPageLocators


class LoginPage(BasePage):
    def should_be_login_page(self):
        self.should_be_login_url()
        self.should_be_login_form()
        self.should_be_register_form()

    def should_be_login_url(self):
        # реализуйте проверку на корректный url адрес
        assert 'login' in self.browser.current_url

    def should_be_login_form(self):
        # реализуйте проверку, что есть форма логина
        assert self.is_element_present(*LoginPageLocators.ENTER_EMAIL), "login_form email_field is not presented"
        assert self.is_element_present(*LoginPageLocators.ENTER_PASSWORD), "login_form password_field is not presented"

    def should_be_register_form(self):
        # реализуйте проверку, что есть форма регистрации на странице
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_EMAIL), "registration_form email_field is not presented"
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD), "registration_form password_field is not presented"
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD_DUPLICATE), "registration_form password_reenter_field is not presented"
        
    def register_new_user(self, email, password):
        self.email = email
        self.password = password
        
        self.browser.find_element(*LoginPageLocators.REGISTRATION_EMAIL).send_keys(self.email)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD_DUPLICATE).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_BUTTON).click()
4c85b95cfe5e26a4b45ebc67db71ae0e7121fdb4
<mask token>


class LoginPage(BasePage):
    <mask token>

    def should_be_login_url(self):
        assert 'login' in self.browser.current_url
    <mask token>

    def should_be_register_form(self):
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_EMAIL
            ), 'registration_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD
            ), 'registration_form password_field is not presented'
        assert self.is_element_present(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE
            ), 'registration_form password_reenter_field is not presented'

    def register_new_user(self, email, password):
        self.email = email
        self.password = password
        self.browser.find_element(*LoginPageLocators.REGISTRATION_EMAIL
            ).send_keys(self.email)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD
            ).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_BUTTON
            ).click()

<mask token>


class LoginPage(BasePage):
    <mask token>

    def should_be_login_url(self):
        assert 'login' in self.browser.current_url

    def should_be_login_form(self):
        assert self.is_element_present(*LoginPageLocators.ENTER_EMAIL
            ), 'login_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.ENTER_PASSWORD
            ), 'login_form password_field is not presented'

    def should_be_register_form(self):
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_EMAIL
            ), 'registration_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD
            ), 'registration_form password_field is not presented'
        assert self.is_element_present(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE
            ), 'registration_form password_reenter_field is not presented'

    def register_new_user(self, email, password):
        self.email = email
        self.password = password
        self.browser.find_element(*LoginPageLocators.REGISTRATION_EMAIL
            ).send_keys(self.email)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD
            ).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_BUTTON
            ).click()

<mask token>


class LoginPage(BasePage):

    def should_be_login_page(self):
        self.should_be_login_url()
        self.should_be_login_form()
        self.should_be_register_form()

    def should_be_login_url(self):
        assert 'login' in self.browser.current_url

    def should_be_login_form(self):
        assert self.is_element_present(*LoginPageLocators.ENTER_EMAIL
            ), 'login_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.ENTER_PASSWORD
            ), 'login_form password_field is not presented'

    def should_be_register_form(self):
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_EMAIL
            ), 'registration_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD
            ), 'registration_form password_field is not presented'
        assert self.is_element_present(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE
            ), 'registration_form password_reenter_field is not presented'

    def register_new_user(self, email, password):
        self.email = email
        self.password = password
        self.browser.find_element(*LoginPageLocators.REGISTRATION_EMAIL
            ).send_keys(self.email)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD
            ).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_BUTTON
            ).click()

from .base_page import BasePage
from selenium.webdriver.common.by import By
from .locators import LoginPageLocators


class LoginPage(BasePage):

    def should_be_login_page(self):
        self.should_be_login_url()
        self.should_be_login_form()
        self.should_be_register_form()

    def should_be_login_url(self):
        assert 'login' in self.browser.current_url

    def should_be_login_form(self):
        assert self.is_element_present(*LoginPageLocators.ENTER_EMAIL
            ), 'login_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.ENTER_PASSWORD
            ), 'login_form password_field is not presented'

    def should_be_register_form(self):
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_EMAIL
            ), 'registration_form email_field is not presented'
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD
            ), 'registration_form password_field is not presented'
        assert self.is_element_present(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE
            ), 'registration_form password_reenter_field is not presented'

    def register_new_user(self, email, password):
        self.email = email
        self.password = password
        self.browser.find_element(*LoginPageLocators.REGISTRATION_EMAIL
            ).send_keys(self.email)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD
            ).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.
            REGISTRATION_PASSWORD_DUPLICATE).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_BUTTON
            ).click()

from .base_page import BasePage
from selenium.webdriver.common.by import By
from .locators import LoginPageLocators


class LoginPage(BasePage):
    def should_be_login_page(self):
        self.should_be_login_url()
        self.should_be_login_form()
        self.should_be_register_form()

    def should_be_login_url(self):
        # реализуйте проверку на корректный url адрес
        assert 'login' in self.browser.current_url

    def should_be_login_form(self):
        # реализуйте проверку, что есть форма логина
        assert self.is_element_present(*LoginPageLocators.ENTER_EMAIL), "login_form email_field is not presented"
        assert self.is_element_present(*LoginPageLocators.ENTER_PASSWORD), "login_form password_field is not presented"

    def should_be_register_form(self):
        # реализуйте проверку, что есть форма регистрации на странице
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_EMAIL), "registration_form email_field is not presented"
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD), "registration_form password_field is not presented"
        assert self.is_element_present(*LoginPageLocators.REGISTRATION_PASSWORD_DUPLICATE), "registration_form password_reenter_field is not presented"
        
    def register_new_user(self, email, password):
        self.email = email
        self.password = password
        
        self.browser.find_element(*LoginPageLocators.REGISTRATION_EMAIL).send_keys(self.email)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_PASSWORD_DUPLICATE).send_keys(self.password)
        self.browser.find_element(*LoginPageLocators.REGISTRATION_BUTTON).click()