mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #34043 -- Added --screenshots option to runtests.py and selenium tests.
This commit is contained in:
committed by
Mariusz Felisiak
parent
4a5048b036
commit
be56c982c0
@@ -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
|
||||
@@ -598,6 +598,11 @@ if __name__ == "__main__":
|
||||
metavar="BROWSERS",
|
||||
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",
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user