Skip to content

Commit 663b8f0

Browse files
committed
Log all options by default when individual ones are not specified
1 parent b96361a commit 663b8f0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

seleniumbase/plugins/base_plugin.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from nose.plugins import Plugin
1212
from nose.exc import SkipTest
1313
from seleniumbase.config import settings
14+
from seleniumbase.core import log_helper
1415
from seleniumbase.fixtures import constants, errors
1516

1617

@@ -75,12 +76,31 @@ def beforeTest(self, test):
7576
test.test.data = self.options.data
7677
test.test.args = self.options
7778

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+
7897
def addError(self, test, err, capt=None):
7998
"""
8099
Since Skip, Blocked, and Deprecated are all technically errors, but not
81100
error states, we want to make sure that they don't show up in
82101
the nose output as errors.
83102
"""
103+
self.__log_all_options_if_none_specified(test)
84104
if (err[0] == errors.BlockedTest or
85105
err[0] == errors.SkipTest or
86106
err[0] == errors.DeprecatedTest):

0 commit comments

Comments
 (0)