|
13 | 13 | client = docker.from_env() |
14 | 14 | session = boto3.session.Session() |
15 | 15 |
|
16 | | -# Selenium webdriver options |
17 | | -chrome_options = webdriver.ChromeOptions() |
18 | | -chrome_options.add_argument('--no-sandbox') |
19 | | -chrome_options.add_argument('--headless') |
20 | | -chrome_options.add_argument('--disable-gpu') |
21 | | -chrome_options.add_argument('--window-size=1920x1080') |
22 | | -driver = webdriver.Chrome(chrome_options=chrome_options) |
23 | | -driver.set_page_load_timeout(10) |
24 | | - |
25 | 16 | # Global Vars |
26 | 17 | global report_tests |
27 | 18 | global report_containers |
@@ -199,10 +190,20 @@ def container_test(tag): |
199 | 190 | endpoint = proto + webauth + '@' + ip + ':' + port + webpath |
200 | 191 | print('Taking screenshot of ' + tag + ' at ' + endpoint) |
201 | 192 | try: |
| 193 | + # Selenium webdriver options |
| 194 | + chrome_options = webdriver.ChromeOptions() |
| 195 | + chrome_options.add_argument('--no-sandbox') |
| 196 | + chrome_options.add_argument('--headless') |
| 197 | + chrome_options.add_argument('--disable-gpu') |
| 198 | + chrome_options.add_argument('--window-size=1920x1080') |
| 199 | + driver = webdriver.Chrome(chrome_options=chrome_options) |
| 200 | + driver.set_page_load_timeout(10) |
202 | 201 | requests.get(endpoint, timeout=3) |
203 | 202 | driver.get(endpoint) |
204 | 203 | driver.get_screenshot_as_file(outdir + tag + '.png') |
205 | 204 | report_tests.append(['Screenshot ' + tag,'PASS']) |
| 205 | + # Quit selenium webdriver |
| 206 | + driver.quit() |
206 | 207 | except (requests.Timeout, requests.ConnectionError, KeyError) as e: |
207 | 208 | report_tests.append(['Screenshot ' + tag,'FAIL CONNECTION ERROR']) |
208 | 209 | except ErrorInResponseException as error: |
@@ -315,8 +316,6 @@ def report_upload(): |
315 | 316 | # Run through all the tags |
316 | 317 | for tag in tags: |
317 | 318 | container_test(tag) |
318 | | -# Quit selenium webdriver |
319 | | -driver.quit() |
320 | 319 | report_render() |
321 | 320 | badge_render() |
322 | 321 | report_upload() |
|
0 commit comments