summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/test/selenium.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/test/selenium.py b/django/test/selenium.py
index eecfd87bf1..2840afb9ec 100644
--- a/django/test/selenium.py
+++ b/django/test/selenium.py
@@ -142,6 +142,8 @@ class SeleniumTestCase(LiveServerTestCase, metaclass=SeleniumTestCaseBase):
test.__name__ = f"{name}_{screenshot_case}"
test.__qualname__ = f"{test.__qualname__}_{screenshot_case}"
+ test._screenshot_name = name
+ test._screenshot_case = screenshot_case
setattr(cls, test.__name__, test)
@classproperty
@@ -214,7 +216,9 @@ class SeleniumTestCase(LiveServerTestCase, metaclass=SeleniumTestCaseBase):
def take_screenshot(self, name):
if not self.screenshots:
return
- path = Path.cwd() / "screenshots" / f"{self._testMethodName}-{name}.png"
+ test = getattr(self, self._testMethodName)
+ filename = f"{test._screenshot_name}--{name}--{test._screenshot_case}.png"
+ path = Path.cwd() / "screenshots" / filename
path.parent.mkdir(exist_ok=True, parents=True)
self.selenium.save_screenshot(path)