diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2023-10-16 12:01:58 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-10-18 06:14:40 +0200 |
| commit | be56c982c0805f62a2948d9d7a3e21215c352174 (patch) | |
| tree | 73bcfab853c8d05774e15b9875b231d131b8671b /tests/runtests.py | |
| parent | 4a5048b036fd9e965515e31fdd70b0af72655cba (diff) | |
Refs #34043 -- Added --screenshots option to runtests.py and selenium tests.
Diffstat (limited to 'tests/runtests.py')
| -rwxr-xr-x | tests/runtests.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/runtests.py b/tests/runtests.py index b5f499fe7e..e03966410b 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -26,7 +26,7 @@ else: from django.db import connection, connections from django.test import TestCase, TransactionTestCase from django.test.runner import get_max_test_processes, parallel_type - from django.test.selenium import SeleniumTestCaseBase + from django.test.selenium import SeleniumTestCase, SeleniumTestCaseBase from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner from django.utils.deprecation import RemovedInDjango60Warning from django.utils.log import DEFAULT_LOGGING @@ -599,6 +599,11 @@ if __name__ == "__main__": help="A comma-separated list of browsers to run the Selenium tests against.", ) parser.add_argument( + "--screenshots", + action="store_true", + help="Take screenshots during selenium tests to capture the user interface.", + ) + parser.add_argument( "--headless", action="store_true", help="Run selenium tests in headless mode, if the browser supports the option.", @@ -699,6 +704,10 @@ if __name__ == "__main__": ) if using_selenium_hub and not options.external_host: parser.error("--selenium-hub and --external-host must be used together.") + if options.screenshots and not options.selenium: + parser.error("--screenshots require --selenium to be used.") + if options.screenshots and options.tags: + parser.error("--screenshots and --tag are mutually exclusive.") # Allow including a trailing slash on app_labels for tab completion convenience options.modules = [os.path.normpath(labels) for labels in options.modules] @@ -748,6 +757,9 @@ if __name__ == "__main__": SeleniumTestCaseBase.external_host = options.external_host SeleniumTestCaseBase.headless = options.headless SeleniumTestCaseBase.browsers = options.selenium + if options.screenshots: + options.tags = ["screenshot"] + SeleniumTestCase.screenshots = options.screenshots if options.bisect: bisect_tests( |
