Promium 3.6.2__tar.gz → 3.6.4__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 → promium-3.6.4}/PKG-INFO +1 -1
- {promium-3.6.2 → promium-3.6.4}/Promium.egg-info/PKG-INFO +1 -1
- {promium-3.6.2 → promium-3.6.4}/promium/assertions.py +8 -8
- {promium-3.6.2 → promium-3.6.4}/promium/browsers.py +14 -19
- {promium-3.6.2 → promium-3.6.4}/promium/device_config.py +9 -7
- {promium-3.6.2 → promium-3.6.4}/promium/plugin.py +6 -20
- {promium-3.6.2 → promium-3.6.4}/promium/test_case.py +4 -1
- {promium-3.6.2 → promium-3.6.4}/setup.py +1 -1
- {promium-3.6.2 → promium-3.6.4}/LICENSE +0 -0
- {promium-3.6.2 → promium-3.6.4}/Promium.egg-info/SOURCES.txt +0 -0
- {promium-3.6.2 → promium-3.6.4}/Promium.egg-info/dependency_links.txt +0 -0
- {promium-3.6.2 → promium-3.6.4}/Promium.egg-info/entry_points.txt +0 -0
- {promium-3.6.2 → promium-3.6.4}/Promium.egg-info/requires.txt +0 -0
- {promium-3.6.2 → promium-3.6.4}/Promium.egg-info/top_level.txt +0 -0
- {promium-3.6.2 → promium-3.6.4}/README.rst +0 -0
- {promium-3.6.2 → promium-3.6.4}/doc/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/doc/conf.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/base.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/common.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/checkbox.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/drop_downs.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/frame.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/input_field.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/link.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/multiselect_listbox.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/radio_button.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/textarea_field.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/elements/upload_button.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/exceptions.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/expected_conditions.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/helpers.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/logger.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/support/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/support/settings.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/promium/waits.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/setup.cfg +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/config.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/conftest.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/pages/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/pages/catalog_404_page.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/pages/catalog_gallery_page.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/__init__.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/test_base.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/test_chrome.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/test_edge.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/test_firefox.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/test_ie.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/settings/test_opera.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/test_catalog_404.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/test_catalog_gallery.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/test_enviroment.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/test_requests.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/test_soft_asserts.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/test_waits.py +0 -0
- {promium-3.6.2 → promium-3.6.4}/tests/urls.py +0 -0
|
@@ -108,11 +108,6 @@ class BaseSoftAssertion(object):
|
|
|
108
108
|
with_screen=False,
|
|
109
109
|
):
|
|
110
110
|
"""Just like self.soft_assert_true(current == expected)"""
|
|
111
|
-
message = (
|
|
112
|
-
f"Current and expected has different data types: "
|
|
113
|
-
f"current is {type(current)}, expected is {type(expected)}\n"
|
|
114
|
-
if type(current) != type(expected) else ""
|
|
115
|
-
)
|
|
116
111
|
diff = None
|
|
117
112
|
if type(current) is list and type(expected) is list:
|
|
118
113
|
diff = DeepDiff(current, expected, ignore_order=True)
|
|
@@ -122,12 +117,17 @@ class BaseSoftAssertion(object):
|
|
|
122
117
|
if len(current_splitlines) > 1 or len(expected_splitlines) > 1:
|
|
123
118
|
diff = DeepDiff(current_splitlines, expected_splitlines)
|
|
124
119
|
difference = f"\nDifference:\n{convert_container(diff)}" if diff else ""
|
|
120
|
+
|
|
121
|
+
type_current = type_expected = ''
|
|
122
|
+
if type(current) != type(expected):
|
|
123
|
+
type_current = f'({type(current)})'
|
|
124
|
+
type_expected = f'({type(expected)})'
|
|
125
|
+
|
|
125
126
|
assert_message = (
|
|
126
127
|
f"{base_msg(msg)}\n"
|
|
127
|
-
f"Current - {convert_container(current)}\n"
|
|
128
|
-
f"Expected - {convert_container(expected)}\n"
|
|
128
|
+
f"Current - {convert_container(current)} {type_current}\n"
|
|
129
|
+
f"Expected - {convert_container(expected)} {type_expected}\n"
|
|
129
130
|
f"{difference}"
|
|
130
|
-
f"{message}"
|
|
131
131
|
)
|
|
132
132
|
return self.soft_assert_true(
|
|
133
133
|
current == expected, assert_message, with_screen
|
|
@@ -42,21 +42,6 @@ def get_chrome_opera_options(
|
|
|
42
42
|
options.add_argument("--ignore-certificate-errors")
|
|
43
43
|
options.add_argument("--disable-notifications")
|
|
44
44
|
options.add_argument("--dns-prefetch-disable")
|
|
45
|
-
options.add_argument("--proxy-bypass-list=*ws*;*chat*")
|
|
46
|
-
prefs = {
|
|
47
|
-
"download.default_directory": DOWNLOAD_PATH,
|
|
48
|
-
"download.directory_upgrade": True,
|
|
49
|
-
'prompt_for_download': False,
|
|
50
|
-
"profile.default_content_setting_values.cookies": 1,
|
|
51
|
-
"profile.block_third_party_cookies": True
|
|
52
|
-
}
|
|
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'
|
|
60
45
|
|
|
61
46
|
if device.__class__.__name__ == "CustomDevice":
|
|
62
47
|
mobile_emulation = {
|
|
@@ -79,8 +64,10 @@ def get_chrome_opera_options(
|
|
|
79
64
|
return options
|
|
80
65
|
|
|
81
66
|
|
|
82
|
-
def get_chrome_options(
|
|
83
|
-
|
|
67
|
+
def get_chrome_options(
|
|
68
|
+
device, proxy_server=None, is_headless=False, default_options=None
|
|
69
|
+
):
|
|
70
|
+
options = default_options if default_options else ChromeOptions()
|
|
84
71
|
return get_chrome_opera_options(options, device, proxy_server, is_headless)
|
|
85
72
|
|
|
86
73
|
|
|
@@ -202,7 +189,15 @@ class RemoteBrowser(webdriver.Remote):
|
|
|
202
189
|
|
|
203
190
|
class ChromeBrowser(webdriver.Chrome):
|
|
204
191
|
|
|
205
|
-
def __init__(
|
|
192
|
+
def __init__(
|
|
193
|
+
self,
|
|
194
|
+
*args,
|
|
195
|
+
device,
|
|
196
|
+
proxy_server,
|
|
197
|
+
is_headless,
|
|
198
|
+
browser_options=None,
|
|
199
|
+
**kwargs,
|
|
200
|
+
):
|
|
206
201
|
"""
|
|
207
202
|
Initialise a new Chrome WebDriver instance.
|
|
208
203
|
"""
|
|
@@ -220,7 +215,7 @@ class ChromeBrowser(webdriver.Chrome):
|
|
|
220
215
|
capabilities.update(proxy_capabilities.to_capabilities())
|
|
221
216
|
|
|
222
217
|
options = get_chrome_options(
|
|
223
|
-
device, proxy_server, is_headless
|
|
218
|
+
device, proxy_server, is_headless, browser_options,
|
|
224
219
|
)
|
|
225
220
|
if is_headless:
|
|
226
221
|
options.accept_insecure_certs = True
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import os
|
|
2
2
|
from typing import NamedTuple
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
DEFAULT_USER_AGENT_ANDROID = (
|
|
6
|
-
"Mozilla/5.0 (Linux; Android 14; SM-G960U) "
|
|
7
|
-
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
8
|
-
"Chrome/131.0.
|
|
6
|
+
f"Mozilla/5.0 (Linux; Android 14; SM-G960U) "
|
|
7
|
+
f"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
8
|
+
f"Chrome/{os.environ.get('GOOGLE_CHROME_VERSION', '131.0.6778.39')} "
|
|
9
|
+
f"Mobile Safari/537.36"
|
|
9
10
|
)
|
|
10
11
|
DEFAULT_USER_AGENT_IOS = (
|
|
11
12
|
"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) "
|
|
@@ -13,9 +14,10 @@ DEFAULT_USER_AGENT_IOS = (
|
|
|
13
14
|
"Version/17.4.1 Mobile/15E148 Safari/604.1"
|
|
14
15
|
)
|
|
15
16
|
DEFAULT_USER_AGENT_HUAWEI = (
|
|
16
|
-
"Mozilla/5.0 (Linux; Android 11; HUAWEI Mate 40 Pro Build/HUAWEIMate40Pro;
|
|
17
|
-
"xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
18
|
-
"Chrome/131.0.
|
|
17
|
+
f"Mozilla/5.0 (Linux; Android 11; HUAWEI Mate 40 Pro Build/HUAWEIMate40Pro;"
|
|
18
|
+
f" xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
19
|
+
f"Chrome/{os.environ.get('GOOGLE_CHROME_VERSION', '131.0.6778.39')} "
|
|
20
|
+
f"Mobile Safari/537.36"
|
|
19
21
|
)
|
|
20
22
|
|
|
21
23
|
|
|
@@ -31,24 +31,6 @@ DEFAULT_HEADERS = {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def pytest_sessionstart(session):
|
|
35
|
-
if hasattr(session.config, 'cache'):
|
|
36
|
-
cache = session.config.cache
|
|
37
|
-
cache_path = f"cache/{session.config.lastfailed_file}"
|
|
38
|
-
print("Lastfailed:", len(cache.get(cache_path, set())))
|
|
39
|
-
session.run_duration = datetime.datetime.now()
|
|
40
|
-
print("\nPytest session start %s\n" % session.run_duration)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@pytest.mark.trylast
|
|
44
|
-
def pytest_sessionfinish(session):
|
|
45
|
-
finish = datetime.datetime.now()
|
|
46
|
-
duration = datetime.timedelta(
|
|
47
|
-
seconds=(finish - session.run_duration).seconds
|
|
48
|
-
)
|
|
49
|
-
print("\n\nPytest session finish %s (duration=%s)\n" % (finish, duration))
|
|
50
|
-
|
|
51
|
-
|
|
52
34
|
@pytest.hookimpl
|
|
53
35
|
def pytest_addoption(parser):
|
|
54
36
|
parser.addoption(
|
|
@@ -252,7 +234,12 @@ def driver_init(request):
|
|
|
252
234
|
proxy_server = request.config.proxy_server
|
|
253
235
|
else:
|
|
254
236
|
proxy_server = None
|
|
255
|
-
|
|
237
|
+
browser_options = getattr(request.cls, "browser_options", None)
|
|
238
|
+
driver = create_driver(
|
|
239
|
+
device,
|
|
240
|
+
proxy_server=proxy_server,
|
|
241
|
+
browser_options=browser_options,
|
|
242
|
+
)
|
|
256
243
|
driver.xrequestid = request.cls.xrequestid
|
|
257
244
|
request.cls.driver = request.config.driver = driver
|
|
258
245
|
request.config.get_fail_debug = _get_fail_debug
|
|
@@ -408,7 +395,6 @@ def pytest_configure(config):
|
|
|
408
395
|
'ignore:A true SSLContext object is not available, '
|
|
409
396
|
'ignore:Unverified HTTPS request is being made'
|
|
410
397
|
)
|
|
411
|
-
os.environ['TEST_CASE'] = "True"
|
|
412
398
|
|
|
413
399
|
if config.getoption('--headless'):
|
|
414
400
|
os.environ['HEADLESS'] = 'Enabled'
|
|
@@ -72,7 +72,8 @@ def timeout(seconds=5, error_message=os.strerror(errno.ETIME)):
|
|
|
72
72
|
|
|
73
73
|
@timeout(300)
|
|
74
74
|
def create_driver(
|
|
75
|
-
device, proxy_server=None, env_var='SE_DRIVER', default='chrome://'
|
|
75
|
+
device, proxy_server=None, env_var='SE_DRIVER', default='chrome://',
|
|
76
|
+
browser_options=None,
|
|
76
77
|
):
|
|
77
78
|
"""
|
|
78
79
|
Examples:
|
|
@@ -87,6 +88,8 @@ def create_driver(
|
|
|
87
88
|
"proxy_server": proxy_server,
|
|
88
89
|
"is_headless": os.environ.get("HEADLESS") == "Enabled",
|
|
89
90
|
}
|
|
91
|
+
if browser_options and 'chrome' in browser_options.__module__:
|
|
92
|
+
driver_options["browser_options"] = browser_options
|
|
90
93
|
|
|
91
94
|
driver_dsn = os.environ.get(env_var) or default
|
|
92
95
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|