Conditions | 3 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import os |
||
8 | def before_all(context): |
||
9 | def get_browser(): |
||
10 | """Only create a browser if we need it.""" |
||
11 | try: |
||
12 | browser = context.browser |
||
13 | except AttributeError: |
||
14 | options = webdriver.ChromeOptions() |
||
15 | |||
16 | # Disable the sandbox and run in headless mode when running in CI |
||
17 | if os.environ.get('CI'): |
||
18 | options.add_argument('--headless') |
||
19 | options.add_argument('--no-sandbox') |
||
20 | |||
21 | browser = context.browser = Browser('chrome', options=options) |
||
22 | |||
23 | return browser |
||
24 | context.get_browser = get_browser |
||
25 | |||
26 | # Remote URL for smoke testing |
||
27 | context.remote_url = os.environ.get('REMOTE_URL', 'http://localhost:5000') |
||
28 | |||
46 |