seleniumbase 4.43.1__py3-none-any.whl → 4.43.3__py3-none-any.whl
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.
Potentially problematic release.
This version of seleniumbase might be problematic. Click here for more details.
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_sb.py +7 -7
- seleniumbase/console_scripts/sb_caseplans.py +3 -3
- seleniumbase/console_scripts/sb_mkchart.py +1 -1
- seleniumbase/console_scripts/sb_mkdir.py +21 -21
- seleniumbase/console_scripts/sb_mkfile.py +1 -1
- seleniumbase/console_scripts/sb_mkpres.py +1 -1
- seleniumbase/console_scripts/sb_mkrec.py +1 -1
- seleniumbase/console_scripts/sb_objectify.py +4 -4
- seleniumbase/console_scripts/sb_print.py +1 -1
- seleniumbase/core/browser_launcher.py +82 -5
- seleniumbase/core/detect_b_ver.py +214 -8
- seleniumbase/core/log_helper.py +4 -4
- seleniumbase/core/report_helper.py +6 -4
- seleniumbase/core/sb_cdp.py +52 -6
- seleniumbase/core/tour_helper.py +1 -1
- seleniumbase/drivers/atlas_drivers/__init__.py +0 -0
- seleniumbase/drivers/brave_drivers/__init__.py +0 -0
- seleniumbase/drivers/comet_drivers/__init__.py +0 -0
- seleniumbase/drivers/opera_drivers/__init__.py +0 -0
- seleniumbase/fixtures/constants.py +29 -0
- seleniumbase/fixtures/js_utils.py +14 -2
- seleniumbase/fixtures/page_utils.py +13 -7
- seleniumbase/plugins/basic_test_info.py +2 -2
- seleniumbase/plugins/driver_manager.py +114 -0
- seleniumbase/plugins/page_source.py +2 -2
- seleniumbase/plugins/pytest_plugin.py +148 -21
- seleniumbase/plugins/sb_manager.py +118 -1
- seleniumbase/plugins/selenium_plugin.py +123 -0
- seleniumbase/translate/translator.py +2 -2
- seleniumbase/undetected/cdp_driver/cdp_util.py +56 -38
- seleniumbase/undetected/cdp_driver/connection.py +1 -0
- seleniumbase/utilities/selenium_grid/download_selenium_server.py +1 -1
- seleniumbase/utilities/selenium_grid/grid_hub.py +1 -1
- seleniumbase/utilities/selenium_grid/grid_node.py +2 -2
- seleniumbase/utilities/selenium_ide/convert_ide.py +2 -2
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/METADATA +6 -2
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/RECORD +42 -38
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/WHEEL +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/licenses/LICENSE +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/top_level.txt +0 -0
|
@@ -239,6 +239,7 @@ def Driver(
|
|
|
239
239
|
from seleniumbase import config as sb_config
|
|
240
240
|
from seleniumbase.config import settings
|
|
241
241
|
from seleniumbase.core import browser_launcher
|
|
242
|
+
from seleniumbase.core import detect_b_ver
|
|
242
243
|
from seleniumbase.fixtures import constants
|
|
243
244
|
from seleniumbase.fixtures import shared_utils
|
|
244
245
|
|
|
@@ -271,10 +272,37 @@ def Driver(
|
|
|
271
272
|
)
|
|
272
273
|
elif existing_runner:
|
|
273
274
|
sb_config._context_of_runner = True
|
|
275
|
+
sb_config._browser_shortcut = None
|
|
276
|
+
sb_config._cdp_browser = None
|
|
277
|
+
sb_config._cdp_bin_loc = None
|
|
274
278
|
browser_changes = 0
|
|
275
279
|
browser_set = None
|
|
276
280
|
browser_text = None
|
|
277
281
|
browser_list = []
|
|
282
|
+
# Check if binary-location in options
|
|
283
|
+
bin_loc_in_options = False
|
|
284
|
+
if (
|
|
285
|
+
binary_location
|
|
286
|
+
and len(str(binary_location)) > 5
|
|
287
|
+
and os.path.exists(str(binary_location))
|
|
288
|
+
):
|
|
289
|
+
bin_loc_in_options = True
|
|
290
|
+
else:
|
|
291
|
+
for arg in sys_argv:
|
|
292
|
+
if arg in ["--binary-location", "--binary_location", "--bl"]:
|
|
293
|
+
bin_loc_in_options = True
|
|
294
|
+
if (
|
|
295
|
+
browser
|
|
296
|
+
and browser in constants.ChromiumSubs.chromium_subs
|
|
297
|
+
and not bin_loc_in_options
|
|
298
|
+
):
|
|
299
|
+
bin_loc = detect_b_ver.get_binary_location(browser)
|
|
300
|
+
if bin_loc and os.path.exists(bin_loc):
|
|
301
|
+
if browser in bin_loc.lower().split("/")[-1].split("\\")[-1]:
|
|
302
|
+
sb_config._cdp_browser = browser
|
|
303
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
304
|
+
binary_location = bin_loc
|
|
305
|
+
bin_loc_in_options = True
|
|
278
306
|
# As a shortcut, you can use "--edge" instead of "--browser=edge", etc,
|
|
279
307
|
# but you can only specify one default browser for tests. (Default: chrome)
|
|
280
308
|
if "--browser=chrome" in sys_argv or "--browser chrome" in sys_argv:
|
|
@@ -301,6 +329,46 @@ def Driver(
|
|
|
301
329
|
browser_changes += 1
|
|
302
330
|
browser_set = "remote"
|
|
303
331
|
browser_list.append("--browser=remote")
|
|
332
|
+
if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
|
|
333
|
+
if not bin_loc_in_options:
|
|
334
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
335
|
+
if os.path.exists(bin_loc):
|
|
336
|
+
browser_changes += 1
|
|
337
|
+
browser_set = "opera"
|
|
338
|
+
sb_config._browser_shortcut = "opera"
|
|
339
|
+
sb_config._cdp_browser = "opera"
|
|
340
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
341
|
+
browser_list.append("--browser=opera")
|
|
342
|
+
if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
|
|
343
|
+
if not bin_loc_in_options:
|
|
344
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
345
|
+
if os.path.exists(bin_loc):
|
|
346
|
+
browser_changes += 1
|
|
347
|
+
browser_set = "brave"
|
|
348
|
+
sb_config._browser_shortcut = "brave"
|
|
349
|
+
sb_config._cdp_browser = "brave"
|
|
350
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
351
|
+
browser_list.append("--browser=brave")
|
|
352
|
+
if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
|
|
353
|
+
if not bin_loc_in_options:
|
|
354
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
355
|
+
if os.path.exists(bin_loc):
|
|
356
|
+
browser_changes += 1
|
|
357
|
+
browser_set = "comet"
|
|
358
|
+
sb_config._browser_shortcut = "comet"
|
|
359
|
+
sb_config._cdp_browser = "comet"
|
|
360
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
361
|
+
browser_list.append("--browser=comet")
|
|
362
|
+
if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
|
|
363
|
+
if not bin_loc_in_options:
|
|
364
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
365
|
+
if os.path.exists(bin_loc):
|
|
366
|
+
browser_changes += 1
|
|
367
|
+
browser_set = "atlas"
|
|
368
|
+
sb_config._browser_shortcut = "atlas"
|
|
369
|
+
sb_config._cdp_browser = "atlas"
|
|
370
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
371
|
+
browser_list.append("--browser=atlas")
|
|
304
372
|
browser_text = browser_set
|
|
305
373
|
if "--chrome" in sys_argv and not browser_set == "chrome":
|
|
306
374
|
browser_changes += 1
|
|
@@ -322,6 +390,46 @@ def Driver(
|
|
|
322
390
|
browser_changes += 1
|
|
323
391
|
browser_text = "safari"
|
|
324
392
|
browser_list.append("--safari")
|
|
393
|
+
if "--opera" in sys_argv and not browser_set == "opera":
|
|
394
|
+
if not bin_loc_in_options:
|
|
395
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
396
|
+
if os.path.exists(bin_loc):
|
|
397
|
+
browser_changes += 1
|
|
398
|
+
browser_text = "opera"
|
|
399
|
+
sb_config._browser_shortcut = "opera"
|
|
400
|
+
sb_config._cdp_browser = "opera"
|
|
401
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
402
|
+
browser_list.append("--opera")
|
|
403
|
+
if "--brave" in sys_argv and not browser_set == "brave":
|
|
404
|
+
if not bin_loc_in_options:
|
|
405
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
406
|
+
if os.path.exists(bin_loc):
|
|
407
|
+
browser_changes += 1
|
|
408
|
+
browser_text = "brave"
|
|
409
|
+
sb_config._browser_shortcut = "brave"
|
|
410
|
+
sb_config._cdp_browser = "brave"
|
|
411
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
412
|
+
browser_list.append("--brave")
|
|
413
|
+
if "--comet" in sys_argv and not browser_set == "comet":
|
|
414
|
+
if not bin_loc_in_options:
|
|
415
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
416
|
+
if os.path.exists(bin_loc):
|
|
417
|
+
browser_changes += 1
|
|
418
|
+
browser_text = "comet"
|
|
419
|
+
sb_config._browser_shortcut = "comet"
|
|
420
|
+
sb_config._cdp_browser = "comet"
|
|
421
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
422
|
+
browser_list.append("--comet")
|
|
423
|
+
if "--atlas" in sys_argv and not browser_set == "atlas":
|
|
424
|
+
if not bin_loc_in_options:
|
|
425
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
426
|
+
if os.path.exists(bin_loc):
|
|
427
|
+
browser_changes += 1
|
|
428
|
+
browser_text = "atlas"
|
|
429
|
+
sb_config._browser_shortcut = "atlas"
|
|
430
|
+
sb_config._cdp_browser = "atlas"
|
|
431
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
432
|
+
browser_list.append("--atlas")
|
|
325
433
|
if browser_changes > 1:
|
|
326
434
|
message = "\n\n TOO MANY browser types were entered!"
|
|
327
435
|
message += "\n There were %s found:\n > %s" % (
|
|
@@ -345,6 +453,10 @@ def Driver(
|
|
|
345
453
|
"Browser: {%s} is not a valid browser option. "
|
|
346
454
|
"Valid options = {%s}" % (browser, valid_browsers)
|
|
347
455
|
)
|
|
456
|
+
if sb_config._browser_shortcut:
|
|
457
|
+
browser = sb_config._browser_shortcut
|
|
458
|
+
if browser in constants.ChromiumSubs.chromium_subs:
|
|
459
|
+
browser = "chrome" # Still uses chromedriver
|
|
348
460
|
if headless is None:
|
|
349
461
|
if "--headless" in sys_argv:
|
|
350
462
|
headless = True
|
|
@@ -534,6 +646,8 @@ def Driver(
|
|
|
534
646
|
count += 1
|
|
535
647
|
user_agent = agent
|
|
536
648
|
found_bl = None
|
|
649
|
+
if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
|
|
650
|
+
binary_location = sb_config._cdp_bin_loc
|
|
537
651
|
if binary_location is None and "--binary-location" in arg_join:
|
|
538
652
|
count = 0
|
|
539
653
|
for arg in sys_argv:
|
|
@@ -28,7 +28,7 @@ class PageSource(Plugin):
|
|
|
28
28
|
if not os.path.exists(test_logpath):
|
|
29
29
|
os.makedirs(test_logpath)
|
|
30
30
|
html_file_name = os.path.join(test_logpath, self.logfile_name)
|
|
31
|
-
html_file = open(html_file_name, "w+", "utf-8")
|
|
31
|
+
html_file = open(html_file_name, mode="w+", encoding="utf-8")
|
|
32
32
|
rendered_source = log_helper.get_html_source_with_base_href(
|
|
33
33
|
test.driver, page_source
|
|
34
34
|
)
|
|
@@ -44,7 +44,7 @@ class PageSource(Plugin):
|
|
|
44
44
|
if not os.path.exists(test_logpath):
|
|
45
45
|
os.makedirs(test_logpath)
|
|
46
46
|
html_file_name = os.path.join(test_logpath, self.logfile_name)
|
|
47
|
-
html_file = open(html_file_name, "w+", "utf-8")
|
|
47
|
+
html_file = open(html_file_name, mode="w+", encoding="utf-8")
|
|
48
48
|
rendered_source = log_helper.get_html_source_with_base_href(
|
|
49
49
|
test.driver, page_source
|
|
50
50
|
)
|
|
@@ -7,6 +7,7 @@ import time
|
|
|
7
7
|
from contextlib import suppress
|
|
8
8
|
from seleniumbase import config as sb_config
|
|
9
9
|
from seleniumbase.config import settings
|
|
10
|
+
from seleniumbase.core import detect_b_ver
|
|
10
11
|
from seleniumbase.core import log_helper
|
|
11
12
|
from seleniumbase.fixtures import constants
|
|
12
13
|
from seleniumbase.fixtures import shared_utils
|
|
@@ -28,6 +29,10 @@ def pytest_addoption(parser):
|
|
|
28
29
|
--edge (Shortcut for "--browser=edge".)
|
|
29
30
|
--firefox (Shortcut for "--browser=firefox".)
|
|
30
31
|
--safari (Shortcut for "--browser=safari".)
|
|
32
|
+
--opera (Shortcut for "--browser=opera".)
|
|
33
|
+
--brave (Shortcut for "--browser=brave".)
|
|
34
|
+
--comet (Shortcut for "--browser=comet".)
|
|
35
|
+
--atlas (Shortcut for "--browser=atlas".)
|
|
31
36
|
--cft (Shortcut for using `Chrome for Testing`)
|
|
32
37
|
--chs (Shortcut for using `Chrome-Headless-Shell`)
|
|
33
38
|
--settings-file=FILE (Override default SeleniumBase settings.)
|
|
@@ -186,6 +191,34 @@ def pytest_addoption(parser):
|
|
|
186
191
|
default=False,
|
|
187
192
|
help="""Shortcut for --browser=safari""",
|
|
188
193
|
)
|
|
194
|
+
parser.addoption(
|
|
195
|
+
"--opera",
|
|
196
|
+
action="store_true",
|
|
197
|
+
dest="use_opera",
|
|
198
|
+
default=False,
|
|
199
|
+
help="""Shortcut for --browser=opera""",
|
|
200
|
+
)
|
|
201
|
+
parser.addoption(
|
|
202
|
+
"--brave",
|
|
203
|
+
action="store_true",
|
|
204
|
+
dest="use_brave",
|
|
205
|
+
default=False,
|
|
206
|
+
help="""Shortcut for --browser=brave""",
|
|
207
|
+
)
|
|
208
|
+
parser.addoption(
|
|
209
|
+
"--comet",
|
|
210
|
+
action="store_true",
|
|
211
|
+
dest="use_comet",
|
|
212
|
+
default=False,
|
|
213
|
+
help="""Shortcut for --browser=comet""",
|
|
214
|
+
)
|
|
215
|
+
parser.addoption(
|
|
216
|
+
"--atlas",
|
|
217
|
+
action="store_true",
|
|
218
|
+
dest="use_atlas",
|
|
219
|
+
default=False,
|
|
220
|
+
help="""Shortcut for --browser=atlas""",
|
|
221
|
+
)
|
|
189
222
|
parser.addoption(
|
|
190
223
|
"--cft",
|
|
191
224
|
action="store_true",
|
|
@@ -1388,8 +1421,14 @@ def pytest_addoption(parser):
|
|
|
1388
1421
|
|
|
1389
1422
|
arg_join = " ".join(sys_argv)
|
|
1390
1423
|
sb_config._browser_shortcut = None
|
|
1424
|
+
sb_config._cdp_browser = None
|
|
1425
|
+
sb_config._cdp_bin_loc = None
|
|
1391
1426
|
sb_config._vd_list = []
|
|
1392
|
-
|
|
1427
|
+
# Check if binary-location in options
|
|
1428
|
+
bin_loc_in_options = False
|
|
1429
|
+
for arg in sys_argv:
|
|
1430
|
+
if arg in ["--binary-location", "--binary_location", "--bl"]:
|
|
1431
|
+
bin_loc_in_options = True
|
|
1393
1432
|
# SeleniumBase does not support pytest-timeout due to hanging browsers.
|
|
1394
1433
|
for arg in sys_argv:
|
|
1395
1434
|
if "--timeout=" in arg:
|
|
@@ -1465,6 +1504,46 @@ def pytest_addoption(parser):
|
|
|
1465
1504
|
browser_changes += 1
|
|
1466
1505
|
browser_set = "remote"
|
|
1467
1506
|
browser_list.append("--browser=remote")
|
|
1507
|
+
if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
|
|
1508
|
+
if not bin_loc_in_options:
|
|
1509
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
1510
|
+
if os.path.exists(bin_loc):
|
|
1511
|
+
browser_changes += 1
|
|
1512
|
+
browser_set = "opera"
|
|
1513
|
+
sb_config._browser_shortcut = "opera"
|
|
1514
|
+
sb_config._cdp_browser = "opera"
|
|
1515
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1516
|
+
browser_list.append("--browser=opera")
|
|
1517
|
+
if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
|
|
1518
|
+
if not bin_loc_in_options:
|
|
1519
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
1520
|
+
if os.path.exists(bin_loc):
|
|
1521
|
+
browser_changes += 1
|
|
1522
|
+
browser_set = "brave"
|
|
1523
|
+
sb_config._browser_shortcut = "brave"
|
|
1524
|
+
sb_config._cdp_browser = "brave"
|
|
1525
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1526
|
+
browser_list.append("--browser=brave")
|
|
1527
|
+
if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
|
|
1528
|
+
if not bin_loc_in_options:
|
|
1529
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
1530
|
+
if os.path.exists(bin_loc):
|
|
1531
|
+
browser_changes += 1
|
|
1532
|
+
browser_set = "comet"
|
|
1533
|
+
sb_config._browser_shortcut = "comet"
|
|
1534
|
+
sb_config._cdp_browser = "comet"
|
|
1535
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1536
|
+
browser_list.append("--browser=comet")
|
|
1537
|
+
if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
|
|
1538
|
+
if not bin_loc_in_options:
|
|
1539
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
1540
|
+
if os.path.exists(bin_loc):
|
|
1541
|
+
browser_changes += 1
|
|
1542
|
+
browser_set = "atlas"
|
|
1543
|
+
sb_config._browser_shortcut = "atlas"
|
|
1544
|
+
sb_config._cdp_browser = "atlas"
|
|
1545
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1546
|
+
browser_list.append("--browser=atlas")
|
|
1468
1547
|
browser_text = browser_set
|
|
1469
1548
|
if "--chrome" in sys_argv and not browser_set == "chrome":
|
|
1470
1549
|
browser_changes += 1
|
|
@@ -1491,6 +1570,46 @@ def pytest_addoption(parser):
|
|
|
1491
1570
|
browser_text = "safari"
|
|
1492
1571
|
sb_config._browser_shortcut = "safari"
|
|
1493
1572
|
browser_list.append("--safari")
|
|
1573
|
+
if "--opera" in sys_argv and not browser_set == "opera":
|
|
1574
|
+
if not bin_loc_in_options:
|
|
1575
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
1576
|
+
if os.path.exists(bin_loc):
|
|
1577
|
+
browser_changes += 1
|
|
1578
|
+
browser_text = "opera"
|
|
1579
|
+
sb_config._browser_shortcut = "opera"
|
|
1580
|
+
sb_config._cdp_browser = "opera"
|
|
1581
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1582
|
+
browser_list.append("--opera")
|
|
1583
|
+
if "--brave" in sys_argv and not browser_set == "brave":
|
|
1584
|
+
if not bin_loc_in_options:
|
|
1585
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
1586
|
+
if os.path.exists(bin_loc):
|
|
1587
|
+
browser_changes += 1
|
|
1588
|
+
browser_text = "brave"
|
|
1589
|
+
sb_config._browser_shortcut = "brave"
|
|
1590
|
+
sb_config._cdp_browser = "brave"
|
|
1591
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1592
|
+
browser_list.append("--brave")
|
|
1593
|
+
if "--comet" in sys_argv and not browser_set == "comet":
|
|
1594
|
+
if not bin_loc_in_options:
|
|
1595
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
1596
|
+
if os.path.exists(bin_loc):
|
|
1597
|
+
browser_changes += 1
|
|
1598
|
+
browser_text = "comet"
|
|
1599
|
+
sb_config._browser_shortcut = "comet"
|
|
1600
|
+
sb_config._cdp_browser = "comet"
|
|
1601
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1602
|
+
browser_list.append("--comet")
|
|
1603
|
+
if "--atlas" in sys_argv and not browser_set == "atlas":
|
|
1604
|
+
if not bin_loc_in_options:
|
|
1605
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
1606
|
+
if os.path.exists(bin_loc):
|
|
1607
|
+
browser_changes += 1
|
|
1608
|
+
browser_text = "atlas"
|
|
1609
|
+
sb_config._browser_shortcut = "atlas"
|
|
1610
|
+
sb_config._cdp_browser = "atlas"
|
|
1611
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1612
|
+
browser_list.append("--atlas")
|
|
1494
1613
|
if browser_changes > 1:
|
|
1495
1614
|
message = "\n TOO MANY browser types were entered!"
|
|
1496
1615
|
message += "\n There were %s found:\n > %s" % (
|
|
@@ -1525,7 +1644,7 @@ def pytest_addoption(parser):
|
|
|
1525
1644
|
undetectable = True
|
|
1526
1645
|
if (
|
|
1527
1646
|
browser_changes == 1
|
|
1528
|
-
and browser_text not in ["chrome"]
|
|
1647
|
+
and browser_text not in ["chrome", "opera", "brave", "comet", "atlas"]
|
|
1529
1648
|
and undetectable
|
|
1530
1649
|
):
|
|
1531
1650
|
message = (
|
|
@@ -1557,6 +1676,8 @@ def pytest_configure(config):
|
|
|
1557
1676
|
sb_config.browser = config.getoption("browser")
|
|
1558
1677
|
if sb_config._browser_shortcut:
|
|
1559
1678
|
sb_config.browser = sb_config._browser_shortcut
|
|
1679
|
+
if sb_config.browser in constants.ChromiumSubs.chromium_subs:
|
|
1680
|
+
sb_config.browser = "chrome" # Still uses chromedriver
|
|
1560
1681
|
sb_config.account = config.getoption("account")
|
|
1561
1682
|
sb_config.data = config.getoption("data")
|
|
1562
1683
|
sb_config.var1 = config.getoption("var1")
|
|
@@ -1591,6 +1712,8 @@ def pytest_configure(config):
|
|
|
1591
1712
|
sb_config.extension_dir = config.getoption("extension_dir")
|
|
1592
1713
|
sb_config.disable_features = config.getoption("disable_features")
|
|
1593
1714
|
sb_config.binary_location = config.getoption("binary_location")
|
|
1715
|
+
if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
|
|
1716
|
+
sb_config.binary_location = sb_config._cdp_bin_loc
|
|
1594
1717
|
if config.getoption("use_cft") and not sb_config.binary_location:
|
|
1595
1718
|
sb_config.binary_location = "cft"
|
|
1596
1719
|
elif config.getoption("use_chs") and not sb_config.binary_location:
|
|
@@ -1910,24 +2033,24 @@ def _create_dashboard_assets_():
|
|
|
1910
2033
|
add_pytest_style_css = True
|
|
1911
2034
|
if os.path.exists(pytest_style_css):
|
|
1912
2035
|
existing_pytest_style = None
|
|
1913
|
-
with open(pytest_style_css, "r") as f:
|
|
2036
|
+
with open(pytest_style_css, mode="r") as f:
|
|
1914
2037
|
existing_pytest_style = f.read()
|
|
1915
2038
|
if existing_pytest_style == get_pytest_style():
|
|
1916
2039
|
add_pytest_style_css = False
|
|
1917
2040
|
if add_pytest_style_css:
|
|
1918
|
-
out_file = open(pytest_style_css, "w+", encoding="utf-8")
|
|
2041
|
+
out_file = open(pytest_style_css, mode="w+", encoding="utf-8")
|
|
1919
2042
|
out_file.writelines(get_pytest_style())
|
|
1920
2043
|
out_file.close()
|
|
1921
2044
|
live_js_file = os.path.join(assets_folder, "live.js")
|
|
1922
2045
|
add_live_js_file = True
|
|
1923
2046
|
if os.path.exists(live_js_file):
|
|
1924
2047
|
existing_live_js = None
|
|
1925
|
-
with open(live_js_file, "r") as f:
|
|
2048
|
+
with open(live_js_file, mode="r") as f:
|
|
1926
2049
|
existing_live_js = f.read()
|
|
1927
2050
|
if existing_live_js == live_js:
|
|
1928
2051
|
add_live_js_file = False
|
|
1929
2052
|
if add_live_js_file:
|
|
1930
|
-
out_file = open(live_js_file, "w+", encoding="utf-8")
|
|
2053
|
+
out_file = open(live_js_file, mode="w+", encoding="utf-8")
|
|
1931
2054
|
out_file.writelines(live_js)
|
|
1932
2055
|
out_file.close()
|
|
1933
2056
|
|
|
@@ -2228,7 +2351,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2228
2351
|
and html_report_path
|
|
2229
2352
|
and os.path.exists(html_report_path)
|
|
2230
2353
|
):
|
|
2231
|
-
with open(html_report_path, "r", encoding="utf-8") as f:
|
|
2354
|
+
with open(html_report_path, mode="r", encoding="utf-8") as f:
|
|
2232
2355
|
the_html_r = f.read()
|
|
2233
2356
|
assets_chunk = "if (assets.length === 1) {"
|
|
2234
2357
|
remove_media = "container.classList.remove('media-container')"
|
|
@@ -2274,18 +2397,18 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2274
2397
|
the_html_r = (
|
|
2275
2398
|
the_html_r[:rc_loc] + new_time + the_html_r[end_rc_loc:]
|
|
2276
2399
|
)
|
|
2277
|
-
with open(html_report_path, "w", encoding="utf-8") as f:
|
|
2400
|
+
with open(html_report_path, mode="w", encoding="utf-8") as f:
|
|
2278
2401
|
f.write(the_html_r) # Finalize the HTML report
|
|
2279
2402
|
with suppress(Exception):
|
|
2280
2403
|
shared_utils.make_writable(html_report_path)
|
|
2281
|
-
with open(html_report_path_copy, "w", encoding="utf-8") as f:
|
|
2404
|
+
with open(html_report_path_copy, mode="w", encoding="utf-8") as f:
|
|
2282
2405
|
f.write(the_html_r) # Finalize the HTML report copy
|
|
2283
2406
|
with suppress(Exception):
|
|
2284
2407
|
shared_utils.make_writable(html_report_path_copy)
|
|
2285
2408
|
assets_style = "./assets/style.css"
|
|
2286
2409
|
if os.path.exists(assets_style):
|
|
2287
2410
|
html_style = None
|
|
2288
|
-
with open(assets_style, "r", encoding="utf-8") as f:
|
|
2411
|
+
with open(assets_style, mode="r", encoding="utf-8") as f:
|
|
2289
2412
|
html_style = f.read()
|
|
2290
2413
|
if html_style:
|
|
2291
2414
|
html_style = html_style.replace("top: -50px;", "top: 2px;")
|
|
@@ -2297,7 +2420,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2297
2420
|
html_style = html_style.replace(".collapsible", ".oldc")
|
|
2298
2421
|
html_style = html_style.replace(" (hide details)", "")
|
|
2299
2422
|
html_style = html_style.replace(" (show details)", "")
|
|
2300
|
-
with open(assets_style, "w", encoding="utf-8") as f:
|
|
2423
|
+
with open(assets_style, mode="w", encoding="utf-8") as f:
|
|
2301
2424
|
f.write(html_style)
|
|
2302
2425
|
with suppress(Exception):
|
|
2303
2426
|
shared_utils.make_writable(assets_style)
|
|
@@ -2332,7 +2455,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2332
2455
|
# Part 1: Finalizing the dashboard / integrating html report
|
|
2333
2456
|
if os.path.exists(dashboard_path):
|
|
2334
2457
|
the_html_d = None
|
|
2335
|
-
with open(dashboard_path, "r", encoding="utf-8") as f:
|
|
2458
|
+
with open(dashboard_path, mode="r", encoding="utf-8") as f:
|
|
2336
2459
|
the_html_d = f.read()
|
|
2337
2460
|
if sb_config._multithreaded and "-c" in sys_argv:
|
|
2338
2461
|
# Threads have "-c" in sys.argv, except for the last
|
|
@@ -2343,7 +2466,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2343
2466
|
if os.path.exists(pie_path):
|
|
2344
2467
|
import json
|
|
2345
2468
|
|
|
2346
|
-
with open(pie_path, "r") as f:
|
|
2469
|
+
with open(pie_path, mode="r") as f:
|
|
2347
2470
|
dash_pie = f.read().strip()
|
|
2348
2471
|
sb_config._saved_dashboard_pie = json.loads(dash_pie)
|
|
2349
2472
|
# If the test run doesn't complete by itself, stop refresh
|
|
@@ -2374,20 +2497,20 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2374
2497
|
if sb_config._dash_final_summary:
|
|
2375
2498
|
the_html_d += sb_config._dash_final_summary
|
|
2376
2499
|
time.sleep(0.1) # Add time for "livejs" to detect changes
|
|
2377
|
-
with open(dashboard_path, "w", encoding="utf-8") as f:
|
|
2500
|
+
with open(dashboard_path, mode="w", encoding="utf-8") as f:
|
|
2378
2501
|
f.write(the_html_d) # Finalize the dashboard
|
|
2379
2502
|
time.sleep(0.1) # Add time for "livejs" to detect changes
|
|
2380
2503
|
the_html_d = the_html_d.replace(
|
|
2381
2504
|
"</head>", "</head><!-- Dashboard Report Done -->"
|
|
2382
2505
|
)
|
|
2383
|
-
with open(dashboard_path, "w", encoding="utf-8") as f:
|
|
2506
|
+
with open(dashboard_path, mode="w", encoding="utf-8") as f:
|
|
2384
2507
|
f.write(the_html_d) # Finalize the dashboard
|
|
2385
2508
|
with suppress(Exception):
|
|
2386
2509
|
shared_utils.make_writable(dashboard_path)
|
|
2387
2510
|
assets_style = "./assets/style.css"
|
|
2388
2511
|
if os.path.exists(assets_style):
|
|
2389
2512
|
html_style = None
|
|
2390
|
-
with open(assets_style, "r", encoding="utf-8") as f:
|
|
2513
|
+
with open(assets_style, mode="r", encoding="utf-8") as f:
|
|
2391
2514
|
html_style = f.read()
|
|
2392
2515
|
if html_style:
|
|
2393
2516
|
html_style = html_style.replace("top: -50px;", "top: 2px;")
|
|
@@ -2399,7 +2522,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2399
2522
|
html_style = html_style.replace(".collapsible", ".oldc")
|
|
2400
2523
|
html_style = html_style.replace(" (hide details)", "")
|
|
2401
2524
|
html_style = html_style.replace(" (show details)", "")
|
|
2402
|
-
with open(assets_style, "w", encoding="utf-8") as f:
|
|
2525
|
+
with open(assets_style, mode="w", encoding="utf-8") as f:
|
|
2403
2526
|
f.write(html_style)
|
|
2404
2527
|
with suppress(Exception):
|
|
2405
2528
|
shared_utils.make_writable(assets_style)
|
|
@@ -2421,7 +2544,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2421
2544
|
):
|
|
2422
2545
|
# Add the dashboard pie to the pytest html report
|
|
2423
2546
|
the_html_r = None
|
|
2424
|
-
with open(html_report_path, "r", encoding="utf-8") as f:
|
|
2547
|
+
with open(html_report_path, mode="r", encoding="utf-8") as f:
|
|
2425
2548
|
the_html_r = f.read()
|
|
2426
2549
|
if sb_config._saved_dashboard_pie:
|
|
2427
2550
|
h_r_name = sb_config._html_report_name
|
|
@@ -2484,11 +2607,13 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2484
2607
|
the_html_r = (
|
|
2485
2608
|
the_html_r[:rc_loc] + new_time + the_html_r[end_rc_loc:]
|
|
2486
2609
|
)
|
|
2487
|
-
with open(html_report_path, "w", encoding="utf-8") as f:
|
|
2610
|
+
with open(html_report_path, mode="w", encoding="utf-8") as f:
|
|
2488
2611
|
f.write(the_html_r) # Finalize the HTML report
|
|
2489
2612
|
with suppress(Exception):
|
|
2490
2613
|
shared_utils.make_writable(html_report_path)
|
|
2491
|
-
with open(
|
|
2614
|
+
with open(
|
|
2615
|
+
html_report_path_copy, mode="w", encoding="utf-8"
|
|
2616
|
+
) as f:
|
|
2492
2617
|
f.write(the_html_r) # Finalize the HTML report copy
|
|
2493
2618
|
with suppress(Exception):
|
|
2494
2619
|
shared_utils.make_writable(html_report_path_copy)
|
|
@@ -2533,7 +2658,9 @@ def pytest_unconfigure(config):
|
|
|
2533
2658
|
):
|
|
2534
2659
|
# Dash is HTML Report (Multithreaded)
|
|
2535
2660
|
sb_config._dash_is_html_report = True
|
|
2536
|
-
with open(
|
|
2661
|
+
with open(
|
|
2662
|
+
dashboard_path, mode="w", encoding="utf-8"
|
|
2663
|
+
) as f:
|
|
2537
2664
|
f.write(sb_config._dash_html)
|
|
2538
2665
|
# Dashboard Multithreaded
|
|
2539
2666
|
_perform_pytest_unconfigure_(config)
|