Promium 3.4.3__tar.gz → 3.5.0__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.4.3 → Promium-3.5.0}/PKG-INFO +1 -1
- {Promium-3.4.3 → Promium-3.5.0}/Promium.egg-info/PKG-INFO +1 -1
- {Promium-3.4.3 → Promium-3.5.0}/promium/common.py +43 -38
- {Promium-3.4.3 → Promium-3.5.0}/setup.py +1 -1
- {Promium-3.4.3 → Promium-3.5.0}/LICENSE +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/Promium.egg-info/SOURCES.txt +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/Promium.egg-info/dependency_links.txt +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/Promium.egg-info/entry_points.txt +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/Promium.egg-info/requires.txt +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/Promium.egg-info/top_level.txt +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/README.rst +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/doc/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/doc/conf.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/assertions.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/base.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/browsers.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/device_config.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/checkbox.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/drop_downs.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/frame.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/input_field.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/link.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/multiselect_listbox.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/radio_button.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/textarea_field.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/elements/upload_button.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/exceptions.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/expected_conditions.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/helpers.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/logger.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/plugin.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/support/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/support/settings.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/test_case.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/promium/waits.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/setup.cfg +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/config.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/conftest.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/pages/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/pages/catalog_404_page.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/pages/catalog_gallery_page.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/__init__.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/test_base.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/test_chrome.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/test_edge.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/test_firefox.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/test_ie.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/settings/test_opera.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/test_catalog_404.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/test_catalog_gallery.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/test_enviroment.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/test_requests.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/test_soft_asserts.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/test_waits.py +0 -0
- {Promium-3.4.3 → Promium-3.5.0}/tests/urls.py +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import os
|
|
3
3
|
import datetime
|
|
4
|
+
|
|
5
|
+
import allure
|
|
4
6
|
import urllib3
|
|
5
7
|
import json
|
|
6
8
|
import time
|
|
@@ -249,17 +251,16 @@ def delete_element_from_dom(driver, element):
|
|
|
249
251
|
def find_network_log(
|
|
250
252
|
driver, find_mask, find_status=200, timeout=5, find_type=None
|
|
251
253
|
):
|
|
252
|
-
""" find xrh response and
|
|
254
|
+
""" find xrh response and request data from browser network logs
|
|
253
255
|
:param driver: selenium driver
|
|
254
256
|
:param find_mask: find word in request url
|
|
255
257
|
:param find_status: find response with this status
|
|
256
258
|
:param timeout: tries
|
|
257
259
|
:param find_type: check type request in network (example find_type='Fetch')
|
|
258
|
-
:return: {response, data, body} or
|
|
260
|
+
:return: [{response, data, body}, {response, data, body}] or []
|
|
259
261
|
"""
|
|
260
|
-
found_logs = []
|
|
261
|
-
|
|
262
262
|
def get_log(request_mask):
|
|
263
|
+
found_requests = []
|
|
263
264
|
for performance_log in driver.get_log('performance'):
|
|
264
265
|
# only response logs
|
|
265
266
|
if (
|
|
@@ -270,49 +271,46 @@ def find_network_log(
|
|
|
270
271
|
if not json_log['params'].get('response'):
|
|
271
272
|
continue
|
|
272
273
|
response = json_log['params']['response']
|
|
273
|
-
|
|
274
|
-
'
|
|
275
|
-
|
|
276
|
-
f"{response['status']} - {response['statusText']}"
|
|
274
|
+
if (
|
|
275
|
+
response['status'] == find_status and (
|
|
276
|
+
not find_type or json_log['params']['type'] == find_type
|
|
277
277
|
)
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
json_log['params']['type'] == find_type):
|
|
282
|
-
return json_log
|
|
278
|
+
):
|
|
279
|
+
found_requests.append(json_log)
|
|
280
|
+
return found_requests
|
|
283
281
|
|
|
284
282
|
while timeout >= 0:
|
|
285
283
|
xhr_log = get_log(find_mask)
|
|
286
284
|
if xhr_log:
|
|
287
|
-
requestId = xhr_log['params']['requestId'] # noqa: N806
|
|
288
|
-
response = xhr_log['params']['response']
|
|
289
285
|
break
|
|
290
286
|
time.sleep(0.5)
|
|
291
287
|
timeout -= 1
|
|
292
288
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
289
|
+
result_all_logs = []
|
|
290
|
+
for network_log in xhr_log:
|
|
291
|
+
requestId = network_log['params']['requestId'] # noqa: N806
|
|
292
|
+
response = network_log['params']['response']
|
|
293
|
+
try:
|
|
294
|
+
request_data = driver.execute_cdp_cmd(
|
|
295
|
+
'Network.getRequestPostData', {'requestId': requestId}
|
|
296
|
+
)
|
|
297
|
+
request_data = json.loads(request_data['postData'])
|
|
298
|
+
except Exception:
|
|
299
|
+
request_data = None
|
|
300
|
+
|
|
301
|
+
try:
|
|
302
|
+
response_body = driver.execute_cdp_cmd(
|
|
303
|
+
'Network.getResponseBody', {'requestId': requestId}
|
|
304
|
+
)
|
|
305
|
+
response_body = json.loads(response_body['body'])
|
|
306
|
+
except Exception:
|
|
307
|
+
response_body = None
|
|
308
|
+
|
|
309
|
+
log.info(
|
|
310
|
+
f"[XHR Logs]: find by mask: '{find_mask}' -> {response.get('url')} "
|
|
311
|
+
f"{response.get('status')} - {response.get('statusText')}"
|
|
304
312
|
)
|
|
305
|
-
|
|
306
|
-
except Exception:
|
|
307
|
-
response_body = None
|
|
308
|
-
|
|
309
|
-
log.info(
|
|
310
|
-
f"[XHR Logs]: find by mask: '{find_mask}', result: {found_logs}, "
|
|
311
|
-
f"request_data: {request_data}, response_body: {response_body},"
|
|
312
|
-
)
|
|
313
|
-
|
|
314
|
-
if xhr_log:
|
|
315
|
-
return {
|
|
313
|
+
result_all_logs.append({
|
|
316
314
|
'response': {
|
|
317
315
|
'url': response.get('url'),
|
|
318
316
|
'status': response.get('status'),
|
|
@@ -320,4 +318,11 @@ def find_network_log(
|
|
|
320
318
|
},
|
|
321
319
|
'data': request_data,
|
|
322
320
|
'body': response_body,
|
|
323
|
-
}
|
|
321
|
+
})
|
|
322
|
+
|
|
323
|
+
allure.attach(
|
|
324
|
+
name=f"[XHR log] '{find_mask}', status:{find_status}, type:{find_type}",
|
|
325
|
+
body=json.dumps(result_all_logs, indent=4, ensure_ascii=False),
|
|
326
|
+
attachment_type=allure.attachment_type.JSON,
|
|
327
|
+
)
|
|
328
|
+
return result_all_logs
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|