示例#1
0
class TestHome(TestPyOrgBase):
    """
    TBD
    """
    def setUp(self):
        #parentdan browser set up çekiyor
        super().setUp()
        #Home page e gideceğini veriyor
        self.home = HomePage(self.driver)

    @unittest.skip('skip this test for example')
    def test_TC001_py3_doc_button(self):
        self.home.hover_to(CommonPageLocators.DOC)
        self.home.assert_elem_text(CommonPageLocators.PY3_DOC_BUTTON,
                                   'Python 3.x Docs')
        self.home.click(CommonPageLocators.PY3_DOC_BUTTON)
        assert self.driver.current_url == 'https://docs.python.org/3/'

    def test_TC002_blahblah_search(self):
        self.home.search_for('blahblah')
        self.home.assert_elem_text(CommonPageLocators.SEARCH_RESULT_LIST,
                                   'No results found.')

    #with unit test
    def test_TC004_assert_title(self):
        self.assertEqual(self.home.driver.title, "Welcome to Python.org")
示例#2
0
class TestHome(TestPyOrgBase):
    """
    TBD
    """
    def setUp(self):
        self.home = HomePage(TestHome.driver)

    # @unittest.skip('demonstrating skipping the test')
    def test_TC001_py3_doc_button(self):
        self.home.hover_to(CommonPageLocators.DOC)
        self.home.assert_elem_text(CommonPageLocators.PY3_DOC_BUTTON,
                                   'Python 3.x Docs')
        self.home.click(CommonPageLocators.PY3_DOC_BUTTON)
        assert self.driver.current_url == 'https://docs.python.org/3/'

    def test_TC002_blahblah_search(self):
        self.home.search_for('blahblah')
        self.home.assert_elem_text(CommonPageLocators.SEARCH_RESULT_LIST,
                                   'No results found.')

    # @unittest.skip
    def test_TC004_assert_title(self):
        self.assertEqual(self.home.driver.title, 'Welcome to Python.org')

    def test_TC006_main_menu(self):
        mm = [
            'about', 'downloads', 'documentation', 'community',
            'success-stories', 'news', 'events', 'DUMMY'
        ]
        for mmenu_item in mm:
            with self.subTest("asserting menu item: {}".format(mmenu_item)):
                assert self.home.driver.find_element_by_id(mmenu_item)
示例#3
0
class TestHome(TestPyOrgBase):
    def setUp(self):
        super().setUp()
        self.home = HomePage(self.driver)

    def test_TC001_py3_doc_button(self):
        self.home.hover_to(CommonPageLocators.DOC)
        self.home.assert_elem_text(CommonPageLocators.PY3_DOC_BUTTON,
                                   'Python 3.x Docs')
        self.home.click(CommonPageLocators.PY3_DOC_BUTTON)
        assert self.driver.current_url == 'https://docs.python.org/3/'

    def test_TC002_blahblah_search(self):
        self.home.search_for('blahblah')
        self.home.assert_elem_text(CommonPageLocators.SEARCH_RESULT_LIST,
                                   'No results found.')
示例#4
0
class TestHome(TestPyOrgBase):
    """
    TBD
    """
    def setUp(self):
        super().setUp()
        self.home = HomePage(self.driver)

    @unittest.skip('demonstrating skipping the test')
    def test_TC001_py3_doc_button(self):
        self.home.hover_to(CommonPageLocators.DOC)
        self.home.assert_elem_text(CommonPageLocators.PY3_DOC_BUTTON, 'Python 3.x Docs')
        self.home.click(CommonPageLocators.PY3_DOC_BUTTON)
        assert self.driver.current_url == 'https://docs.python.org/3/'

    def test_TC002_blahblah_search(self):
        self.home.search_for('blahblah')
        self.home.assert_elem_text(CommonPageLocators.SEARCH_RESULT_LIST, 'No results found.')

    def test_TC004_assert_title(self):
        self.assertEqual(self.home.driver.title, 'Welcome to Python.org')
class TestHome(TestPyOrgBase):
    def setUp(self):
        super().setUp()
        self.home = HomePage(self.driver)

    def test_TC001_py3_doc_button(self):
        self.home.hover_to(CommonPageLocators.DOC)
        self.home.assert_elem_text(CommonPageLocators.PY3_DOC_BUTTON, 'Python 3.x Docs')
        self.home.click(CommonPageLocators.PY3_DOC_BUTTON)
        assert self.driver.current_url == 'https://docs.python.org/3/'

    # skip etmek için unittest.skip kullanııyor. içinde de mesaj var. istediğimizi yazabiliriz. "melis" yazarsak "melis" çıkar gibi.
    # testi neden skip ettiğimizi hatırlamak için bu mesajı yazarız.
    @unittest.skip('skipping example for decarator')
    def test_TC002_blahblah_search(self):
        self.home.search_for('blahblah')
        self.home.assert_elem_text(CommonPageLocators.SEARCH_RESULT_LIST, 'No results found.')

    # with unit test. unittestin sağladığı bir koddur bu.
    def test_TC004_assert_title(self):
        self.assertEqual(self.home.driver.title, "Welcome to Python.org")