Beispiel #1
0
class TestStaticPagesWithJs(unittest.TestCase):
    def setUp(self):
        self.server = Popen("dev_appserver.py . --port=80", shell=True)
        self.browser = WebDriver()

    def tearDown(self):
        self.browser.quit()
        # same as in python2.6 subprocess for posix systems (so currently no windows support)
        os.kill(self.server.pid, signal.SIGTERM)

    def test_index_with_js(self):
        self.browser.get('http://localhost')
        assert 'Welcome to Flask-Gae-Skeleton!' in self.browser.get_page_source(
        )
class TestStaticPagesWithJs(unittest.TestCase):

    def setUp(self):
        self.server = Popen("dev_appserver.py . --port=80", shell=True)
        self.browser = WebDriver()

    def tearDown(self):
        self.browser.quit()
        # same as in python2.6 subprocess for posix systems (so currently no windows support)
        os.kill(self.server.pid, signal.SIGTERM)

    def test_landing_index_with_js(self):
        self.browser.get('http://localhost')
        assert 'Welcome to Flask-Gae-Skeleton!' in self.browser.get_page_source()
Beispiel #3
0
 def testAnonymousProfileIsFresh(self):
     driver = WebDriver()
     driver.get("http://localhost:%d/simpleTest.html" % WEB_SERVER_PORT)
     timestamp = time.mktime(datetime.datetime.now().timetuple()) + 100
     cookie = {"name": "foo",
              "value": "bar",
               "expires": str(int(timestamp)) + "000",
              "domain": "localhost",
              "path": "/"}
     driver.add_cookie(utils.convert_cookie_to_json(cookie))
     self.assertEquals(cookie, driver.get_cookies()[0])
     driver.quit()
     driver = WebDriver()
     self.assertEquals([], driver.get_cookies())
     driver.quit()
Beispiel #4
0
 def testAnonymousProfileIsFresh(self):
     driver = WebDriver()
     driver.get("http://localhost:%d/simpleTest.html" % WEB_SERVER_PORT)
     timestamp = time.mktime(datetime.datetime.now().timetuple()) + 100
     cookie = {
         "name": "foo",
         "value": "bar",
         "expires": str(int(timestamp)) + "000",
         "domain": "localhost",
         "path": "/"
     }
     driver.add_cookie(utils.convert_cookie_to_json(cookie))
     self.assertEquals(cookie, driver.get_cookies()[0])
     driver.quit()
     driver = WebDriver()
     self.assertEquals([], driver.get_cookies())
     driver.quit()
Beispiel #5
0
 def testNamedProfile(self):
     profile = FirefoxProfile("example")
     driver = WebDriver(profile)
     driver.get("http://localhost:%d/simpleTest.html" % WEB_SERVER_PORT)
     self.assertEquals("Hello WebDriver", driver.get_title())
     driver.quit()
Beispiel #6
0
 def testAnonymousProfileExample(self):
     driver = WebDriver()
     driver.get("http://localhost:%d/simpleTest.html" % WEB_SERVER_PORT)
     self.assertEquals("Hello WebDriver", driver.get_title())
     driver.quit()
Beispiel #7
0
 def testNamedProfile(self):
     profile = FirefoxProfile("example")
     driver = WebDriver(profile)
     driver.get("http://localhost:%d/simpleTest.html" % WEB_SERVER_PORT)
     self.assertEquals("Hello WebDriver", driver.get_title())
     driver.quit()
Beispiel #8
0
 def testAnonymousProfileExample(self):
     driver = WebDriver()
     driver.get("http://localhost:%d/simpleTest.html" % WEB_SERVER_PORT)
     self.assertEquals("Hello WebDriver", driver.get_title())
     driver.quit()