========================
Promium
========================
.. image:: https://img.shields.io/badge/python-2.7%20...%203.12-blue.svg
:target: https://pypi.org/project/Promium/
.. image:: https://badge.fury.io/py/Promium.svg
:target: https://badge.fury.io/py/Promium
Simple selenium wrapper from implemented UI tests
Watch `documentation <https://qa-automation.git-doc.evo.dev/promium>`_
Coverage `link <https://qa-automation.git-doc.evo.dev/promium/htmlcov/>`_
Quick Start
========================
Install
-------
Promium
~~~~~~~
.. code-block:: bash
pip install promium
Selenium
~~~~~~~~
.. code-block:: bash
pip install selenium
Driver
~~~~~~~
.. code-block:: bash
# get actual chrome driver version
CHROME_DRIVER_VERSION=$(wget http://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)
# download chrome driver
wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
# unpack
unzip /tmp/chromedriver_linux64.zip -d /opt/selenium
# add link from chrome driver
ln -fs /opt/selenium/chromedriver /usr/bin/chromedriver
Examples
--------
Page Objects (pages/google_page.py)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
from selenium.webdriver.common.by import By
from promium import Page, Block, Element, InputField, Link
class ResultBlock(Block):
title = Link(By.CSS_SELECTOR, 'h3')
link = Element(By.CSS_SELECTOR, '.f')
description = Element(By.CSS_SELECTOR, '.st')
tags = Element.as_list(By.CSS_SELECTOR, '.osl .fl')
class GoogleResultPage(Page):
results_blocks = ResultBlock.as_list(By.CSS_SELECTOR, '#rso .srg div.g')
class GoogleMainPage(Page):
url = 'https://google.com'
logo = Element(By.CSS_SELECTOR, '#hplogo')
search_input = InputField(By.CSS_SELECTOR, '[name="q"]')
def search(self, text):
self.search_input.send_keys(text)
self.search_input.submit()
return GoogleResultPage(self.driver)
Simple test from (test_google.py)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
from promium.test_case import WebDriverTestCase
from tests.pages.google_page import GoogleMainPage
class TestMainGooglePage(WebDriverTestCase):
def test_search(self):
main_page = GoogleMainPage(self.driver)
main_page.open()
self.soft_assert_element_is_displayed(main_page.logo)
result_page = main_page.search('Selenium')
result_block = result_page.results_blocks.first_item
self.soft_assert_in('Selenium', result_block.title.text)
Run test
~~~~~~~~
.. code-block:: bash
# all tests
pytest tests/
# all tests in suite
pytest tests/test_google.py
# only one test
pytest tests/test_google.py -k test_search
Develop
========================
Build docker image:
.. code-block:: bash
docker build --cache-from registry.evo.dev/qa-automation/promium/base-env:latest -f docker/Dockerfile -t registry.evo.dev/qa-automation/promium/base-env:latest .
check lint:
.. code-block:: bash
docker-compose run flake8
run selenium(ui) test:
.. code-block:: bash
docker-compose run test-se -n 8
run request test:
.. code-block:: bash
docker-compose run test-requests -n 8
run unit test:
.. code-block:: bash
docker-compose run test-unit -n 8
Build documentation:
.. code-block:: bash
docker-compose run doc
Run test into container:
.. code-block:: bash
docker run -e SE_DRIVER=http+chrome://static-selenium-hub.qa-automation.stg.evo/wd/hub -e HEADLESS=Enabled --net=host -it registry.evo.dev/qa-automation/promium/base-env:latest pytest -p no:warnings -p no:cacheprovider -v -m se -n 4
Raw data
{
"_id": null,
"home_page": null,
"name": "Promium",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.10",
"maintainer_email": null,
"keywords": "Testing UI, Selenium, PageObject, Selenium wrapper",
"author": "Denis Korytkin, Nataliia Guieva, Roman Zaporozhets, Vladimir Kritov, Oleh Dykusha",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ad/5e/9236a29d97d871a57c1709ec348940da5f810284dd4e2ba622e30e0f21ec/promium-3.6.0.tar.gz",
"platform": "linux",
"description": "========================\nPromium\n========================\n\n.. image:: https://img.shields.io/badge/python-2.7%20...%203.12-blue.svg\n :target: https://pypi.org/project/Promium/\n\n.. image:: https://badge.fury.io/py/Promium.svg\n :target: https://badge.fury.io/py/Promium\n\n\nSimple selenium wrapper from implemented UI tests\n\nWatch `documentation <https://qa-automation.git-doc.evo.dev/promium>`_\n\nCoverage `link <https://qa-automation.git-doc.evo.dev/promium/htmlcov/>`_\n\nQuick Start\n========================\n\nInstall\n-------\n\nPromium\n~~~~~~~\n\n.. code-block:: bash\n\n pip install promium\n\n\nSelenium\n~~~~~~~~\n\n.. code-block:: bash\n\n pip install selenium\n\n\nDriver\n~~~~~~~\n\n.. code-block:: bash\n\n # get actual chrome driver version\n CHROME_DRIVER_VERSION=$(wget http://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)\n\n # download chrome driver\n wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip\n\n # unpack\n unzip /tmp/chromedriver_linux64.zip -d /opt/selenium\n\n # add link from chrome driver\n ln -fs /opt/selenium/chromedriver /usr/bin/chromedriver\n\n\nExamples\n--------\n\nPage Objects (pages/google_page.py)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n from selenium.webdriver.common.by import By\n\n from promium import Page, Block, Element, InputField, Link\n\n\n class ResultBlock(Block):\n\n title = Link(By.CSS_SELECTOR, 'h3')\n link = Element(By.CSS_SELECTOR, '.f')\n description = Element(By.CSS_SELECTOR, '.st')\n tags = Element.as_list(By.CSS_SELECTOR, '.osl .fl')\n\n\n class GoogleResultPage(Page):\n\n results_blocks = ResultBlock.as_list(By.CSS_SELECTOR, '#rso .srg div.g')\n\n\n class GoogleMainPage(Page):\n\n url = 'https://google.com'\n logo = Element(By.CSS_SELECTOR, '#hplogo')\n search_input = InputField(By.CSS_SELECTOR, '[name=\"q\"]')\n\n def search(self, text):\n self.search_input.send_keys(text)\n self.search_input.submit()\n return GoogleResultPage(self.driver)\n\n\n\nSimple test from (test_google.py)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: python\n\n from promium.test_case import WebDriverTestCase\n\n from tests.pages.google_page import GoogleMainPage\n\n\n class TestMainGooglePage(WebDriverTestCase):\n\n def test_search(self):\n main_page = GoogleMainPage(self.driver)\n main_page.open()\n self.soft_assert_element_is_displayed(main_page.logo)\n result_page = main_page.search('Selenium')\n result_block = result_page.results_blocks.first_item\n self.soft_assert_in('Selenium', result_block.title.text)\n\n\nRun test\n~~~~~~~~\n\n.. code-block:: bash\n\n # all tests\n pytest tests/\n\n # all tests in suite\n pytest tests/test_google.py\n\n # only one test\n pytest tests/test_google.py -k test_search\n\nDevelop\n========================\n\n\nBuild docker image:\n\n.. code-block:: bash\n\n docker build --cache-from registry.evo.dev/qa-automation/promium/base-env:latest -f docker/Dockerfile -t registry.evo.dev/qa-automation/promium/base-env:latest .\n\n\ncheck lint:\n\n.. code-block:: bash\n\n docker-compose run flake8\n\n\nrun selenium(ui) test:\n\n.. code-block:: bash\n\n docker-compose run test-se -n 8\n\n\nrun request test:\n\n.. code-block:: bash\n\n docker-compose run test-requests -n 8\n\n\nrun unit test:\n\n.. code-block:: bash\n\n docker-compose run test-unit -n 8\n\n\nBuild documentation:\n\n.. code-block:: bash\n\n docker-compose run doc\n\n\nRun test into container:\n\n.. code-block:: bash\n\n docker run -e SE_DRIVER=http+chrome://static-selenium-hub.qa-automation.stg.evo/wd/hub -e HEADLESS=Enabled --net=host -it registry.evo.dev/qa-automation/promium/base-env:latest pytest -p no:warnings -p no:cacheprovider -v -m se -n 4\n",
"bugtrack_url": null,
"license": null,
"summary": "Selenium wrapper for testing Web UI",
"version": "3.6.0",
"project_urls": {
"Documentation": "https://none",
"Home page": "https://none"
},
"split_keywords": [
"testing ui",
" selenium",
" pageobject",
" selenium wrapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ad5e9236a29d97d871a57c1709ec348940da5f810284dd4e2ba622e30e0f21ec",
"md5": "25ee27e29b995db314a16fb3a4b494f7",
"sha256": "97524ea5e5651a48819b1d3f9188176fce963e5cf8f8c98fd7ea21bd13624f98"
},
"downloads": -1,
"filename": "promium-3.6.0.tar.gz",
"has_sig": false,
"md5_digest": "25ee27e29b995db314a16fb3a4b494f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.10",
"size": 43561,
"upload_time": "2024-10-17T12:39:14",
"upload_time_iso_8601": "2024-10-17T12:39:14.603645Z",
"url": "https://files.pythonhosted.org/packages/ad/5e/9236a29d97d871a57c1709ec348940da5f810284dd4e2ba622e30e0f21ec/promium-3.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-17 12:39:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "promium"
}