From 4ef9067a0b0b26f987aea2148839d16390b01047 Mon Sep 17 00:00:00 2001 From: "robinwilliam.hundt" <robinwilliam.hundt@stud.uni-goettingen.de> Date: Thu, 15 Aug 2019 17:47:28 +0200 Subject: [PATCH] Fixed screenshots --- .gitlab-ci.yml | 3 ++- functional_tests/.gitignore | 2 +- functional_tests/test_export_modal.py | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4982209..ff2b57e4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -108,7 +108,8 @@ test_frontend: - HEADLESS_TESTS=True pytest --ds=grady.settings.test functional_tests artifacts: paths: - - .screenshots/ + - functional_tests/screenshots/ + when: on_failure expire_in: 30 days test_frontend_unit: diff --git a/functional_tests/.gitignore b/functional_tests/.gitignore index 8380e4bf..975c04db 100644 --- a/functional_tests/.gitignore +++ b/functional_tests/.gitignore @@ -1,3 +1,3 @@ export.json export.csv - +screenshots diff --git a/functional_tests/test_export_modal.py b/functional_tests/test_export_modal.py index 4754e72a..92d08bcc 100644 --- a/functional_tests/test_export_modal.py +++ b/functional_tests/test_export_modal.py @@ -26,6 +26,7 @@ def expect_file_to_be_downloaded(path): JSON_EXPORT_FILE = os.path.join(os.path.dirname(__file__), 'export.json') +SCREENSHOTS = os.path.join(os.path.dirname(__file__), 'screenshots') class ExportTestModal(LiveServerTestCase): @@ -56,12 +57,14 @@ class ExportTestModal(LiveServerTestCase): def tearDown(self): try: - os.mkdir('.screenshots') + os.mkdir(SCREENSHOTS) except FileExistsError: pass for method, error in self._outcome.errors: if error: - self.browser.get_screenshot_as_file(".screenshots/" + self.id() + ".png") + self.browser.get_screenshot_as_file( + os.path.join(SCREENSHOTS, self.id() + ".png") + ) reset_browser_after_test(self.browser, self.live_server_url) def _login(self): -- GitLab