Skip to content

Commit

Permalink
Вынесли параметры через хуки
Browse files Browse the repository at this point in the history
Не донастроен ie
  • Loading branch information
thaidem committed May 30, 2019
1 parent 09d568e commit 7f5b723
Show file tree
Hide file tree
Showing 229 changed files with 830 additions and 137 deletions.
245 changes: 119 additions & 126 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file added __pycache__/conftest.cpython-37-PYTEST.pyc
Binary file not shown.
19 changes: 15 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@


@pytest.fixture
def app():
def app(request):
global fixture
browser = request.config.getoption("--browser")
base_url = request.config.getoption("--baseUrl")
username = request.config.getoption("--username")
password = request.config.getoption("--password")
if fixture is None:
fixture = Application()
fixture = Application(browser=browser, base_url=base_url)
else:
if not fixture.is_valid():
fixture = Application()
fixture.session.ensure_login(username="admin", password="secret")
fixture = Application(browser=browser, base_url=base_url)
fixture.session.ensure_login(username=username, password=password)
return fixture


Expand All @@ -23,3 +27,10 @@ def fin():
fixture.destroy()
request.addfinalizer(fin)
return fixture


def pytest_addoption(parser):
parser.addoption("--browser", action="store", default="firefox")
parser.addoption("--baseUrl", action="store", default="http://localhost/addressbook/")
parser.addoption("--username", action="store", default="admin")
parser.addoption("--password", action="store", default="secret")
Binary file modified env/Lib/site-packages/__pycache__/pytest.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/__pycache__/six.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/capture.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/compat.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/debugging.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/doctest.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/fixtures.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/hookspec.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/junitxml.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/logging.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/main.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/nodes.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/nose.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/outcomes.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/pastebin.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/pathlib.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/python.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/recwarn.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/reports.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/resultlog.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/runner.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/skipping.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/stepwise.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/terminal.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/tmpdir.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/unittest.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/_pytest/__pycache__/warnings.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/_compat.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/_config.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/_funcs.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/_make.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/converters.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/exceptions.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/filters.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/attr/__pycache__/validators.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/colorama/__pycache__/ansi.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/colorama/__pycache__/win32.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/colorama/__pycache__/winterm.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/pluggy/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/pluggy/__pycache__/_tracing.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/pluggy/__pycache__/_version.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/pluggy/__pycache__/callers.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/pluggy/__pycache__/hooks.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/pluggy/__pycache__/manager.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/__pycache__/_builtin.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/__pycache__/_error.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/__pycache__/_version.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/__pycache__/_xmlgen.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/_io/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/_io/__pycache__/capture.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/py/_path/__pycache__/common.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/py/_path/__pycache__/local.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/urllib3/__pycache__/fields.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/urllib3/__pycache__/request.cpython-37.pyc
Binary file not shown.
Binary file modified env/Lib/site-packages/urllib3/__pycache__/response.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/urllib3/util/__pycache__/ssl_.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified env/Lib/site-packages/urllib3/util/__pycache__/url.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file added fixture/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added fixture/__pycache__/application.cpython-37.pyc
Binary file not shown.
Binary file added fixture/__pycache__/contact.cpython-37.pyc
Binary file not shown.
Binary file added fixture/__pycache__/group.cpython-37.pyc
Binary file not shown.
Binary file added fixture/__pycache__/session.cpython-37.pyc
Binary file not shown.
18 changes: 13 additions & 5 deletions fixture/application.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
from selenium.webdriver.firefox.webdriver import WebDriver
# from selenium.webdriver.firefox.webdriver import WebDriver
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper


class Application:
def __init__(self):
self.driver = WebDriver()
def __init__(self, browser, base_url):
if browser == "firefox":
self.driver = webdriver.Firefox()
elif browser == "chrome":
self.driver = webdriver.Chrome()
elif browser == "ie":
self.driver = webdriver.Ie()
else:
raise ValueError("Unrecognized browser %s" % browser)
self.session = SessionHelper(self)
self.group = GroupHelper(self)
self.contact = ContactHelper(self)
self.base_url = base_url

def is_valid(self):
try:
Expand All @@ -20,8 +29,7 @@ def is_valid(self):

def open_home_page(self):
driver = self.driver
# driver.get("http://localhost/addressbook/group.php")
driver.get("http://localhost/addressbook/")
driver.get(self.base_url)

def destroy(self):
self.driver.quit()
225 changes: 224 additions & 1 deletion geckodriver.log

Large diffs are not rendered by default.

Binary file added model/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added model/__pycache__/contact.cpython-37.pyc
Binary file not shown.
Binary file added model/__pycache__/group.cpython-37.pyc
Binary file not shown.
Binary file added test/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file not shown.
458 changes: 458 additions & 0 deletions test/geckodriver.log

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/test_app_g1004.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def random_string(prefix, maxlen):
symbols = string.ascii_letters + string.digits + " "*7
symbols = string.ascii_letters + string.digits + " "*6
return prefix + "".join([random.choice(symbols) for i in range(random.randrange(maxlen))])


Expand Down

0 comments on commit 7f5b723

Please sign in to comment.