Skip to content

Commit

Permalink
add the test duration to the output
Browse files Browse the repository at this point in the history
  • Loading branch information
marph91 committed Sep 20, 2021
1 parent bb4e3d0 commit 09ba8ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,19 @@ def setUpClass(cls):
cls.editor = cls.driver.find_element_by_class_name("rli-editor")
cls.editor_toolbar = cls.editor.find_element_by_class_name("editor-toolbar")

def setUp(self):
super().setUp()
self.start_time = time.time()

def tearDown(self):
super().tearDown()

# add the duration to each test
print(f"{time.time() - self.start_time:.3f} s, ", end="", flush=True)

for _, error in self._outcome.errors:
if error:
# TODO: Check only once for error?
if error is not None:
datestr = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
self.driver.get_screenshot_as_file(
f"debug/{datestr}_{self.id()}_webdriver.png"
Expand Down

0 comments on commit 09ba8ea

Please sign in to comment.