12
12
def pytest_addoption (parser ):
13
13
parser = parser .getgroup ('SeleniumBase' ,
14
14
'SeleniumBase specific configuration options' )
15
- parser .addoption ('--browser' , action = "store" ,
15
+ parser .addoption ('--browser' ,
16
+ action = "store" ,
16
17
dest = 'browser' ,
17
18
type = str .lower ,
18
19
choices = constants .ValidBrowsers .valid_browsers ,
19
20
default = constants .Browser .GOOGLE_CHROME ,
20
21
help = """Specifies the web browser to use. Default: Chrome.
21
22
If you want to use Firefox, explicitly indicate that.
22
23
Example: (--browser=firefox)""" )
23
- parser .addoption ('--with-selenium' , action = "store_true" ,
24
+ parser .addoption ('--with-selenium' ,
25
+ action = "store_true" ,
24
26
dest = 'with_selenium' ,
25
27
default = True ,
26
28
help = "Use if tests need to be run with a web browser." )
27
- parser .addoption ('--env' , action = 'store' ,
29
+ parser .addoption ('--env' ,
30
+ action = 'store' ,
28
31
dest = 'environment' ,
29
32
type = str .lower ,
30
33
choices = (
@@ -38,18 +41,22 @@ def pytest_addoption(parser):
38
41
),
39
42
default = constants .Environment .TEST ,
40
43
help = "The environment to run the tests in." )
41
- parser .addoption ('--data' , dest = 'data' ,
44
+ parser .addoption ('--data' ,
45
+ dest = 'data' ,
42
46
default = None ,
43
47
help = 'Extra data to pass from the command line.' )
44
- parser .addoption ('--cap_file' , dest = 'cap_file' ,
48
+ parser .addoption ('--cap_file' , '--cap-file' ,
49
+ dest = 'cap_file' ,
45
50
default = None ,
46
51
help = """The file that stores browser desired capabilities
47
52
for BrowserStack or Sauce Labs web drivers.""" )
48
- parser .addoption ('--user_data_dir' , dest = 'user_data_dir' ,
53
+ parser .addoption ('--user_data_dir' , '--user-data-dir' ,
54
+ dest = 'user_data_dir' ,
49
55
default = None ,
50
56
help = """The Chrome User Data Directory to use. (Profile)
51
57
If the directory doesn't exist, it'll be created.""" )
52
- parser .addoption ('--with-testing_base' , action = "store_true" ,
58
+ parser .addoption ('--with-testing_base' , '--with-testing-base' ,
59
+ action = "store_true" ,
53
60
dest = 'with_testing_base' ,
54
61
default = True ,
55
62
help = """Use to save logs and screenshots when tests fail.
@@ -59,55 +66,66 @@ def pytest_addoption(parser):
59
66
--with-basic_test_info ,
60
67
--with-page_source
61
68
""" )
62
- parser .addoption ('--log_path' , dest = 'log_path' ,
69
+ parser .addoption ('--log_path' , '--log-path' ,
70
+ dest = 'log_path' ,
63
71
default = 'latest_logs/' ,
64
72
help = 'Where the log files are saved.' )
65
- parser .addoption ('--archive_logs' , action = "store_true" ,
73
+ parser .addoption ('--archive_logs' , '--archive-logs' ,
74
+ action = "store_true" ,
66
75
dest = 'archive_logs' ,
67
76
default = False ,
68
77
help = "Archive old log files instead of deleting them." )
69
- parser .addoption ('--with-db_reporting' , action = "store_true" ,
78
+ parser .addoption ('--with-db_reporting' , '--with-db-reporting' ,
79
+ action = "store_true" ,
70
80
dest = 'with_db_reporting' ,
71
81
default = False ,
72
82
help = "Use to record test data in the MySQL database." )
73
- parser .addoption ('--database_env' , action = 'store' ,
83
+ parser .addoption ('--database_env' , '--database-env' ,
84
+ action = 'store' ,
74
85
dest = 'database_env' ,
75
86
choices = (
76
87
'production' , 'qa' , 'staging' , 'develop' ,
77
88
'test' , 'local' , 'master'
78
89
),
79
90
default = 'test' ,
80
91
help = optparse .SUPPRESS_HELP )
81
- parser .addoption ('--with-s3_logging' , action = "store_true" ,
92
+ parser .addoption ('--with-s3_logging' , '--with-s3-logging' ,
93
+ action = "store_true" ,
82
94
dest = 'with_s3_logging' ,
83
95
default = False ,
84
96
help = "Use to save test log files in Amazon S3." )
85
- parser .addoption ('--with-screen_shots' , action = "store_true" ,
97
+ parser .addoption ('--with-screen_shots' , '--with-screen-shots' ,
98
+ action = "store_true" ,
86
99
dest = 'with_screen_shots' ,
87
100
default = False ,
88
101
help = """Use to save screenshots on test failure.
89
102
(Automatically on when using --with-testing_base)""" )
90
- parser .addoption ('--with-basic_test_info' , action = "store_true" ,
103
+ parser .addoption ('--with-basic_test_info' , '--with-basic-test-info' ,
104
+ action = "store_true" ,
91
105
dest = 'with_basic_test_info' ,
92
106
default = False ,
93
107
help = """Use to save basic test info on test failure.
94
108
(Automatically on when using --with-testing_base)""" )
95
- parser .addoption ('--with-page_source' , action = "store_true" ,
109
+ parser .addoption ('--with-page_source' , '--with-page-source' ,
110
+ action = "store_true" ,
96
111
dest = 'with_page_source' ,
97
112
default = False ,
98
113
help = """Use to save page source on test failure.
99
114
(Automatically on when using --with-testing_base)""" )
100
- parser .addoption ('--server' , action = 'store' ,
115
+ parser .addoption ('--server' ,
116
+ action = 'store' ,
101
117
dest = 'servername' ,
102
118
default = 'localhost' ,
103
119
help = """Designates the Selenium Grid server to use.
104
120
Default: localhost.""" )
105
- parser .addoption ('--port' , action = 'store' ,
121
+ parser .addoption ('--port' ,
122
+ action = 'store' ,
106
123
dest = 'port' ,
107
124
default = '4444' ,
108
125
help = """Designates the Selenium Grid port to use.
109
126
Default: 4444.""" )
110
- parser .addoption ('--proxy' , action = 'store' ,
127
+ parser .addoption ('--proxy' ,
128
+ action = 'store' ,
111
129
dest = 'proxy_string' ,
112
130
default = None ,
113
131
help = """Designates the proxy server:port to use.
@@ -121,64 +139,79 @@ def pytest_addoption(parser):
121
139
help = """Designates the User-Agent for the browser to use.
122
140
Format: A string.
123
141
Default: None.""" )
124
- parser .addoption ('--extension_zip' , action = 'store' ,
142
+ parser .addoption ('--extension_zip' , '--extension-zip' ,
143
+ action = 'store' ,
125
144
dest = 'extension_zip' ,
126
145
default = None ,
127
146
help = """Designates the Chrome Extension ZIP file to load.
128
147
Format: A comma-separated list of .zip or .crx files
129
148
containing the Chrome extensions to load.
130
149
Default: None.""" )
131
- parser .addoption ('--extension_dir' , action = 'store' ,
150
+ parser .addoption ('--extension_dir' , '--extension-dir' ,
151
+ action = 'store' ,
132
152
dest = 'extension_dir' ,
133
153
default = None ,
134
154
help = """Designates the Chrome Extension folder to load.
135
155
Format: A directory containing the Chrome extension.
136
156
(Can also be a comma-separated list of directories.)
137
157
Default: None.""" )
138
- parser .addoption ('--headless' , action = "store_true" ,
158
+ parser .addoption ('--headless' ,
159
+ action = "store_true" ,
139
160
dest = 'headless' ,
140
161
default = False ,
141
162
help = """Using this makes Webdriver run headlessly,
142
163
which is required on headless machines.""" )
143
- parser .addoption ('--is_pytest' , action = "store_true" ,
164
+ parser .addoption ('--is_pytest' , '--is-pytest' ,
165
+ action = "store_true" ,
144
166
dest = 'is_pytest' ,
145
167
default = True ,
146
168
help = """This is used by the BaseCase class to tell apart
147
169
pytest runs from nosetest runs. (Automatic)""" )
148
- parser .addoption ('--demo_mode' , action = "store_true" ,
170
+ parser .addoption ('--demo_mode' , '--demo-mode' ,
171
+ action = "store_true" ,
149
172
dest = 'demo_mode' ,
150
173
default = False ,
151
174
help = """Using this slows down the automation so that
152
175
you can see what it's actually doing.""" )
153
- parser .addoption ('--demo_sleep' , action = 'store' , dest = 'demo_sleep' ,
176
+ parser .addoption ('--demo_sleep' , '--demo-sleep' ,
177
+ action = 'store' ,
178
+ dest = 'demo_sleep' ,
154
179
default = None ,
155
180
help = """Setting this overrides the Demo Mode sleep
156
181
time that happens after browser actions.""" )
157
- parser .addoption ('--highlights' , action = 'store' , dest = 'highlights' ,
182
+ parser .addoption ('--highlights' ,
183
+ action = 'store' ,
184
+ dest = 'highlights' ,
158
185
default = None ,
159
186
help = """Setting this overrides the default number of
160
187
highlight animation loops to have per call.""" )
161
- parser .addoption ('--message_duration' , action = "store" ,
188
+ parser .addoption ('--message_duration' , '--message-duration' ,
189
+ action = "store" ,
162
190
dest = 'message_duration' ,
163
191
default = None ,
164
192
help = """Setting this overrides the default time that
165
193
messenger notifications remain visible when reaching
166
194
assert statements during Demo Mode.""" )
167
- parser .addoption ('--check_js' , action = "store_true" ,
195
+ parser .addoption ('--check_js' , '--check-js' ,
196
+ action = "store_true" ,
168
197
dest = 'js_checking_on' ,
169
198
default = False ,
170
199
help = """The option to check for JavaScript errors after
171
200
every page load.""" )
172
- parser .addoption ('--ad_block' , action = "store_true" ,
201
+ parser .addoption ('--ad_block' , '--ad-block' ,
202
+ action = "store_true" ,
173
203
dest = 'ad_block_on' ,
174
204
default = False ,
175
205
help = """Using this makes WebDriver block display ads
176
206
that are defined in ad_block_list.AD_BLOCK_LIST.""" )
177
- parser .addoption ('--verify_delay' , action = 'store' , dest = 'verify_delay' ,
207
+ parser .addoption ('--verify_delay' , '--verify-delay' ,
208
+ action = 'store' ,
209
+ dest = 'verify_delay' ,
178
210
default = None ,
179
211
help = """Setting this overrides the default wait time
180
212
before each MasterQA verification pop-up.""" )
181
- parser .addoption ('--disable_csp' , action = "store_true" ,
213
+ parser .addoption ('--disable_csp' , '--disable-csp' ,
214
+ action = "store_true" ,
182
215
dest = 'disable_csp' ,
183
216
default = False ,
184
217
help = """Using this disables the Content Security Policy of
@@ -187,23 +220,27 @@ def pytest_addoption(parser):
187
220
libraries for various testing actions.
188
221
Setting this to True (--disable_csp) overrides the
189
222
value set in seleniumbase/config/settings.py""" )
190
- parser .addoption ('--enable_sync' , action = "store_true" ,
223
+ parser .addoption ('--enable_sync' , '--enable-sync' ,
224
+ action = "store_true" ,
191
225
dest = 'enable_sync' ,
192
226
default = False ,
193
227
help = """Using this enables the "Chrome Sync" feature.""" )
194
- parser .addoption ('--save_screenshot' , action = 'store_true' ,
228
+ parser .addoption ('--save_screenshot' , '--save-screenshot' ,
229
+ action = 'store_true' ,
195
230
dest = 'save_screenshot' ,
196
231
default = False ,
197
232
help = """Take a screenshot on last page after the last step
198
233
of the test. (Added to the "latest_logs" folder.)""" )
199
- parser .addoption ('--visual_baseline' , action = 'store_true' ,
234
+ parser .addoption ('--visual_baseline' , '--visual-baseline' ,
235
+ action = 'store_true' ,
200
236
dest = 'visual_baseline' ,
201
237
default = False ,
202
238
help = """Setting this resets the visual baseline for
203
239
Automated Visual Testing with SeleniumBase.
204
240
When a test calls self.check_window(), it will
205
241
rebuild its files in the visual_baseline folder.""" )
206
- parser .addoption ('--timeout_multiplier' , action = 'store' ,
242
+ parser .addoption ('--timeout_multiplier' , '--timeout-multiplier' ,
243
+ action = 'store' ,
207
244
dest = 'timeout_multiplier' ,
208
245
default = None ,
209
246
help = """Setting this overrides the default timeout
0 commit comments