pytest krtech common library
Project description
================================
Krtech common library for pytest
================================
Selenium web elements wrapper library based on allure report.
Contains base elements, pages and methods (steps).
------------
Installation
------------
You can install using pip:
::
pip install pytest-krtech-common
-------------
Configuration
-------------
To configure ``conftest.py`` do:
code:: python
import pytest
from configuration import TestConfig, ConftestOptions
class OverwrittenTestConfig(TestConfig):
myprop = "myprop_value"
mysqldb = "mydb"
tc = OverwrittenTestConfig()
c = ConftestOptions(tc)
def pytest_addoption(parser):
c.pytest_addoption(parser)
@pytest.mark.tryfirst
def pytest_runtest_makereport(item, call, __multicall__):
return c.pytest_runtest_makereport(item, call, __multicall__)
@pytest.yield_fixture(scope='session')
def config(request):
op = c.config(request)
yield op
op.driver.close()
-----
Usage
-----
Pages:
code:: python
from selenium.webdriver.common.by import By
from decorators import page
from elements.base_element import BaseElement
from pages.base_page import BasePage
@page('Profile Page', By.ID, 'profilePageId')
class ProfilePage(BasePage):
HEADER = BaseElement("Profile page header", By.XPATH, ".//h6")
Tests:
code:: python
from pages.profile_page import ProfilePage
from pages.profile_page import ProfilePage
from steps.user_steps import UserSteps
@pytest.mark.usefixtures('config')
@allure.feature('Profile Header')
class TestProfile:
def test_profile_header(self, config):
user = UserSteps(config)
profile_page = ProfilePage(config)
user.opens('/profile')
user.should_see_element_text(profile_page.HEADER, 'User Profile Expected Header')
-------------
Wheel package
-------------
To build a wheel package do::
cd pytest-krtech-common/
python setup.py bdist_wheel
Package should be available at::
dist/pytest_krtech_common-0.1-py3-none-any.whl
To install from wheel do::
pip install pytest_krtech_common-0.1-py3-none-any.whl
Krtech common library for pytest
================================
Selenium web elements wrapper library based on allure report.
Contains base elements, pages and methods (steps).
------------
Installation
------------
You can install using pip:
::
pip install pytest-krtech-common
-------------
Configuration
-------------
To configure ``conftest.py`` do:
code:: python
import pytest
from configuration import TestConfig, ConftestOptions
class OverwrittenTestConfig(TestConfig):
myprop = "myprop_value"
mysqldb = "mydb"
tc = OverwrittenTestConfig()
c = ConftestOptions(tc)
def pytest_addoption(parser):
c.pytest_addoption(parser)
@pytest.mark.tryfirst
def pytest_runtest_makereport(item, call, __multicall__):
return c.pytest_runtest_makereport(item, call, __multicall__)
@pytest.yield_fixture(scope='session')
def config(request):
op = c.config(request)
yield op
op.driver.close()
-----
Usage
-----
Pages:
code:: python
from selenium.webdriver.common.by import By
from decorators import page
from elements.base_element import BaseElement
from pages.base_page import BasePage
@page('Profile Page', By.ID, 'profilePageId')
class ProfilePage(BasePage):
HEADER = BaseElement("Profile page header", By.XPATH, ".//h6")
Tests:
code:: python
from pages.profile_page import ProfilePage
from pages.profile_page import ProfilePage
from steps.user_steps import UserSteps
@pytest.mark.usefixtures('config')
@allure.feature('Profile Header')
class TestProfile:
def test_profile_header(self, config):
user = UserSteps(config)
profile_page = ProfilePage(config)
user.opens('/profile')
user.should_see_element_text(profile_page.HEADER, 'User Profile Expected Header')
-------------
Wheel package
-------------
To build a wheel package do::
cd pytest-krtech-common/
python setup.py bdist_wheel
Package should be available at::
dist/pytest_krtech_common-0.1-py3-none-any.whl
To install from wheel do::
pip install pytest_krtech_common-0.1-py3-none-any.whl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for pytest_krtech_common-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1491ebd649cd9cd7ddee189bb61af6cb4d5d54da9eb852e562fd93c2344fddbb |
|
MD5 | 27eb17ef9715f967615aaffa82eefecd |
|
BLAKE2b-256 | 47b41a3ecc60e290a6138fb78b99f1e9b0edf89cde59239f986a771b4f7b1ff3 |