Esempio n. 1
0
    def test_load_multiple_page_objects(
        self, get_context_mock, get_library_instance_mock
    ):
        """Verify that we can import multiple page objects, but only one is visible at a time

        This test is based on the current design of only allowing a
        single page object to be active at a time. That might change
        in the future - we might end up having page objects be pushed
        on a stack.

        """
        po = PageObjects(FOO_PATH, BAR_PATH)

        # Until we request the page object, we shouldn't be able to
        # see any keywords except the core page object keywords
        self.assertEqual(po.get_keyword_names(), CORE_KEYWORDS)

        # now load the "Foo" page object and verify only the Foo keyword
        # shows up and is callable.
        po.load_page_object("Test", "Foo")
        self.assertEqual(po.get_keyword_names(), CORE_KEYWORDS + ["foo_keyword_1"])
        self.assertEqual(po.foo_keyword_1("hello"), "foo keyword 1: hello")

        # now load the "Bar" page object and verify only the Bar keyword
        # shows up and is callable.
        po.load_page_object("Test", "Bar")
        self.assertEqual(
            po.get_keyword_names(), CORE_KEYWORDS + ["bar_keyword_1", "bar_keyword_2"]
        )
        self.assertEqual(po.bar_keyword_1("hello"), "bar keyword 1: hello")
Esempio n. 2
0
 def test_page_object_keyword_is_callable(self, get_context_mock,
                                          get_library_instance_mock):
     """Assert that the page object keyword is callable"""
     po = PageObjects(FOO_PATH)
     po.load_page_object("Test", "Foo")
     result = po.foo_keyword_1("hello")
     self.assertEqual(result, "foo keyword 1: hello")
Esempio n. 3
0
    def test_load_single_page_object(self, get_context_mock, get_library_instance_mock):
        """Verify that we don't see page object keywords until they are explicitly requested"""

        po = PageObjects(FOO_PATH)

        # Until we request the page object, we shouldn't be able to
        # see the page-specific keywords
        self.assertEqual(po.get_keyword_names(), CORE_KEYWORDS)

        # Now load the page object and verify the Foo keyword shows up
        po.load_page_object("Test", "Foo")
        self.assertEqual(po.get_keyword_names(), CORE_KEYWORDS + ["foo_keyword_1"])