Reformat pages/login.py
This commit is contained in:
Родитель
394a3c0568
Коммит
1d754fa2d7
|
@ -11,7 +11,7 @@ from selenium.webdriver.support import expected_conditions as expected
|
|||
class LoginPage(Page):
|
||||
"""Page object model for the login."""
|
||||
|
||||
URL_TEMPLATE = '/{org}/login/'
|
||||
URL_TEMPLATE = "/{org}/login/"
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
|
@ -21,29 +21,29 @@ class LoginPage(Page):
|
|||
@property
|
||||
def alert(self):
|
||||
"""Return the alert element."""
|
||||
element = self.wait.until(expected.visibility_of_element_located((
|
||||
By.CSS_SELECTOR,
|
||||
".alert-danger",
|
||||
)))
|
||||
element = self.wait.until(
|
||||
expected.visibility_of_element_located((By.CSS_SELECTOR, ".alert-danger"))
|
||||
)
|
||||
return element.text
|
||||
|
||||
@property
|
||||
def profile_dropdown(self):
|
||||
"""Return the profile dropdown element."""
|
||||
element = self.wait.until(expected.visibility_of_element_located((
|
||||
By.CSS_SELECTOR,
|
||||
".dropdown--profile__username",
|
||||
)))
|
||||
element = self.wait.until(
|
||||
expected.visibility_of_element_located(
|
||||
(By.CSS_SELECTOR, ".dropdown--profile__username")
|
||||
)
|
||||
)
|
||||
return element.text
|
||||
|
||||
def enter_email(self, email):
|
||||
"""Enter the given user email."""
|
||||
input_email = self.find_element(By.ID, 'inputEmail')
|
||||
input_email = self.find_element(By.ID, "inputEmail")
|
||||
input_email.send_keys(email)
|
||||
|
||||
def enter_password(self, password):
|
||||
"""Enter the given user password."""
|
||||
input_password = self.find_element(By.ID, 'inputPassword')
|
||||
input_password = self.find_element(By.ID, "inputPassword")
|
||||
input_password.send_keys(password)
|
||||
|
||||
def click_login(self):
|
||||
|
@ -51,7 +51,7 @@ class LoginPage(Page):
|
|||
btn = self.find_element(By.CSS_SELECTOR, "button[type='submit']")
|
||||
btn.click()
|
||||
|
||||
def login(self, email='', password=''):
|
||||
def login(self, email="", password=""):
|
||||
"""Log in the user with the given credentials."""
|
||||
self.enter_email(email)
|
||||
self.enter_password(password)
|
||||
|
|
Загрузка…
Ссылка в новой задаче