Skip to content

Commit 15d7149

Browse files
committed
Add a cmd arg for handling Messenger message duration
1 parent e2722e1 commit 15d7149

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

seleniumbase/config/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
# Each loop is about 0.18 seconds. (Override by using "--highlights=TIMES".)
6767
HIGHLIGHTS = 4
6868

69+
# Default time to keep messenger notifications visible (in seconds).
70+
# Messenger notifications appear when reaching assert statements in Demo Mode.
71+
DEFAULT_MESSAGE_DURATION = 2.55
6972

7073
# #####>>>>>----- MasterQA SETTINGS -----<<<<<#####
7174
# ##### (Used when importing MasterQA as the parent class)

seleniumbase/plugins/pytest_plugin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ def pytest_addoption(parser):
107107
default=None,
108108
help="""Setting this overrides the default number of
109109
highlight animation loops to have per call.""")
110+
parser.addoption('--message_duration', action="store",
111+
dest='message_duration',
112+
default=None,
113+
help="""Setting this overrides the default time that
114+
messenger notifications remain visible when reaching
115+
assert statements during Demo Mode.""")
110116
parser.addoption('--ad_block', action="store_true",
111117
dest='ad_block_on',
112118
default=False,

seleniumbase/plugins/selenium_plugin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class SeleniumBrowser(Plugin):
2222
self.options.demo_mode -- the option to slow down Selenium (--demo_mode)
2323
self.options.demo_sleep -- Selenium action delay in DemoMode (--demo_sleep)
2424
self.options.highlights -- # of highlight animations shown (--highlights)
25+
self.options.message_duration -- Messenger alert time (--message_duration)
2526
self.options.ad_block -- the option to block some display ads (--ad_block)
2627
self.options.verify_delay -- delay before MasterQA checks (--verify_delay)
2728
self.options.timeout_multiplier -- increase defaults (--timeout_multiplier)
@@ -85,6 +86,12 @@ def options(self, parser, env):
8586
dest='highlights', default=None,
8687
help="""Setting this overrides the default number of
8788
highlight animation loops to have per call.""")
89+
parser.add_option(
90+
'--message_duration', action="store",
91+
dest='message_duration', default=None,
92+
help="""Setting this overrides the default time that
93+
messenger notifications remain visible when reaching
94+
assert statements during Demo Mode.""")
8895
parser.add_option(
8996
'--ad_block', action="store_true",
9097
dest='ad_block_on',
@@ -119,6 +126,7 @@ def beforeTest(self, test):
119126
test.test.demo_mode = self.options.demo_mode
120127
test.test.demo_sleep = self.options.demo_sleep
121128
test.test.highlights = self.options.highlights
129+
test.test.message_duration = self.options.message_duration
122130
test.test.ad_block_on = self.options.ad_block_on
123131
test.test.verify_delay = self.options.verify_delay # MasterQA
124132
test.test.timeout_multiplier = self.options.timeout_multiplier

0 commit comments

Comments
 (0)