diff --git a/pages/base.py b/pages/base.py index 574faf0..8e63166 100644 --- a/pages/base.py +++ b/pages/base.py @@ -88,6 +88,9 @@ class Base(Page): from pages.profile import Profile return Profile(self.testsetup) + def logout_using_url(self): + self.get_relative_path(u'/logout') + class Header(Page): _search_box_locator = (By.CSS_SELECTOR, 'input.search-query') diff --git a/pages/home_page.py b/pages/home_page.py index 7a95265..a17f86c 100644 --- a/pages/home_page.py +++ b/pages/home_page.py @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - +from selenium.webdriver.support.ui import WebDriverWait from pages.base import Base @@ -14,3 +14,11 @@ class Home(Base): Base.__init__(self, testsetup) if open_url: self.selenium.get(self.base_url) + + def wait_for_user_login(self): + # waits to see if user gets logged back in + # if not then all ok + try: + WebDriverWait(self.selenium, 20).until(lambda s: self.is_user_loggedin) + except Exception: + pass diff --git a/tests/test_account.py b/tests/test_account.py index 35e6ce7..db88e8f 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -22,6 +22,19 @@ class TestAccount: home_page.header.click_logout_menu_item() Assert.true(home_page.is_browserid_link_present) + @pytest.mark.nondestructive + def test_logout_verify_bid(self, mozwebqa): + # issue https://github.com/mozilla/mozillians-tests/issues/99 + + home_page = Home(mozwebqa) + Assert.true(home_page.is_csrf_token_present) + home_page.login() + Assert.true(home_page.header.is_logout_menu_item_present) + home_page.logout_using_url() + + home_page.wait_for_user_login() + Assert.true(home_page.is_browserid_link_present) + @pytest.mark.skip_selenium @pytest.mark.nondestructive def test_that_links_in_footer_return_200_code(self, mozwebqa):