forked from rohitrp/Collaboration-System-Selenium
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Conftest.py
36 lines (27 loc) · 1.08 KB
/
Conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest
from selenium import webdriver
def pytest_addoption(parser):
parser.addoption("--driver", action="store", default="chrome", help="Type in browser type")
parser.addoption("--url", action="store", default="https://qa.moodle.net/", help="url")
parser.addoption("--username", action="store", default="manager", help="username")
parser.addoption("--password", action="store", default="test", help="password")
@pytest.fixture(scope="module", autouse=True)
def driver(request):
browser = request.config.getoption("--driver")
if browser == 'chrome':
browser = webdriver.Chrome()
browser.get("about:blank")
browser.implicitly_wait(10)
browser.maximize_window()
return browser
else:
print 'only chrome is supported at the moment'
@pytest.fixture(scope="module")
def username(request):
return request.config.getoption("--username")
@pytest.fixture(scope="module")
def password(request):
return request.config.getoption("--password")
@pytest.fixture(scope="module")
def url(request):
return request.config.getoption("--url")