Promium 3.5.2__tar.gz → 3.6.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- promium-3.6.2/PKG-INFO +183 -0
- promium-3.6.2/Promium.egg-info/PKG-INFO +183 -0
- promium-3.6.2/README.rst +155 -0
- {Promium-3.5.2 → promium-3.6.2}/doc/conf.py +2 -2
- {Promium-3.5.2 → promium-3.6.2}/promium/assertions.py +14 -1
- {Promium-3.5.2 → promium-3.6.2}/promium/base.py +1 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/browsers.py +6 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/common.py +8 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/device_config.py +2 -2
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/frame.py +2 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/input_field.py +5 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/link.py +1 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/plugin.py +1 -1
- {Promium-3.5.2 → promium-3.6.2}/promium/waits.py +8 -0
- {Promium-3.5.2 → promium-3.6.2}/setup.py +2 -2
- {Promium-3.5.2 → promium-3.6.2}/tests/test_enviroment.py +1 -0
- Promium-3.5.2/PKG-INFO +0 -210
- Promium-3.5.2/Promium.egg-info/PKG-INFO +0 -210
- Promium-3.5.2/README.rst +0 -182
- {Promium-3.5.2 → promium-3.6.2}/LICENSE +0 -0
- {Promium-3.5.2 → promium-3.6.2}/Promium.egg-info/SOURCES.txt +0 -0
- {Promium-3.5.2 → promium-3.6.2}/Promium.egg-info/dependency_links.txt +0 -0
- {Promium-3.5.2 → promium-3.6.2}/Promium.egg-info/entry_points.txt +0 -0
- {Promium-3.5.2 → promium-3.6.2}/Promium.egg-info/requires.txt +0 -0
- {Promium-3.5.2 → promium-3.6.2}/Promium.egg-info/top_level.txt +0 -0
- {Promium-3.5.2 → promium-3.6.2}/doc/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/checkbox.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/drop_downs.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/multiselect_listbox.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/radio_button.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/textarea_field.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/elements/upload_button.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/exceptions.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/expected_conditions.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/helpers.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/logger.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/support/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/support/settings.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/promium/test_case.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/setup.cfg +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/config.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/conftest.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/pages/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/pages/catalog_404_page.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/pages/catalog_gallery_page.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/__init__.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/test_base.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/test_chrome.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/test_edge.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/test_firefox.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/test_ie.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/settings/test_opera.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/test_catalog_404.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/test_catalog_gallery.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/test_requests.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/test_soft_asserts.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/test_waits.py +0 -0
- {Promium-3.5.2 → promium-3.6.2}/tests/urls.py +0 -0
promium-3.6.2/PKG-INFO
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: Promium
|
|
3
|
+
Version: 3.6.2
|
|
4
|
+
Summary: Selenium wrapper for testing Web UI
|
|
5
|
+
Author: Denis Korytkin, Nataliia Guieva, Roman Zaporozhets, Vladimir Kritov, Oleh Dykusha
|
|
6
|
+
Project-URL: Home page, https://none
|
|
7
|
+
Project-URL: Documentation, https://none
|
|
8
|
+
Keywords: Testing UI,Selenium,PageObject,Selenium wrapper
|
|
9
|
+
Platform: linux
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
13
|
+
Classifier: Topic :: Software Development :: Testing
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Requires-Python: >=3.10, <4
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: six>=1.10.0
|
|
19
|
+
Requires-Dist: json_checker>=1.2.1
|
|
20
|
+
Requires-Dist: urllib3>=2.0.2
|
|
21
|
+
Requires-Dist: py>=1.5.2
|
|
22
|
+
Requires-Dist: pytest>=5.0.0
|
|
23
|
+
Requires-Dist: pytest_rerunfailures>=4.1.0
|
|
24
|
+
Requires-Dist: pytest-forked>=0.2
|
|
25
|
+
Requires-Dist: pytest-instafail>=0.3.0
|
|
26
|
+
Requires-Dist: deepdiff>=5.7.0
|
|
27
|
+
Requires-Dist: selenium>=4.10.0
|
|
28
|
+
|
|
29
|
+
Promium
|
|
30
|
+
=======
|
|
31
|
+
|
|
32
|
+
.. image:: https://img.shields.io/badge/Python%3A%203.13-blue
|
|
33
|
+
:target: https://pypi.org/project/Promium/
|
|
34
|
+
|
|
35
|
+
.. image:: https://badge.fury.io/py/Promium.svg
|
|
36
|
+
:target: https://badge.fury.io/py/Promium
|
|
37
|
+
|
|
38
|
+
Promium is a simple Selenium wrapper designed to facilitate writing UI tests.
|
|
39
|
+
|
|
40
|
+
`Promium Documentation <https://qa-automation.git-doc.evo.dev/promium>`_
|
|
41
|
+
|
|
42
|
+
Overview
|
|
43
|
+
--------
|
|
44
|
+
|
|
45
|
+
Promium simplifies the UI testing process using Selenium. The framework is designed for ease of test creation and provides essential tools for working with elements, pages, and test cases. Supports Python 3.13 and works on Linux and macOS.
|
|
46
|
+
|
|
47
|
+
Installation and Setup
|
|
48
|
+
----------------------
|
|
49
|
+
|
|
50
|
+
**System Requirements**
|
|
51
|
+
|
|
52
|
+
- Python 3.13
|
|
53
|
+
- Systems: Linux, macOS
|
|
54
|
+
|
|
55
|
+
To install all dependencies:
|
|
56
|
+
|
|
57
|
+
.. code-block:: text
|
|
58
|
+
|
|
59
|
+
pip install -r requirements.txt
|
|
60
|
+
|
|
61
|
+
**Install Promium**
|
|
62
|
+
|
|
63
|
+
.. code-block:: text
|
|
64
|
+
|
|
65
|
+
pip install promium
|
|
66
|
+
|
|
67
|
+
**Driver and Chrome Setup**
|
|
68
|
+
|
|
69
|
+
To use Promium with Chrome, both Google Chrome and ChromeDriver need to be installed. Use the following commands to set up Chrome and ChromeDriver:
|
|
70
|
+
|
|
71
|
+
.. code-block:: text
|
|
72
|
+
|
|
73
|
+
ARG CHROME_MILESTONE=130
|
|
74
|
+
|
|
75
|
+
#============================================
|
|
76
|
+
# Google Chrome
|
|
77
|
+
#============================================
|
|
78
|
+
RUN CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_MILESTONE}) && \
|
|
79
|
+
curl -Lo /tmp/chrome-linux.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROME_VERSION}/linux64/chrome-linux64.zip && \
|
|
80
|
+
apt-get install -y unzip && \
|
|
81
|
+
unzip /tmp/chrome-linux.zip -d /usr/local/ && \
|
|
82
|
+
ln -s /usr/local/chrome-linux64/chrome /usr/local/bin/google-chrome && \
|
|
83
|
+
rm /tmp/chrome-linux.zip
|
|
84
|
+
|
|
85
|
+
#============================================
|
|
86
|
+
# ChromeDriver
|
|
87
|
+
#============================================
|
|
88
|
+
RUN CHROME_DRIVER_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | python3 -c "import sys, json; print(json.load(sys.stdin)['milestones'][str(${CHROME_MILESTONE})]['version'])") && \
|
|
89
|
+
wget --no-verbose -O /tmp/chromedriver_linux64.zip https://storage.googleapis.com/chrome-for-testing-public/${CHROME_DRIVER_VERSION}/linux64/chromedriver-linux64.zip && \
|
|
90
|
+
unzip /tmp/chromedriver_linux64.zip -d /opt/selenium && \
|
|
91
|
+
ln -fs /opt/selenium/chromedriver-linux64/chromedriver /usr/bin/chromedriver && \
|
|
92
|
+
rm /tmp/chromedriver_linux64.zip
|
|
93
|
+
|
|
94
|
+
Usage Examples
|
|
95
|
+
--------------
|
|
96
|
+
|
|
97
|
+
Below is a basic example of how to define a page object and run a simple test. For more examples, refer to the `Examples Documentation <https://github.com/your-repo-path/promium/doc/examples.md>`_.
|
|
98
|
+
|
|
99
|
+
**Page Object Example**
|
|
100
|
+
|
|
101
|
+
.. code-block:: text
|
|
102
|
+
|
|
103
|
+
from selenium.webdriver.common.by import By
|
|
104
|
+
from promium import Page, Block, Element, InputField, Link
|
|
105
|
+
|
|
106
|
+
class ResultBlock(Block):
|
|
107
|
+
title = Link(By.CSS_SELECTOR, 'h3')
|
|
108
|
+
link = Element(By.CSS_SELECTOR, '.f')
|
|
109
|
+
description = Element(By.CSS_SELECTOR, '.st')
|
|
110
|
+
tags = Element.as_list(By.CSS_SELECTOR, '.osl .fl')
|
|
111
|
+
|
|
112
|
+
class GoogleResultPage(Page):
|
|
113
|
+
results_blocks = ResultBlock.as_list(By.CSS_SELECTOR, '#rso .srg div.g')
|
|
114
|
+
|
|
115
|
+
class GoogleMainPage(Page):
|
|
116
|
+
url = 'https://google.com'
|
|
117
|
+
logo = Element(By.CSS_SELECTOR, '#hplogo')
|
|
118
|
+
search_input = InputField(By.CSS_SELECTOR, '[name="q"]')
|
|
119
|
+
|
|
120
|
+
def search(self, text):
|
|
121
|
+
self.search_input.send_keys(text)
|
|
122
|
+
self.search_input.submit()
|
|
123
|
+
return GoogleResultPage(self.driver)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
**Test Example**
|
|
127
|
+
|
|
128
|
+
.. code-block:: text
|
|
129
|
+
|
|
130
|
+
from promium.test_case import WebDriverTestCase
|
|
131
|
+
from tests.pages.google_page import GoogleMainPage
|
|
132
|
+
|
|
133
|
+
class TestMainGooglePage(WebDriverTestCase):
|
|
134
|
+
def test_search(self):
|
|
135
|
+
main_page = GoogleMainPage(self.driver)
|
|
136
|
+
main_page.open()
|
|
137
|
+
self.soft_assert_element_is_displayed(main_page.logo)
|
|
138
|
+
result_page = main_page.search('Selenium')
|
|
139
|
+
result_block = result_page.results_blocks.first_item
|
|
140
|
+
self.soft_assert_in('Selenium', result_block.title.text)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
**Run a Simple Test**
|
|
144
|
+
|
|
145
|
+
.. code-block:: text
|
|
146
|
+
|
|
147
|
+
# all tests
|
|
148
|
+
pytest tests/
|
|
149
|
+
|
|
150
|
+
# all tests in suite
|
|
151
|
+
pytest tests/test_google.py
|
|
152
|
+
|
|
153
|
+
# only one test
|
|
154
|
+
pytest tests/test_google.py -k test_search
|
|
155
|
+
|
|
156
|
+
Development and Testing
|
|
157
|
+
-----------------------
|
|
158
|
+
|
|
159
|
+
To set up a development environment and run tests, use the following commands:
|
|
160
|
+
|
|
161
|
+
- **Build Docker Image**: `docker build -t promium/base-env .`
|
|
162
|
+
- **Run Tests**: `docker-compose run test-se`
|
|
163
|
+
- **Check Linting**: `docker-compose run flake8`
|
|
164
|
+
|
|
165
|
+
Additional Documentation
|
|
166
|
+
------------------------
|
|
167
|
+
|
|
168
|
+
For detailed information on using and configuring Promium, refer to the following documentation files:
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
- `Assertions <./doc/assertions.md>`_ - Description of available assertion methods for validating test conditions.
|
|
172
|
+
- `CI Setup <./doc/ci.md>`_ - Configuration of CI/CD for automating integration processes.
|
|
173
|
+
- `Commands <./doc/command.md>`_ - List of available commands and their usage within the framework.
|
|
174
|
+
- `Containers <./doc/containers.md>`_ - Information on setting up and using containers for an isolated testing environment.
|
|
175
|
+
- `Devices(emulation) <./doc/device.md>`_ - Description of supported devices and configurations.
|
|
176
|
+
- `Drivers <./doc/driver.md>`_ - Configuration of drivers for browser interaction.
|
|
177
|
+
- `Elements <./doc/element.md>`_ - Working with web elements and their properties.
|
|
178
|
+
- `Examples <./doc/examples.md>`_ - Sample tests and scenarios to get started with the framework.
|
|
179
|
+
- `Exceptions <./doc/exceptions.md>`_ - Handling exceptions and errors during testing.
|
|
180
|
+
- `Test Cases <./doc/test_case.md>`_ - Creating and structuring test cases in Promium.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: Promium
|
|
3
|
+
Version: 3.6.2
|
|
4
|
+
Summary: Selenium wrapper for testing Web UI
|
|
5
|
+
Author: Denis Korytkin, Nataliia Guieva, Roman Zaporozhets, Vladimir Kritov, Oleh Dykusha
|
|
6
|
+
Project-URL: Home page, https://none
|
|
7
|
+
Project-URL: Documentation, https://none
|
|
8
|
+
Keywords: Testing UI,Selenium,PageObject,Selenium wrapper
|
|
9
|
+
Platform: linux
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
13
|
+
Classifier: Topic :: Software Development :: Testing
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Requires-Python: >=3.10, <4
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: six>=1.10.0
|
|
19
|
+
Requires-Dist: json_checker>=1.2.1
|
|
20
|
+
Requires-Dist: urllib3>=2.0.2
|
|
21
|
+
Requires-Dist: py>=1.5.2
|
|
22
|
+
Requires-Dist: pytest>=5.0.0
|
|
23
|
+
Requires-Dist: pytest_rerunfailures>=4.1.0
|
|
24
|
+
Requires-Dist: pytest-forked>=0.2
|
|
25
|
+
Requires-Dist: pytest-instafail>=0.3.0
|
|
26
|
+
Requires-Dist: deepdiff>=5.7.0
|
|
27
|
+
Requires-Dist: selenium>=4.10.0
|
|
28
|
+
|
|
29
|
+
Promium
|
|
30
|
+
=======
|
|
31
|
+
|
|
32
|
+
.. image:: https://img.shields.io/badge/Python%3A%203.13-blue
|
|
33
|
+
:target: https://pypi.org/project/Promium/
|
|
34
|
+
|
|
35
|
+
.. image:: https://badge.fury.io/py/Promium.svg
|
|
36
|
+
:target: https://badge.fury.io/py/Promium
|
|
37
|
+
|
|
38
|
+
Promium is a simple Selenium wrapper designed to facilitate writing UI tests.
|
|
39
|
+
|
|
40
|
+
`Promium Documentation <https://qa-automation.git-doc.evo.dev/promium>`_
|
|
41
|
+
|
|
42
|
+
Overview
|
|
43
|
+
--------
|
|
44
|
+
|
|
45
|
+
Promium simplifies the UI testing process using Selenium. The framework is designed for ease of test creation and provides essential tools for working with elements, pages, and test cases. Supports Python 3.13 and works on Linux and macOS.
|
|
46
|
+
|
|
47
|
+
Installation and Setup
|
|
48
|
+
----------------------
|
|
49
|
+
|
|
50
|
+
**System Requirements**
|
|
51
|
+
|
|
52
|
+
- Python 3.13
|
|
53
|
+
- Systems: Linux, macOS
|
|
54
|
+
|
|
55
|
+
To install all dependencies:
|
|
56
|
+
|
|
57
|
+
.. code-block:: text
|
|
58
|
+
|
|
59
|
+
pip install -r requirements.txt
|
|
60
|
+
|
|
61
|
+
**Install Promium**
|
|
62
|
+
|
|
63
|
+
.. code-block:: text
|
|
64
|
+
|
|
65
|
+
pip install promium
|
|
66
|
+
|
|
67
|
+
**Driver and Chrome Setup**
|
|
68
|
+
|
|
69
|
+
To use Promium with Chrome, both Google Chrome and ChromeDriver need to be installed. Use the following commands to set up Chrome and ChromeDriver:
|
|
70
|
+
|
|
71
|
+
.. code-block:: text
|
|
72
|
+
|
|
73
|
+
ARG CHROME_MILESTONE=130
|
|
74
|
+
|
|
75
|
+
#============================================
|
|
76
|
+
# Google Chrome
|
|
77
|
+
#============================================
|
|
78
|
+
RUN CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_MILESTONE}) && \
|
|
79
|
+
curl -Lo /tmp/chrome-linux.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROME_VERSION}/linux64/chrome-linux64.zip && \
|
|
80
|
+
apt-get install -y unzip && \
|
|
81
|
+
unzip /tmp/chrome-linux.zip -d /usr/local/ && \
|
|
82
|
+
ln -s /usr/local/chrome-linux64/chrome /usr/local/bin/google-chrome && \
|
|
83
|
+
rm /tmp/chrome-linux.zip
|
|
84
|
+
|
|
85
|
+
#============================================
|
|
86
|
+
# ChromeDriver
|
|
87
|
+
#============================================
|
|
88
|
+
RUN CHROME_DRIVER_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | python3 -c "import sys, json; print(json.load(sys.stdin)['milestones'][str(${CHROME_MILESTONE})]['version'])") && \
|
|
89
|
+
wget --no-verbose -O /tmp/chromedriver_linux64.zip https://storage.googleapis.com/chrome-for-testing-public/${CHROME_DRIVER_VERSION}/linux64/chromedriver-linux64.zip && \
|
|
90
|
+
unzip /tmp/chromedriver_linux64.zip -d /opt/selenium && \
|
|
91
|
+
ln -fs /opt/selenium/chromedriver-linux64/chromedriver /usr/bin/chromedriver && \
|
|
92
|
+
rm /tmp/chromedriver_linux64.zip
|
|
93
|
+
|
|
94
|
+
Usage Examples
|
|
95
|
+
--------------
|
|
96
|
+
|
|
97
|
+
Below is a basic example of how to define a page object and run a simple test. For more examples, refer to the `Examples Documentation <https://github.com/your-repo-path/promium/doc/examples.md>`_.
|
|
98
|
+
|
|
99
|
+
**Page Object Example**
|
|
100
|
+
|
|
101
|
+
.. code-block:: text
|
|
102
|
+
|
|
103
|
+
from selenium.webdriver.common.by import By
|
|
104
|
+
from promium import Page, Block, Element, InputField, Link
|
|
105
|
+
|
|
106
|
+
class ResultBlock(Block):
|
|
107
|
+
title = Link(By.CSS_SELECTOR, 'h3')
|
|
108
|
+
link = Element(By.CSS_SELECTOR, '.f')
|
|
109
|
+
description = Element(By.CSS_SELECTOR, '.st')
|
|
110
|
+
tags = Element.as_list(By.CSS_SELECTOR, '.osl .fl')
|
|
111
|
+
|
|
112
|
+
class GoogleResultPage(Page):
|
|
113
|
+
results_blocks = ResultBlock.as_list(By.CSS_SELECTOR, '#rso .srg div.g')
|
|
114
|
+
|
|
115
|
+
class GoogleMainPage(Page):
|
|
116
|
+
url = 'https://google.com'
|
|
117
|
+
logo = Element(By.CSS_SELECTOR, '#hplogo')
|
|
118
|
+
search_input = InputField(By.CSS_SELECTOR, '[name="q"]')
|
|
119
|
+
|
|
120
|
+
def search(self, text):
|
|
121
|
+
self.search_input.send_keys(text)
|
|
122
|
+
self.search_input.submit()
|
|
123
|
+
return GoogleResultPage(self.driver)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
**Test Example**
|
|
127
|
+
|
|
128
|
+
.. code-block:: text
|
|
129
|
+
|
|
130
|
+
from promium.test_case import WebDriverTestCase
|
|
131
|
+
from tests.pages.google_page import GoogleMainPage
|
|
132
|
+
|
|
133
|
+
class TestMainGooglePage(WebDriverTestCase):
|
|
134
|
+
def test_search(self):
|
|
135
|
+
main_page = GoogleMainPage(self.driver)
|
|
136
|
+
main_page.open()
|
|
137
|
+
self.soft_assert_element_is_displayed(main_page.logo)
|
|
138
|
+
result_page = main_page.search('Selenium')
|
|
139
|
+
result_block = result_page.results_blocks.first_item
|
|
140
|
+
self.soft_assert_in('Selenium', result_block.title.text)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
**Run a Simple Test**
|
|
144
|
+
|
|
145
|
+
.. code-block:: text
|
|
146
|
+
|
|
147
|
+
# all tests
|
|
148
|
+
pytest tests/
|
|
149
|
+
|
|
150
|
+
# all tests in suite
|
|
151
|
+
pytest tests/test_google.py
|
|
152
|
+
|
|
153
|
+
# only one test
|
|
154
|
+
pytest tests/test_google.py -k test_search
|
|
155
|
+
|
|
156
|
+
Development and Testing
|
|
157
|
+
-----------------------
|
|
158
|
+
|
|
159
|
+
To set up a development environment and run tests, use the following commands:
|
|
160
|
+
|
|
161
|
+
- **Build Docker Image**: `docker build -t promium/base-env .`
|
|
162
|
+
- **Run Tests**: `docker-compose run test-se`
|
|
163
|
+
- **Check Linting**: `docker-compose run flake8`
|
|
164
|
+
|
|
165
|
+
Additional Documentation
|
|
166
|
+
------------------------
|
|
167
|
+
|
|
168
|
+
For detailed information on using and configuring Promium, refer to the following documentation files:
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
- `Assertions <./doc/assertions.md>`_ - Description of available assertion methods for validating test conditions.
|
|
172
|
+
- `CI Setup <./doc/ci.md>`_ - Configuration of CI/CD for automating integration processes.
|
|
173
|
+
- `Commands <./doc/command.md>`_ - List of available commands and their usage within the framework.
|
|
174
|
+
- `Containers <./doc/containers.md>`_ - Information on setting up and using containers for an isolated testing environment.
|
|
175
|
+
- `Devices(emulation) <./doc/device.md>`_ - Description of supported devices and configurations.
|
|
176
|
+
- `Drivers <./doc/driver.md>`_ - Configuration of drivers for browser interaction.
|
|
177
|
+
- `Elements <./doc/element.md>`_ - Working with web elements and their properties.
|
|
178
|
+
- `Examples <./doc/examples.md>`_ - Sample tests and scenarios to get started with the framework.
|
|
179
|
+
- `Exceptions <./doc/exceptions.md>`_ - Handling exceptions and errors during testing.
|
|
180
|
+
- `Test Cases <./doc/test_case.md>`_ - Creating and structuring test cases in Promium.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
promium-3.6.2/README.rst
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Promium
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
.. image:: https://img.shields.io/badge/Python%3A%203.13-blue
|
|
5
|
+
:target: https://pypi.org/project/Promium/
|
|
6
|
+
|
|
7
|
+
.. image:: https://badge.fury.io/py/Promium.svg
|
|
8
|
+
:target: https://badge.fury.io/py/Promium
|
|
9
|
+
|
|
10
|
+
Promium is a simple Selenium wrapper designed to facilitate writing UI tests.
|
|
11
|
+
|
|
12
|
+
`Promium Documentation <https://qa-automation.git-doc.evo.dev/promium>`_
|
|
13
|
+
|
|
14
|
+
Overview
|
|
15
|
+
--------
|
|
16
|
+
|
|
17
|
+
Promium simplifies the UI testing process using Selenium. The framework is designed for ease of test creation and provides essential tools for working with elements, pages, and test cases. Supports Python 3.13 and works on Linux and macOS.
|
|
18
|
+
|
|
19
|
+
Installation and Setup
|
|
20
|
+
----------------------
|
|
21
|
+
|
|
22
|
+
**System Requirements**
|
|
23
|
+
|
|
24
|
+
- Python 3.13
|
|
25
|
+
- Systems: Linux, macOS
|
|
26
|
+
|
|
27
|
+
To install all dependencies:
|
|
28
|
+
|
|
29
|
+
.. code-block:: text
|
|
30
|
+
|
|
31
|
+
pip install -r requirements.txt
|
|
32
|
+
|
|
33
|
+
**Install Promium**
|
|
34
|
+
|
|
35
|
+
.. code-block:: text
|
|
36
|
+
|
|
37
|
+
pip install promium
|
|
38
|
+
|
|
39
|
+
**Driver and Chrome Setup**
|
|
40
|
+
|
|
41
|
+
To use Promium with Chrome, both Google Chrome and ChromeDriver need to be installed. Use the following commands to set up Chrome and ChromeDriver:
|
|
42
|
+
|
|
43
|
+
.. code-block:: text
|
|
44
|
+
|
|
45
|
+
ARG CHROME_MILESTONE=130
|
|
46
|
+
|
|
47
|
+
#============================================
|
|
48
|
+
# Google Chrome
|
|
49
|
+
#============================================
|
|
50
|
+
RUN CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_${CHROME_MILESTONE}) && \
|
|
51
|
+
curl -Lo /tmp/chrome-linux.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROME_VERSION}/linux64/chrome-linux64.zip && \
|
|
52
|
+
apt-get install -y unzip && \
|
|
53
|
+
unzip /tmp/chrome-linux.zip -d /usr/local/ && \
|
|
54
|
+
ln -s /usr/local/chrome-linux64/chrome /usr/local/bin/google-chrome && \
|
|
55
|
+
rm /tmp/chrome-linux.zip
|
|
56
|
+
|
|
57
|
+
#============================================
|
|
58
|
+
# ChromeDriver
|
|
59
|
+
#============================================
|
|
60
|
+
RUN CHROME_DRIVER_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | python3 -c "import sys, json; print(json.load(sys.stdin)['milestones'][str(${CHROME_MILESTONE})]['version'])") && \
|
|
61
|
+
wget --no-verbose -O /tmp/chromedriver_linux64.zip https://storage.googleapis.com/chrome-for-testing-public/${CHROME_DRIVER_VERSION}/linux64/chromedriver-linux64.zip && \
|
|
62
|
+
unzip /tmp/chromedriver_linux64.zip -d /opt/selenium && \
|
|
63
|
+
ln -fs /opt/selenium/chromedriver-linux64/chromedriver /usr/bin/chromedriver && \
|
|
64
|
+
rm /tmp/chromedriver_linux64.zip
|
|
65
|
+
|
|
66
|
+
Usage Examples
|
|
67
|
+
--------------
|
|
68
|
+
|
|
69
|
+
Below is a basic example of how to define a page object and run a simple test. For more examples, refer to the `Examples Documentation <https://github.com/your-repo-path/promium/doc/examples.md>`_.
|
|
70
|
+
|
|
71
|
+
**Page Object Example**
|
|
72
|
+
|
|
73
|
+
.. code-block:: text
|
|
74
|
+
|
|
75
|
+
from selenium.webdriver.common.by import By
|
|
76
|
+
from promium import Page, Block, Element, InputField, Link
|
|
77
|
+
|
|
78
|
+
class ResultBlock(Block):
|
|
79
|
+
title = Link(By.CSS_SELECTOR, 'h3')
|
|
80
|
+
link = Element(By.CSS_SELECTOR, '.f')
|
|
81
|
+
description = Element(By.CSS_SELECTOR, '.st')
|
|
82
|
+
tags = Element.as_list(By.CSS_SELECTOR, '.osl .fl')
|
|
83
|
+
|
|
84
|
+
class GoogleResultPage(Page):
|
|
85
|
+
results_blocks = ResultBlock.as_list(By.CSS_SELECTOR, '#rso .srg div.g')
|
|
86
|
+
|
|
87
|
+
class GoogleMainPage(Page):
|
|
88
|
+
url = 'https://google.com'
|
|
89
|
+
logo = Element(By.CSS_SELECTOR, '#hplogo')
|
|
90
|
+
search_input = InputField(By.CSS_SELECTOR, '[name="q"]')
|
|
91
|
+
|
|
92
|
+
def search(self, text):
|
|
93
|
+
self.search_input.send_keys(text)
|
|
94
|
+
self.search_input.submit()
|
|
95
|
+
return GoogleResultPage(self.driver)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
**Test Example**
|
|
99
|
+
|
|
100
|
+
.. code-block:: text
|
|
101
|
+
|
|
102
|
+
from promium.test_case import WebDriverTestCase
|
|
103
|
+
from tests.pages.google_page import GoogleMainPage
|
|
104
|
+
|
|
105
|
+
class TestMainGooglePage(WebDriverTestCase):
|
|
106
|
+
def test_search(self):
|
|
107
|
+
main_page = GoogleMainPage(self.driver)
|
|
108
|
+
main_page.open()
|
|
109
|
+
self.soft_assert_element_is_displayed(main_page.logo)
|
|
110
|
+
result_page = main_page.search('Selenium')
|
|
111
|
+
result_block = result_page.results_blocks.first_item
|
|
112
|
+
self.soft_assert_in('Selenium', result_block.title.text)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
**Run a Simple Test**
|
|
116
|
+
|
|
117
|
+
.. code-block:: text
|
|
118
|
+
|
|
119
|
+
# all tests
|
|
120
|
+
pytest tests/
|
|
121
|
+
|
|
122
|
+
# all tests in suite
|
|
123
|
+
pytest tests/test_google.py
|
|
124
|
+
|
|
125
|
+
# only one test
|
|
126
|
+
pytest tests/test_google.py -k test_search
|
|
127
|
+
|
|
128
|
+
Development and Testing
|
|
129
|
+
-----------------------
|
|
130
|
+
|
|
131
|
+
To set up a development environment and run tests, use the following commands:
|
|
132
|
+
|
|
133
|
+
- **Build Docker Image**: `docker build -t promium/base-env .`
|
|
134
|
+
- **Run Tests**: `docker-compose run test-se`
|
|
135
|
+
- **Check Linting**: `docker-compose run flake8`
|
|
136
|
+
|
|
137
|
+
Additional Documentation
|
|
138
|
+
------------------------
|
|
139
|
+
|
|
140
|
+
For detailed information on using and configuring Promium, refer to the following documentation files:
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
- `Assertions <./doc/assertions.md>`_ - Description of available assertion methods for validating test conditions.
|
|
144
|
+
- `CI Setup <./doc/ci.md>`_ - Configuration of CI/CD for automating integration processes.
|
|
145
|
+
- `Commands <./doc/command.md>`_ - List of available commands and their usage within the framework.
|
|
146
|
+
- `Containers <./doc/containers.md>`_ - Information on setting up and using containers for an isolated testing environment.
|
|
147
|
+
- `Devices(emulation) <./doc/device.md>`_ - Description of supported devices and configurations.
|
|
148
|
+
- `Drivers <./doc/driver.md>`_ - Configuration of drivers for browser interaction.
|
|
149
|
+
- `Elements <./doc/element.md>`_ - Working with web elements and their properties.
|
|
150
|
+
- `Examples <./doc/examples.md>`_ - Sample tests and scenarios to get started with the framework.
|
|
151
|
+
- `Exceptions <./doc/exceptions.md>`_ - Handling exceptions and errors during testing.
|
|
152
|
+
- `Test Cases <./doc/test_case.md>`_ - Creating and structuring test cases in Promium.
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
@@ -6,7 +6,7 @@ extensions = [
|
|
|
6
6
|
'sphinx.ext.intersphinx',
|
|
7
7
|
'sphinxemoji.sphinxemoji',
|
|
8
8
|
'sphinx_autobuild',
|
|
9
|
-
'myst_parser',
|
|
9
|
+
# 'myst_parser',
|
|
10
10
|
]
|
|
11
11
|
intersphinx_mapping = {
|
|
12
12
|
'python': ('https://docs.python.org/3.7', None),
|
|
@@ -18,7 +18,7 @@ source_parsers = {
|
|
|
18
18
|
'.md': 'recommonmark.parser.CommonMarkParser',
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
html_theme = 'sphinx_rtd_theme'
|
|
21
|
+
# html_theme = 'sphinx_rtd_theme'
|
|
22
22
|
html_theme_options = {
|
|
23
23
|
'display_version': False,
|
|
24
24
|
}
|
|
@@ -303,6 +303,10 @@ class BaseSoftAssertion(object):
|
|
|
303
303
|
)
|
|
304
304
|
|
|
305
305
|
def soft_assert_dicts_with_ignore_types(self, current, expected, msg=''):
|
|
306
|
+
"""
|
|
307
|
+
Comparison of two dicts with ignoring type of values
|
|
308
|
+
If the dict key was lost, print it in missing list.
|
|
309
|
+
"""
|
|
306
310
|
expected_dict = _check_namedtuple(expected)
|
|
307
311
|
current_dict = _check_namedtuple(current)
|
|
308
312
|
errors = ''
|
|
@@ -331,7 +335,7 @@ class BaseSoftAssertion(object):
|
|
|
331
335
|
):
|
|
332
336
|
"""
|
|
333
337
|
Comparison by type, if the types do not match - compares in a string
|
|
334
|
-
If the dict key was lost, print
|
|
338
|
+
If the dict key was lost, print it in missing list.
|
|
335
339
|
"""
|
|
336
340
|
def _equal(
|
|
337
341
|
field_name: str,
|
|
@@ -405,26 +409,31 @@ class WebDriverSoftAssertion(BaseSoftAssertion):
|
|
|
405
409
|
)
|
|
406
410
|
|
|
407
411
|
def soft_assert_page_title(self, expected_title, msg=None):
|
|
412
|
+
"""Page title is equals to expected_title"""
|
|
408
413
|
default_msg = 'Wrong page title.'
|
|
409
414
|
error = f"{self.base_msg(default_msg=default_msg, extend_msg=msg)}"
|
|
410
415
|
self.soft_assert_equals(self.driver.title, expected_title, error)
|
|
411
416
|
|
|
412
417
|
def soft_assert_current_url(self, expected_url, msg=None):
|
|
418
|
+
"""Current url is equals to expected_title"""
|
|
413
419
|
default_msg = 'Wrong current url.'
|
|
414
420
|
error = f"{self.base_msg(default_msg=default_msg, extend_msg=msg)}"
|
|
415
421
|
self.soft_assert_equals(self.url, expected_url, error)
|
|
416
422
|
|
|
417
423
|
def soft_assert_current_url_contains(self, url_mask, msg=None):
|
|
424
|
+
"""Current url contains ulr mask"""
|
|
418
425
|
default_msg = f"URL {str(self.url)} doesn't contains {str(url_mask)}."
|
|
419
426
|
error = f"{self.base_msg(default_msg=default_msg, extend_msg=msg)}"
|
|
420
427
|
self.soft_assert_in(url_mask, self.url, error)
|
|
421
428
|
|
|
422
429
|
def soft_assert_current_url_not_contains(self, url_mask, msg=None):
|
|
430
|
+
"""Current url does not contain ulr mask"""
|
|
423
431
|
default_msg = f"URL {str(self.url)} contains {str(url_mask)}."
|
|
424
432
|
error = f"{self.base_msg(default_msg=default_msg, extend_msg=msg)}"
|
|
425
433
|
self.soft_assert_not_in(url_mask, self.url, error)
|
|
426
434
|
|
|
427
435
|
def soft_assert_element_is_present(self, element, msg=None):
|
|
436
|
+
"""Element is present"""
|
|
428
437
|
default_msg = (
|
|
429
438
|
f"Element {element.by}={element.locator} is not present "
|
|
430
439
|
f"on page at current time."
|
|
@@ -433,6 +442,7 @@ class WebDriverSoftAssertion(BaseSoftAssertion):
|
|
|
433
442
|
self.soft_assert_true(element.is_present(), error, with_screen=True)
|
|
434
443
|
|
|
435
444
|
def soft_assert_element_is_not_present(self, element, msg=None):
|
|
445
|
+
"""Element is not present"""
|
|
436
446
|
default_msg = (
|
|
437
447
|
f"Element {element.by}={element.locator} is found on page."
|
|
438
448
|
)
|
|
@@ -440,6 +450,7 @@ class WebDriverSoftAssertion(BaseSoftAssertion):
|
|
|
440
450
|
self.soft_assert_false(element.is_present(), error, with_screen=True)
|
|
441
451
|
|
|
442
452
|
def soft_assert_element_is_displayed(self, element, msg=None):
|
|
453
|
+
"""Element is displayed to user"""
|
|
443
454
|
default_msg = (
|
|
444
455
|
f"Element {element.by}={element.locator} is "
|
|
445
456
|
f"not visible to a user."
|
|
@@ -448,6 +459,7 @@ class WebDriverSoftAssertion(BaseSoftAssertion):
|
|
|
448
459
|
self.soft_assert_true(element.is_displayed(), error, with_screen=True)
|
|
449
460
|
|
|
450
461
|
def soft_assert_element_is_not_displayed(self, element, msg=None):
|
|
462
|
+
"""Element is not displayed to user"""
|
|
451
463
|
default_msg = (
|
|
452
464
|
f"Element {element.by}={element.locator} is visible to a user."
|
|
453
465
|
)
|
|
@@ -494,6 +506,7 @@ class WebDriverSoftAssertion(BaseSoftAssertion):
|
|
|
494
506
|
self.assertion_errors.append(error)
|
|
495
507
|
|
|
496
508
|
def soft_assert_image_status_code(self, image, status_code=200, msg=None):
|
|
509
|
+
"""Compare image url status code with expected status code"""
|
|
497
510
|
if not image.get_attribute('src'):
|
|
498
511
|
return self.assertion_errors.append(
|
|
499
512
|
'Image does not have attribute "src"'
|
|
@@ -150,6 +150,7 @@ class Page(object):
|
|
|
150
150
|
wait_for_page_loaded(self.driver)
|
|
151
151
|
|
|
152
152
|
def wait_for_source_changed(self, action_func, *args, **kwargs):
|
|
153
|
+
"""Waiting for status code of current page be changed"""
|
|
153
154
|
source = self.driver.page_source
|
|
154
155
|
action_func(*args, **kwargs)
|
|
155
156
|
wait_until(
|
|
@@ -51,6 +51,12 @@ def get_chrome_opera_options(
|
|
|
51
51
|
"profile.block_third_party_cookies": True
|
|
52
52
|
}
|
|
53
53
|
options.add_experimental_option("prefs", prefs)
|
|
54
|
+
options.add_experimental_option("excludeSwitches", [
|
|
55
|
+
"enable-automation", # disable the automation bar
|
|
56
|
+
])
|
|
57
|
+
# fix use window.onbeforeunload
|
|
58
|
+
options.enable_bidi = True
|
|
59
|
+
options.unhandled_prompt_behavior = 'ignore'
|
|
54
60
|
|
|
55
61
|
if device.__class__.__name__ == "CustomDevice":
|
|
56
62
|
mobile_emulation = {
|
|
@@ -50,6 +50,7 @@ def scroll_to_bottom(driver):
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
def scroll_to_top(driver):
|
|
53
|
+
"""Scrolls to the top of the page"""
|
|
53
54
|
enable_jquery(driver)
|
|
54
55
|
driver.execute_script(
|
|
55
56
|
"""jQuery('html, body').animate({scrollTop: 0 }, 'slow', null);"""
|
|
@@ -58,6 +59,7 @@ def scroll_to_top(driver):
|
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
def scroll_to_bottom_in_block(driver, element_class):
|
|
62
|
+
"""Scrolls to the bottom of the current block"""
|
|
61
63
|
enable_jquery(driver)
|
|
62
64
|
script = """
|
|
63
65
|
var elem = '.'.concat(arguments[0]);
|
|
@@ -91,6 +93,10 @@ def scroll_to_element(driver, element, base_element=None):
|
|
|
91
93
|
|
|
92
94
|
|
|
93
95
|
def scroll_with_offset(driver, element, with_offset=0):
|
|
96
|
+
"""
|
|
97
|
+
Adjusting the final scroll position by adding or subtracting a
|
|
98
|
+
specified number of pixels
|
|
99
|
+
"""
|
|
94
100
|
enable_jquery(driver)
|
|
95
101
|
script = """
|
|
96
102
|
var elem = arguments[0];
|
|
@@ -235,11 +241,13 @@ def set_local_storage(driver, key, value):
|
|
|
235
241
|
|
|
236
242
|
|
|
237
243
|
def delete_cookie_item(driver, name):
|
|
244
|
+
"""Deleting cookie on current page"""
|
|
238
245
|
driver.delete_cookie(name)
|
|
239
246
|
driver.refresh()
|
|
240
247
|
|
|
241
248
|
|
|
242
249
|
def delete_element_from_dom(driver, element):
|
|
250
|
+
"""Removes a specific DOM element from the webpage"""
|
|
243
251
|
enable_jquery(driver)
|
|
244
252
|
driver.execute_script(f"""
|
|
245
253
|
var element = document.querySelector("{element}");
|