|
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,12 +76,31 @@ 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
|
81 | 100 | error states, we want to make sure that they don't show up in
|
82 | 101 | the nose output as errors.
|
83 | 102 | """
|
| 103 | + self.__log_all_options_if_none_specified(test) |
84 | 104 | if (err[0] == errors.BlockedTest or
|
85 | 105 | err[0] == errors.SkipTest or
|
86 | 106 | err[0] == errors.DeprecatedTest):
|
|
0 commit comments