e2e: save screenshot on failure, upload to github actions
This commit is contained in:
parent
5c49cda884
commit
0838f518d4
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -139,6 +139,10 @@ jobs:
|
|||
yarn
|
||||
- name: Run coverage
|
||||
run: pipenv run coverage run ./manage.py test --failfast
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
path: out/
|
||||
- name: Create XML Report
|
||||
run: pipenv run coverage xml
|
||||
- uses: codecov/codecov-action@v1
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""passbook e2e testing utilities"""
|
||||
from functools import lru_cache
|
||||
from os import makedirs
|
||||
from glob import glob
|
||||
from importlib.util import module_from_spec, spec_from_file_location
|
||||
from inspect import getmembers, isfunction
|
||||
|
@ -40,6 +41,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
|
|||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
makedirs("out", exist_ok=True)
|
||||
self.driver = self._get_driver()
|
||||
self.driver.maximize_window()
|
||||
self.driver.implicitly_wait(5)
|
||||
|
@ -53,6 +55,8 @@ class SeleniumTestCase(StaticLiveServerTestCase):
|
|||
)
|
||||
|
||||
def tearDown(self):
|
||||
if self.failureException:
|
||||
self.driver.save_screenshot("out/{self.__class__.__name__}.png")
|
||||
self.driver.quit()
|
||||
super().tearDown()
|
||||
|
||||
|
|
Reference in a new issue