|
9 | 9 | sbase install chromedriver
|
10 | 10 | sbase mkdir browser_tests
|
11 | 11 | sbase mkfile new_test.py
|
12 |
| -sbase convert my_old_webdriver_unittest.py |
| 12 | +sbase options |
| 13 | +sbase convert old_webdriver_unittest.py |
13 | 14 | sbase print my_first_test.py -n
|
14 | 15 | sbase translate my_first_test.py --zh -p
|
15 | 16 | sbase extract-objects my_first_test.py
|
@@ -60,6 +61,7 @@ def show_basic_usage():
|
60 | 61 | sc += (" install [DRIVER_NAME] [OPTIONS]\n")
|
61 | 62 | sc += (" mkdir [DIRECTORY_NAME]\n")
|
62 | 63 | sc += (" mkfile [FILE_NAME.py]\n")
|
| 64 | + sc += (" options (display common pytest options)\n") |
63 | 65 | sc += (" convert [PYTHON_WEBDRIVER_UNITTEST_FILE]\n")
|
64 | 66 | sc += (" print [FILE] [OPTIONS]\n")
|
65 | 67 | sc += (" translate [SB_PYTHON_FILE] [LANGUAGE] [ACTION]\n")
|
@@ -436,6 +438,54 @@ def show_version_info():
|
436 | 438 | print('\n%s\n' % version)
|
437 | 439 |
|
438 | 440 |
|
| 441 | +def show_options(): |
| 442 | + c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX |
| 443 | + c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX |
| 444 | + c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX |
| 445 | + cr = colorama.Style.RESET_ALL |
| 446 | + sc = ("\n " + c2 + "** " + c3 + "pytest cmd options" + c2 + " **" + cr) |
| 447 | + print(sc) |
| 448 | + print("") |
| 449 | + line = "Here are some common pytest options to use with SeleniumBase:" |
| 450 | + line = c1 + line + cr |
| 451 | + print(line) |
| 452 | + print("") |
| 453 | + print('--browser=BROWSER (The web browser to use. Default: "chrome")') |
| 454 | + print('--headless (Run tests headlessly. Default mode on Linux OS.)') |
| 455 | + print('--demo (Slow down and visually see test actions as they occur.)') |
| 456 | + print('--slow (Slow down the automation. Faster than using Demo Mode.)') |
| 457 | + print('--reuse-session / --rs (Reuse the browser session between tests.)') |
| 458 | + print('--crumbs (Delete all cookies between tests reusing a session.)') |
| 459 | + print("--guest (Enable Chrome's Guest mode.)") |
| 460 | + print("--incognito (Enable Chrome's Incognito mode.)") |
| 461 | + print('-m MARKER (Only run tests with the specified pytest marker.)') |
| 462 | + print('-n NUM (Multithread the tests using that many threads.)') |
| 463 | + print('-v (Verbose mode. Print the full name of each test run.)') |
| 464 | + print("--agent=STRING (Modify the web browser's User-Agent string.)") |
| 465 | + print('--mobile (Use the mobile device emulator while running tests.)') |
| 466 | + print('--metrics=STRING (Set mobile "CSSWidth,CSSHeight,PixelRatio".)') |
| 467 | + print('--maximize (Start tests with the web browser window maximized.)') |
| 468 | + print('--ad-block (Block some types of display ads after page loads.)') |
| 469 | + print('--check-js (Check for JavaScript errors after page loads.)') |
| 470 | + print('--pdb (Enter Debug Mode if a test fails. h: Help. c: Continue.') |
| 471 | + print(' interact: Interactive Mode. CTRL-D: Exit Interactive Mode.)') |
| 472 | + print('--html=report.html (Create a detailed pytest-html report.)') |
| 473 | + print('--archive-logs (Archive old log files instead of deleting them.)') |
| 474 | + print('--disable-csp (Disable the Content Security Policy of websites.)') |
| 475 | + print('--proxy=SERVER:PORT (Set a proxy server:port combo for tests.)') |
| 476 | + print("--settings-file=FILE (Override default SeleniumBase settings.)") |
| 477 | + print('--env=ENV (Set the test env. Access with "self.env" in tests.)') |
| 478 | + print('--data=DATA (Extra test data. Access with "self.data" in tests.)') |
| 479 | + print('--collect-only -q (Show discovered tests without running them.)') |
| 480 | + print('--save-screenshot (Save a screenshot at the end of each test.)') |
| 481 | + print('-x (Stop running tests after the first failure is reached.)') |
| 482 | + print("") |
| 483 | + line = 'For the full list of ' + c1 + 'command-line options' + cr |
| 484 | + line += ', type: "' + c2 + 'pytest' + cr + ' ' + c3 + '--help' + cr + '".' |
| 485 | + print(line) |
| 486 | + print("") |
| 487 | + |
| 488 | + |
439 | 489 | def show_detailed_help():
|
440 | 490 | c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
|
441 | 491 | c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
|
@@ -605,6 +655,8 @@ def main():
|
605 | 655 | show_version_info()
|
606 | 656 | else:
|
607 | 657 | show_basic_usage()
|
| 658 | + elif command == "options" or command == "--options": |
| 659 | + show_options() |
608 | 660 | elif command == "help" or command == "--help":
|
609 | 661 | if len(command_args) >= 1:
|
610 | 662 | if command_args[0] == "install":
|
|
0 commit comments