Skip to content
Snippets Groups Projects
Verified Commit 99b5b169 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[Tests] Create screenshots if enabled in environment

parent 8fe96859
No related branches found
No related tags found
No related merge requests found
import os
import pytest
from django.test import LiveServerTestCase
......@@ -20,10 +22,18 @@ class SeleniumTests(LiveServerTestCase):
cls.selenium.quit()
super().tearDownClass()
@classmethod
def _screenshot(cls, filename):
screenshot_path = os.environ.get('TEST_SCREENSHOT_PATH', None)
if screenshot_path:
return cls.selenium.save_screenshot(os.path.join(screenshot_path, filename))
else:
return False
def test_index(self):
self.selenium.get(self.live_server_url + '/')
assert 'BiscuIT' in self.selenium.title
self.selenium.save_screenshot('screenshots/index.png')
self._screenshot('index.png')
class SeleniumTestsChromium(SeleniumTests):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment