jenkins selenium options

This commit is contained in:
Artur Nowakowski 2019-12-09 11:15:18 +01:00
parent da1f5fe652
commit 3c9168f90e

View File

@ -7,7 +7,8 @@ from selenium import webdriver
class ClearBowlTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.driver = webdriver.Chrome()
self.driver = self.set_chrome()
self.driver.implicitly_wait(15)
self.base_url = "https://clearbowl.herokuapp.com"
@ -21,6 +22,16 @@ class ClearBowlTest(unittest.TestCase):
self.driver.find_element_by_xpath("//button[@class='ivu-btn ivu-btn-primary']").click()
self.driver.find_element_by_xpath(f"//div[contains(text(),'Witaj, {email}')]")
# options for running within Jenkins
@staticmethod
def set_chrome():
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
return webdriver.Chrome(options=options)
def tearDown(self):
self.driver.quit()