11
11
from nose .plugins import Plugin
12
12
from nose .exc import SkipTest
13
13
from seleniumbase .config import settings
14
+ from seleniumbase .core import log_helper
14
15
from seleniumbase .fixtures import constants , errors
15
16
16
17
@@ -75,6 +76,24 @@ def beforeTest(self, test):
75
76
test .test .data = self .options .data
76
77
test .test .args = self .options
77
78
79
+ def __log_all_options_if_none_specified (self , test ):
80
+ """
81
+ When testing_base is specified, but none of the log options to save are
82
+ specified (basic_test_info, screen_shots, page_source), then save them
83
+ all by default. Otherwise, save only selected ones from their plugins.
84
+ """
85
+ if ((not self .options .enable_plugin_basic_test_info ) and
86
+ (not self .options .enable_plugin_screen_shots ) and
87
+ (not self .options .enable_plugin_page_source )):
88
+ test_logpath = self .options .log_path + "/" + test .id ()
89
+ log_helper .log_screenshot (test_logpath , test .driver )
90
+ log_helper .log_test_failure_data (
91
+ test_logpath , test .driver , test .browser )
92
+ log_helper .log_page_source (test_logpath , test .driver )
93
+
94
+ def addFailure (self , test , err , capt = None ):
95
+ self .__log_all_options_if_none_specified (test )
96
+
78
97
def addError (self , test , err , capt = None ):
79
98
"""
80
99
Since Skip, Blocked, and Deprecated are all technically errors, but not
@@ -87,6 +106,8 @@ def addError(self, test, err, capt=None):
87
106
print err [1 ].__str__ ().split ('''-------------------- >> '''
88
107
'''begin captured logging'''
89
108
''' << --------------------''' , 1 )[0 ]
109
+ else :
110
+ self .__log_all_options_if_none_specified (test )
90
111
91
112
def handleError (self , test , err , capt = None ):
92
113
"""
0 commit comments