Ejemplo n.º 1
0
 def test_wait_timeout(self):
     agent = Agent(self.driver)
     DuckDuckGoPage.wait = 1
     DuckDuckGoPage.title = "Incorrect title to trigger exception"
     agent.to(DuckDuckGoPage)
     try:
         agent.at(DuckDuckGoPage)
         self.fail("Didn't raise Exception")
     except NotAtPageException, e:
         pass
Ejemplo n.º 2
0
 def test_at_raises_exception_if_not_at_correct_page(self):
     agent = Agent(self.driver)
     agent.to(DuckDuckGoPage)
     try:
         agent.at(UnknownTestPage)
         self.fail("Didn't raise Exception")
     except NotAtPageException, e:
         self.assertEquals(
             'Not at correct page. Expected "unknown" but found "Search DuckDuckGo"',
             e.message
         )
Ejemplo n.º 3
0
class TestCaseHorace(TestCase):
    def setUp(self):
        agentDriver = Driver({"driver": getenv("BROWSER", "phantomjs"), "platform": getenv("PLATFORM", "ANY")})
        self.agent = Agent(agentDriver)

    def tearDown(self):
        self.agent.close()

    def to(self, page, path=None, parameters=None):
        self.agent.to(page, path, parameters)

    def at(self, page):
        self.agent.at(page)

    def to_at(self, page, path=None, parameters=None):
        self.agent.to_at(page, path, parameters)

    def __getattr__(self, item):
        if item == "page":
            return self.agent.page
        elif item == "_driver":
            return self.agent._driver
        else:
            return object.__getattribute__(self, item)
Ejemplo n.º 4
0
 def test_at(self):
     agent = Agent(self.driver)
     agent.to(DuckDuckGoPage)
     agent.at(DuckDuckGoPage)
     self.assertEquals(DuckDuckGoPage.title, self.driver.title)