diff --git a/pages/base.py b/pages/base.py index 30b993f..be53f9b 100644 --- a/pages/base.py +++ b/pages/base.py @@ -83,7 +83,7 @@ class Base(Page): _search_box_locator = (By.CSS_SELECTOR, '.search-query') _search_box_loggedin_locator = (By.CSS_SELECTOR, '.search-right > form > .search-query') - _profile_menu_locator = (By.CSS_SELECTOR, '#nav-main > a.dropdown-toggle') + _profile_menu_locator = (By.CSS_SELECTOR, '#nav-main > a.dropdown-toggle i') # menu items _dropdown_menu_locator = (By.CSS_SELECTOR, 'ul.dropdown-menu') @@ -108,6 +108,7 @@ class Base(Page): return Search(self.base_url, self.selenium) def click_options(self): + self.wait_for_element_present(*self._profile_menu_locator) self.selenium.find_element(*self._profile_menu_locator).click() WebDriverWait(self.selenium, self.timeout).until(lambda s: self.selenium.find_element(*self._dropdown_menu_locator)) diff --git a/pages/settings.py b/pages/settings.py index a1c9182..f19bd15 100644 --- a/pages/settings.py +++ b/pages/settings.py @@ -33,6 +33,7 @@ class Settings(Base): @property def profile(self): + self.wait_for_element_present(*self._profile_button_locator) self.selenium.find_element(*self._profile_button_locator).click() return self.ProfileTab(self.base_url, self.selenium, self.selenium.find_element(*self._profile_tab_locator)) @@ -157,8 +158,7 @@ class Settings(Base): def click_update(self): self._root_element.find_element(*self._update_locator).click() - self.wait_for_element_not_present(*self._update_locator) - self.wait_for_element_present(*self._update_locator) + self.wait_for_page_loaded() class YouAndMozilla(PageRegion): diff --git a/tests/test_profile.py b/tests/test_profile.py index 58c1b82..26f0fba 100644 --- a/tests/test_profile.py +++ b/tests/test_profile.py @@ -86,8 +86,6 @@ class TestProfile: skills_form.click_update() settings = home_page.header.click_settings_menu_item() - # TODO: Try to remove the sleep after https://bugzilla.mozilla.org/show_bug.cgi?id=1291320 is fixed. - time.sleep(2) skills_form = settings.profile.skills skills_form.delete_skill("hello world") skills_form.click_update()