2019-04-06 17:41:57 +02:00
|
|
|
#!/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(
|
2020-08-10 16:47:13 +02:00
|
|
|
# The "selenium" address is set up by Drone CI and "points" to the container running selenium
|
|
|
|
command_executor='http://selenium:24444/wd/hub',
|
2019-04-06 17:41:57 +02:00
|
|
|
desired_capabilities=capabilities)
|
|
|
|
def tearDown(self):
|
|
|
|
self.driver.close()
|
|
|
|
|
|
|
|
def get(self, url):
|
2020-08-10 17:06:14 +02:00
|
|
|
# Like "selenium", integration is mapped to the container that runs the plume instance
|
2020-08-10 18:03:51 +02:00
|
|
|
return self.driver.get("https://localhost" + url)
|