Last active
August 29, 2015 14:01
-
-
Save cch5ng/285c6fd009225c873820 to your computer and use it in GitHub Desktop.
Working /tests/test_about_page.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| #!/usr/bin/env python | |
| # This Source Code Form is subject to the terms of the Mozilla Public | |
| # 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 pages.home import Home | |
| from pages.start_page import StartPage | |
| from unittestzero import Assert | |
| import pytest | |
| credentials = pytest.mark.credentials | |
| nondestructive = pytest.mark.nondestructive | |
| class TestAboutPage: | |
| @nondestructive | |
| def test_about_page_has_proper_titles(self, mozwebqa): | |
| start_page = StartPage(mozwebqa) | |
| home_page = Home(mozwebqa) | |
| about_page = home_page.click_faq_nav_button | |
| Assert.true(about_page.is_the_current_page) | |
| Assert.equal(start_page.header, 'About Firefox Affiliates') | |
| Assert.equal(start_page.section_header, 'Frequently Asked Questions') | |
| @credentials | |
| @nondestructive | |
| def test_login_logout_works_properly(self, mozwebqa): | |
| home_page = Home(mozwebqa) | |
| about_page = home_page.click_faq_nav_button | |
| home_page = about_page.login() | |
| Assert.true(home_page.is_user_logged_in, 'User not logged in') | |
| Assert.equal(home_page.header, 'Follow these easy steps to get started:') | |
| home_page.click_logout() | |
| Assert.false(home_page.is_user_logged_in, 'User logged in') | |
| Assert.equal(about_page.header, 'About Firefox Affiliates') | |
| Assert.equal(about_page.section_header, 'Frequently Asked Questions') | |
| @nondestructive | |
| def test_about_page_faq_category_present(self, mozwebqa): | |
| home_page = Home(mozwebqa) | |
| about_page = home_page.click_faq_nav_button | |
| Assert.true(about_page.questions_count(self) > 0) | |
| Assert.true(about_page.is_question_present(self)) | |
| @nondestructive | |
| def test_about_page_faq_questions_present(self, mozwebqa): | |
| home_page = Home(mozwebqa) | |
| about_page = home_page.click_faq_nav_button | |
| Assert.true(about_page.is_category_present(self)) | |
| @nondestructive | |
| def test_about_page_faq_answers_present(self, mozwebqa): | |
| home_page = Home(mozwebqa) | |
| about_page = home_page.click_faq_nav_button | |
| Assert.true(about_page.answer(about_page.questions_count(self)) != None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment