Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #738 from davehunt/pull1558
Browse files Browse the repository at this point in the history
Remove check for sign out button due to removal in #1558
  • Loading branch information
bobsilverberg committed Nov 23, 2015
2 parents 8daa311 + 2408d1a commit 0e17abb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 30 deletions.
9 changes: 0 additions & 9 deletions pages/desktop/consumer_pages/account_settings.py
Expand Up @@ -20,7 +20,6 @@ class AccountSettings(Base):
_header_title_locator = (By.CSS_SELECTOR, 'header.c > h1')
_payment_page_locator = (By.ID, 'purchases')
_settings_sign_in_locator = (By.CSS_SELECTOR, '.account-settings-save a:not(.register)')
_settings_sign_out_locator = (By.CSS_SELECTOR, '.account-settings-save .logout')

def go_to_settings_page(self):
self.set_window_size()
Expand All @@ -34,9 +33,6 @@ def header_title(self):
def click_sign_in(self):
self.find_element(*self._settings_sign_in_locator).click()

def click_sign_out(self):
self.find_element(*self._settings_sign_out_locator).click()


class BasicInfo(AccountSettings):
"""
Expand All @@ -50,7 +46,6 @@ class BasicInfo(AccountSettings):
_display_name_input_locator = (By.ID, 'display_name')
_save_button_locator = (By.CSS_SELECTOR, '.button[type="submit"]')
_multiple_language_select_locator = (By.ID, 'language')
_sign_out_button_locator = (By.CSS_SELECTOR, '.button.logout')
_account_settings_header_locator = (By.CSS_SELECTOR, '#account-settings > h2')
_display_field_name_text_locator = (By.CSS_SELECTOR, '.form-label>label[for="id_display_name"]')
_language_field_text_locator = (By.CSS_SELECTOR, '.form-label>label[for="language"]')
Expand Down Expand Up @@ -88,10 +83,6 @@ def edit_display_name(self, text):
def is_save_button_visible(self):
return self.is_element_visible(*self._save_button_locator)

@property
def is_sign_out_button_visible(self):
return self.is_element_visible(*self._sign_out_button_locator)

@property
def account_settings_header_text(self):
return self.selenium.find_element(*self._account_settings_header_locator).text
Expand Down
17 changes: 17 additions & 0 deletions pages/mobile/base.py
Expand Up @@ -20,6 +20,7 @@ class Base(Page):
_sites_locator = (By.CSS_SELECTOR, '#navigation a[data-nav-type="websites"]')
_close_banner_button_locator = (By.CLASS_NAME, 'mkt-banner-close')
_bag_icon_locator = (By.CLASS_NAME, 'mkt-wordmark')
_sign_in_locator = (By.CSS_SELECTOR, '.account-settings-save a:not(.register)')

def set_window_size(self):
# This method can be called to force the browser to a mobile screen
Expand Down Expand Up @@ -94,6 +95,10 @@ def go_to_first_free_app_page(self):
results_page = self.header.search(':free')
return results_page.items()[0].click()

@property
def is_sign_in_visible(self):
return self.is_element_visible(*self._sign_in_locator)

class Application(PageRegion):

_name_locator = (By.CSS_SELECTOR, '.mkt-product-name')
Expand Down Expand Up @@ -154,6 +159,7 @@ class MoreMenu(Base):
_more_menu_locator = (By.CLASS_NAME, 'more-menu-overlay')
_settings_menu_item_locator = (By.CLASS_NAME, 'more-menu-settings')
_sign_in_menu_item_locator = (By.CLASS_NAME, 'more-menu-sign-in')
_sign_out_menu_item_locator = (By.CLASS_NAME, 'more-menu-sign-out')
_new_menu_item_locator = (By.CSS_SELECTOR, '.mkt-nav--link[href*="new"]')
_popular_menu_item_locator = (By.CSS_SELECTOR, '.mkt-nav--link[href*="popular"]')
_categories_menu_item_locator = (By.CSS_SELECTOR, '.mkt-nav--link[title="Categories"]')
Expand All @@ -177,3 +183,14 @@ def click_sign_in(self):
sign_in_item = self.selenium.find_element(*self._sign_in_menu_item_locator)
self.scroll_to_element(sign_in_item)
sign_in_item.click()

def click_sign_out(self):
self.open()
el = self.selenium.find_element(*self._sign_out_menu_item_locator)
self.scroll_to_element(el)
el.click()
from pages.mobile.home import Home
home = Home(self.testsetup)
WebDriverWait(self.selenium, self.timeout).until(
lambda s: home.is_sign_in_visible)
return home
16 changes: 0 additions & 16 deletions pages/mobile/settings.py
Expand Up @@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

from pages.mobile.base import Base

Expand All @@ -15,8 +14,6 @@ class Settings(Base):
_page_title = "Account Settings | Firefox Marketplace"

_email_locator = (By.CSS_SELECTOR, '.settings-email.account-field > p')
_sign_out_locator = (By.CSS_SELECTOR, '.button.action.logout')
_sign_in_locator = (By.CSS_SELECTOR, '.account-settings-save a:not(.register)')

@property
def email_text(self):
Expand All @@ -26,19 +23,6 @@ def email_text(self):
def wait_for_user_email_visible(self):
self.wait_for_element_visible(*self._email_locator)

def click_sign_out(self):
sign_out_button = self.selenium.find_element(*self._sign_out_locator)
self.scroll_to_element(sign_out_button)
sign_out_button.click()
sign_in_button = self.selenium.find_element(*self._sign_in_locator)
WebDriverWait(self.selenium, self.timeout).until(lambda s: sign_in_button.is_displayed())
from pages.mobile.home import Home
return Home(self.testsetup)

def click_sign_in(self):
self.wait_for_element_visible(*self._sign_in_locator)
self.selenium.find_element(*self._sign_in_locator).click()

@property
def is_sign_in_visible(self):
return self.is_element_visible(*self._sign_in_locator)
1 change: 0 additions & 1 deletion tests/desktop/consumer_pages/test_home_page.py
Expand Up @@ -88,7 +88,6 @@ def test_settings_dropdown_menu(self, mozwebqa, new_user):
assert user_settings.is_display_name_visible
assert user_settings.is_region_field_visible
assert user_settings.is_save_button_visible
assert user_settings.is_sign_out_button_visible

@pytest.mark.sanity
@pytest.mark.credentials
Expand Down
2 changes: 1 addition & 1 deletion tests/desktop/consumer_pages/test_users_account.py
Expand Up @@ -58,7 +58,7 @@ def test_user_can_sign_in_and_sign_out_from_settings_page(self, mozwebqa, new_us
assert settings_page.header.is_user_logged_in
assert not settings_page.header.is_sign_in_visible

settings_page.click_sign_out()
settings_page.header.click_sign_out()
assert settings_page.header.is_sign_in_visible

def test_editing_user_profile(self, mozwebqa, new_user):
Expand Down
5 changes: 2 additions & 3 deletions tests/mobile/test_users_account.py
Expand Up @@ -20,9 +20,8 @@ def test_user_can_login_and_logout(self, mozwebqa, new_user):
home_page.login(new_user['email'], new_user['password'])
settings_page = home_page.more_menu.click_settings()
assert new_user['email'] == settings_page.email_text

settings_page.click_sign_out()
assert settings_page.is_sign_in_visible
home_page = settings_page.more_menu.click_sign_out()
assert home_page.is_sign_in_visible

@pytest.mark.nondestructive
def test_user_can_go_back_from_settings_page(self, mozwebqa, new_user):
Expand Down

0 comments on commit 0e17abb

Please sign in to comment.