Skip to content

Commit f4e7499

Browse files
committed
Use the correct log path for tests that use the "sb" fixture
1 parent 97ab233 commit f4e7499

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,8 +2988,7 @@ def save_screenshot_to_logs(
29882988
(The last_page / failure screenshot is always "screenshot.png")
29892989
The screenshot will be in PNG format."""
29902990
self.wait_for_ready_state_complete()
2991-
test_id = self.__get_test_id()
2992-
test_logpath = self.log_path + "/" + test_id
2991+
test_logpath = os.path.join(self.log_path, self.__get_test_id())
29932992
self.__create_log_path_as_needed(test_logpath)
29942993
if name:
29952994
name = str(name)
@@ -11202,6 +11201,7 @@ def __get_test_id(self):
1120211201
)
1120311202
if self._sb_test_identifier and len(str(self._sb_test_identifier)) > 6:
1120411203
test_id = self._sb_test_identifier
11204+
test_id = test_id.replace(".py::", ".").replace("::", ".")
1120511205
return test_id
1120611206

1120711207
def __get_test_id_2(self):
@@ -11627,8 +11627,7 @@ def save_teardown_screenshot(self):
1162711627
except Exception:
1162811628
return
1162911629
if self.__has_exception() or self.save_screenshot_after_test:
11630-
test_id = self.__get_test_id()
11631-
test_logpath = self.log_path + "/" + test_id
11630+
test_logpath = os.path.join(self.log_path, self.__get_test_id())
1163211631
self.__create_log_path_as_needed(test_logpath)
1163311632
self.__set_last_page_screenshot()
1163411633
self.__set_last_page_url()
@@ -11718,7 +11717,7 @@ def tearDown(self):
1171811717
and not has_exception
1171911718
and self.save_screenshot_after_test
1172011719
):
11721-
test_logpath = self.log_path + "/" + test_id
11720+
test_logpath = os.path.join(self.log_path, test_id)
1172211721
self.__create_log_path_as_needed(test_logpath)
1172311722
if not self.__last_page_screenshot_png:
1172411723
self.__set_last_page_screenshot()
@@ -11731,7 +11730,7 @@ def tearDown(self):
1173111730
)
1173211731
self.__add_pytest_html_extra()
1173311732
if self.with_testing_base and has_exception:
11734-
test_logpath = self.log_path + "/" + test_id
11733+
test_logpath = os.path.join(self.log_path, test_id)
1173511734
self.__create_log_path_as_needed(test_logpath)
1173611735
if (
1173711736
not self.with_screen_shots
@@ -11861,7 +11860,7 @@ def tearDown(self):
1186111860
# (Nosetests)
1186211861
if has_exception:
1186311862
test_id = self.__get_test_id()
11864-
test_logpath = self.log_path + "/" + test_id
11863+
test_logpath = os.path.join(self.log_path, test_id)
1186511864
self.__create_log_path_as_needed(test_logpath)
1186611865
log_helper.log_test_failure_data(
1186711866
self,
@@ -11885,7 +11884,7 @@ def tearDown(self):
1188511884
)
1188611885
elif self.save_screenshot_after_test:
1188711886
test_id = self.__get_test_id()
11888-
test_logpath = self.log_path + "/" + test_id
11887+
test_logpath = os.path.join(self.log_path, test_id)
1188911888
self.__create_log_path_as_needed(test_logpath)
1189011889
if not self.__last_page_screenshot_png:
1189111890
self.__set_last_page_screenshot()

0 commit comments

Comments
 (0)