class TestSubmitForm_ConfirmValues(CoyoteTest):
    """
    This test demonstrates how to interact w/ a form, as well as
    how to use components
    """

    def setUp(self):
        super(TestSubmitForm_ConfirmValues, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        first_name = 'matt'
        last_name = 'boyle'
        with driver_context() as driver:
            # Visit the test page
            test = self.config.get('web_hostname')
            driver.visit(test)

            # Initialize the page object
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())

            # Retrieve the LoginForm component.
            lf = hp.get_login_form_component()
            lf.enter_first_name(first_name)
            lf.enter_last_name(last_name)
            lf.click_submit()

            # Confirm that first and last names are displayed
            display_first_name = hp.get_first_name_display()
            display_last_name = hp.get_last_name_display()

            driver.assertion.assert_equals(display_first_name, first_name, 'first names did not match')
            driver.assertion.assert_equals(display_last_name, last_name, 'first names did not match')
    def build_follow_url(host=None, **params):
        """
        Build a URL for the /follow page
        """

        # template = '?{params}'
        config = ExampleConfig()
        template = '/follow?{params}'

        if not host:
            host = config.get('example_web_hostname')

        return ExampleUrlBuilder.build(
            template=template,
            host=host,
            params=ExampleUrlBuilder.encode_params(**params))
class TestFollowLink_YouFollowedItGood(CoyoteTest):
    """
    Test that we can load a page, click a link,
    Instantiate a page object, click another link.

    You're really doin' it now, kid.  Complex shit.
    """

    def setUp(self):
        super(TestFollowLink_YouFollowedItGood, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        with driver_context() as driver:
            test = self.config.get('web_hostname')
            driver.visit(test)
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())

            # Let's go to another page.
            # Notice how we interact with hp, then instantiate fp after we land on it
            hp.click_follow_me()
            fp = ExampleFollowPage(driver_wrapper=driver)
            driver.assertion.assert_true(fp.is_page_loaded())

            # Now. let's go back to the home page
            # Notice that we re-instantiate hp, as the original hp now has a stale DOM
            fp.click_go_back_link()
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())
Esempio n. 4
0
class TestSubmitForm_ConfirmValues(CoyoteTest):
    """
    This test demonstrates how to interact w/ a form, as well as
    how to use components
    """
    def setUp(self):
        super(TestSubmitForm_ConfirmValues, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        first_name = 'matt'
        last_name = 'boyle'
        with driver_context() as driver:
            # Visit the test page
            test = self.config.get('web_hostname')
            driver.visit(test)

            # Initialize the page object
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())

            # Retrieve the LoginForm component.
            lf = hp.get_login_form_component()
            lf.enter_first_name(first_name)
            lf.enter_last_name(last_name)
            lf.click_submit()

            # Confirm that first and last names are displayed
            display_first_name = hp.get_first_name_display()
            display_last_name = hp.get_last_name_display()

            driver.assertion.assert_equals(display_first_name, first_name,
                                           'first names did not match')
            driver.assertion.assert_equals(display_last_name, last_name,
                                           'first names did not match')
class TestFollowLink_YouFollowedItGood(CoyoteTest):
    """
    Test that we can load a page, click a link,
    Instantiate a page object, click another link.

    You're really doin' it now, kid.  Complex shit.
    """
    def setUp(self):
        super(TestFollowLink_YouFollowedItGood, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        with driver_context() as driver:
            test = self.config.get('web_hostname')
            driver.visit(test)
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())

            # Let's go to another page.
            # Notice how we interact with hp, then instantiate fp after we land on it
            hp.click_follow_me()
            fp = ExampleFollowPage(driver_wrapper=driver)
            driver.assertion.assert_true(fp.is_page_loaded())

            # Now. let's go back to the home page
            # Notice that we re-instantiate hp, as the original hp now has a stale DOM
            fp.click_go_back_link()
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())
Esempio n. 6
0
class TestClickButton_ShowText(CoyoteTest):
    """
    This test demonstrates how the webdriverwrapper waits can be used.

    First, we visit a page w/ a hidden div.  We try to confirm that we can see
    the text, but it's not yet visible, so this fails.  Then, we click a button
    which makes the text visible, and then successfully confirm we can see the text.
    """
    def setUp(self):
        super(TestClickButton_ShowText, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        with driver_context() as driver:
            # Visit the test page
            test = self.config.get('web_hostname')
            driver.visit(test)

            # Initialize the page object
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())

            # Demonstrate a failure of confirm_text_visible: we can't see it, because it's
            # currently set to display: none;
            try:
                hp.confirm_text_visible(timeout=5)
            except:
                print("Yep, can't see anything")

            # Click the button to expose the text, then try to read it again
            # This call succeeds.
            hp.click_see_me_button()
            hp.confirm_text_visible(timeout=5)
Esempio n. 7
0
    def build_follow_url(host=None, **params):
        """
        Build a URL for the /follow page
        """

        # template = '?{params}'
        config = ExampleConfig()
        template = '/follow?{params}'

        if not host:
            host = config.get('example_web_hostname')

        return ExampleUrlBuilder.build(
            template=template,
            host=host,
            params=ExampleUrlBuilder.encode_params(**params)
        )
class TestGetHeaderText_ConfirmHelloWorld(CoyoteTest):
    """Test that we can load a page, retrieve some text, and verify its contents"""
    def setUp(self):
        super(TestGetHeaderText_ConfirmHelloWorld, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        with driver_context() as driver:
            test = self.config.get('web_hostname')
            driver.visit(test)
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())
            text = hp.get_hello_world_text()
            driver.assertion.assert_equals(text, "Hello world")
class TestGetHeaderText_ConfirmHelloWorld(CoyoteTest):
    """Test that we can load a page, retrieve some text, and verify its contents"""

    def setUp(self):
        super(TestGetHeaderText_ConfirmHelloWorld, self).setUp()
        self.config = ExampleConfig()

    def test_main(self):
        with driver_context() as driver:
            test = self.config.get('web_hostname')
            driver.visit(test)
            hp = ExampleHomePage(driver_wrapper=driver)
            driver.assertion.assert_true(hp.is_page_loaded())
            text = hp.get_hello_world_text()
            driver.assertion.assert_equals(text, "Hello world")
 def setUp(self):
     super(TestSubmitForm_ConfirmValues, self).setUp()
     self.config = ExampleConfig()
 def setUp(self):
     super(TestGetHeaderText_ConfirmHelloWorld, self).setUp()
     self.config = ExampleConfig()
Esempio n. 12
0
 def setUp(self):
     super(TestSubmitForm_ConfirmValues, self).setUp()
     self.config = ExampleConfig()
 def setUp(self):
     super(TestFollowLink_YouFollowedItGood, self).setUp()
     self.config = ExampleConfig()
 def setUp(self):
     super(TestGetHeaderText_ConfirmHelloWorld, self).setUp()
     self.config = ExampleConfig()
 def setUp(self):
     super(TestFollowLink_YouFollowedItGood, self).setUp()
     self.config = ExampleConfig()
Esempio n. 16
0
 def setUp(self):
     super(TestClickButton_ShowText, self).setUp()
     self.config = ExampleConfig()