Add some improvements to the login methods (#811)

This commit is contained in:
Alexandra Gal-Moga 2023-06-19 16:49:52 +03:00 коммит произвёл GitHub
Родитель f0566c729c
Коммит 4cd404a632
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 15 добавлений и 13 удалений

Просмотреть файл

@ -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'