Plume/script/browser_test/utils.py
fdb-hiroshima eabe73ddc0
Add tests for plume webserver (#513)
* begin setup front-end test environment with selenium
* run migrations before tests
* use https for tests
2019-04-06 17:41:57 +02:00

23 lines
804 B
Python

#!/usr/bin/python3
import unittest,os
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class Browser(unittest.TestCase):
def setUp(self):
if os.environ["BROWSER"] == "firefox":
capabilities=DesiredCapabilities.FIREFOX
elif os.environ["BROWSER"] == "chrome":
capabilities=DesiredCapabilities.CHROME
else:
raise Exception("No browser was requested")
capabilities['acceptSslCerts'] = True
self.driver = webdriver.Remote(
command_executor='http://localhost:24444/wd/hub',
desired_capabilities=capabilities)
def tearDown(self):
self.driver.close()
def get(self, url):
return self.driver.get("https://localhost" + url)