Add some improvements to the login methods (#811)
This commit is contained in:
Родитель
f0566c729c
Коммит
4cd404a632
|
@ -54,7 +54,15 @@ class Base(Page):
|
|||
count = 0
|
||||
while count < 5:
|
||||
try:
|
||||
self.is_element_displayed(*self.header._user_locator)
|
||||
self.wait.until(
|
||||
EC.visibility_of_element_located(
|
||||
(
|
||||
By.CSS_SELECTOR,
|
||||
'.Header-user-and-external-links .DropdownMenu-button-text',
|
||||
)
|
||||
),
|
||||
message='LOGIN FAILED: The user name was not displayed in the header after login.',
|
||||
)
|
||||
break
|
||||
except StaleElementReferenceException as exception:
|
||||
print(f'{exception}: Try to find the element again')
|
||||
|
@ -73,12 +81,6 @@ class Base(Page):
|
|||
message=f'FxA email input field was not displayed in {self.driver.current_url}',
|
||||
)
|
||||
fxa.account(user)
|
||||
# wait for transition between FxA page and AMO (URL and page)
|
||||
self.wait.until(
|
||||
EC.url_contains('addons'),
|
||||
message=f'AMO could not be loaded in {self.driver.current_url}'
|
||||
f'Response status code was {requests.head(self.driver.current_url).status_code}',
|
||||
)
|
||||
# verifies that the AMO page was fully loaded after login
|
||||
WebDriverWait(self.driver, 30).until(
|
||||
EC.invisibility_of_element_located((By.CLASS_NAME, 'LoadingText')),
|
||||
|
|
|
@ -169,12 +169,6 @@ class DevHubHome(Base):
|
|||
message=f'FxA email input field was not displayed in {self.driver.current_url}',
|
||||
)
|
||||
fxa.account(user)
|
||||
# wait for transition between FxA page and Devhub
|
||||
self.wait.until(
|
||||
EC.url_contains('developers'),
|
||||
message=f'Devhub could not be loaded in {self.driver.current_url}'
|
||||
f'Response status code was {requests.head(self.driver.current_url).status_code}',
|
||||
)
|
||||
# assess that the user has been logged in
|
||||
self.wait.until(
|
||||
lambda _: self.sign_out_link.is_displayed(),
|
||||
|
|
|
@ -111,6 +111,12 @@ class Login(Base):
|
|||
message='There was no input added in the password field',
|
||||
)
|
||||
self.find_element(*self._login_btn_locator).click()
|
||||
# wait for transition between FxA page and AMO
|
||||
self.wait.until(
|
||||
EC.url_contains('addons'),
|
||||
message=f'AMO could not be loaded in {self.driver.current_url}. '
|
||||
f'Response status code was {requests.head(self.driver.current_url).status_code}',
|
||||
)
|
||||
|
||||
def fxa_register(self):
|
||||
email = f'{reusables.get_random_string(10)}@restmail.net'
|
||||
|
|
Загрузка…
Ссылка в новой задаче