Plume/script/browser_test/utils.py
2020-08-10 17:06:14 +02:00

25 lines
1006 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(
# The "selenium" address is set up by Drone CI and "points" to the container running selenium
command_executor='http://selenium:24444/wd/hub',
desired_capabilities=capabilities)
def tearDown(self):
self.driver.close()
def get(self, url):
# Like "selenium", integration is mapped to the container that runs the plume instance
return self.driver.get("https://integration" + url)