Skip to content

Commit a07a62e

Browse files
authored
Merge pull request #1360 from seleniumbase/bug-fixes-and-updates
Bug fixes and updates
2 parents e82abee + 0afece0 commit a07a62e

File tree

17 files changed

+102
-30
lines changed

17 files changed

+102
-30
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ The code above will leave your browser window open in case there's a failure. (i
484484
--use-auto-ext # (Use Chrome's automation extension.)
485485
--remote-debug # (Enable Chrome's Remote Debugger on http://localhost:9222)
486486
--dashboard # (Enable the SeleniumBase Dashboard. Saved at: dashboard.html)
487+
--dash-title=STRING # (Set the title shown for the generated dashboard.)
487488
--swiftshader # (Use Chrome's "--use-gl=swiftshader" feature.)
488489
--incognito # (Enable Chrome's Incognito mode.)
489490
--guest # (Enable Chrome's Guest mode.)

examples/behave_bdd/ReadMe.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Feature: SeleniumBase scenarios for the RealWorld App # features/realworld.featu
1414

1515
Scenario: Verify RealWorld App (log in / sign out) # features/realworld.feature:3
1616
Given Open "seleniumbase.io/realworld/login" # ../../sbase/steps.py:10
17-
And Clear Session Storage # ../../sbase/steps.py:389
17+
And Clear Session Storage # ../../sbase/steps.py:391
1818
When Type "demo_user" into "#username" # ../../sbase/steps.py:28
1919
And Type "secret_pass" into "#password" # ../../sbase/steps.py:28
20-
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode" # ../../sbase/steps.py:192
20+
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode" # ../../sbase/steps.py:194
2121
Then Assert exact text "Welcome!" in "h1" # ../../sbase/steps.py:85
22-
And Highlight "img#image1" # ../../sbase/steps.py:93
22+
And Highlight "img#image1" # ../../sbase/steps.py:95
2323
And Click 'a:contains("This Page")' # ../../sbase/steps.py:19
24-
And Save screenshot to logs # ../../sbase/steps.py:118
25-
When Click link "Sign out" # ../../sbase/steps.py:102
24+
And Save screenshot to logs # ../../sbase/steps.py:120
25+
When Click link "Sign out" # ../../sbase/steps.py:104
2626
Then Assert element 'a:contains("Sign in")' # ../../sbase/steps.py:60
2727
And Assert text "You have been signed out!" # ../../sbase/steps.py:77
2828
✅ Scenario Passed!

examples/hack_the_planet.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def test_all_your_base_are_belong_to_us(self):
6969
self.highlight("h2", loops=9, scroll=False)
7070

7171
self.open("https://google.com/ncr")
72+
self.hide_elements('iframe')
7273
self.set_text_content('a[href*="about.google"]', ayb)
7374
self.set_text_content('a[href*="store.google"]', abtu)
7475
self.set_text_content('a[href*="mail.google.com"]', ayb)
@@ -169,11 +170,9 @@ def test_all_your_base_are_belong_to_us(self):
169170
self.set_text_content("h1", aybabtu)
170171
self.set_text_content('a[aria-label*="Try PlayF"]', ayb)
171172
self.set_text_content('a[aria-label*="Sign in to"]', abtu)
172-
self.set_text_content('span:contains("Chat with Sales")', aybabtu)
173173
self.highlight("h1", loops=6, scroll=False)
174174
self.highlight('a[aria-label*="Try PlayF"]', loops=4, scroll=False)
175-
self.highlight('a[aria-label*="Sign in to"]', loops=4, scroll=False)
176-
self.highlight("button#live-engage-btn", loops=6, scroll=False)
175+
self.highlight('a[aria-label*="Sign in to"]', loops=6, scroll=False)
177176

178177
self.open("https://www.snapchat.com/")
179178
self.set_text_content("h1", ayb)

help_docs/customizing_test_runs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ pytest my_first_test.py --settings-file=custom_settings.py
157157
--use-auto-ext # (Use Chrome's automation extension.)
158158
--remote-debug # (Enable Chrome's Remote Debugger on http://localhost:9222)
159159
--dashboard # (Enable the SeleniumBase Dashboard. Saved at: dashboard.html)
160+
--dash-title=STRING # (Set the title shown for the generated dashboard.)
160161
--swiftshader # (Use Chrome's "--use-gl=swiftshader" feature.)
161162
--incognito # (Enable Chrome's Incognito mode.)
162163
--guest # (Enable Chrome's Guest mode.)

mkdocs_build/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# mkdocs dependencies for generating the seleniumbase.io website
22
# Minimum Python version: 3.7
33

4-
regex>=2022.4.24
4+
regex>=2022.6.2
55
tqdm>=4.64.0
66
docutils==0.18.1
77
python-dateutil==2.8.2
@@ -25,7 +25,7 @@ lunr==0.6.2
2525
nltk==3.7
2626
watchdog==2.1.8
2727
mkdocs==1.3.0
28-
mkdocs-material==8.2.16
28+
mkdocs-material==8.3.0
2929
mkdocs-exclude-search==0.6.4
3030
mkdocs-simple-hooks==0.1.5
3131
mkdocs-material-extensions==1.0.3

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pdfminer.six==20220319;python_version>="3.7"
139139

140140
coverage==5.5;python_version<"3.6"
141141
coverage==6.2;python_version>="3.6" and python_version<"3.7"
142-
coverage==6.4;python_version>="3.7"
142+
coverage==6.4.1;python_version>="3.7"
143143
pytest-cov==2.12.1;python_version<"3.6"
144144
pytest-cov==3.0.0;python_version>="3.6"
145145
flake8==3.7.9;python_version<"3.5"

sbase/steps.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def assert_text(context, text):
8484

8585
@step("Assert exact text '{text}' in '{selector}'")
8686
@step('Assert exact text "{text}" in "{selector}"')
87+
@step("Assert exact text '{text}' in \"{selector}\"")
88+
@step('Assert exact text "{text}" in \'{selector}\'')
8789
def assert_exact_text(context, text, selector):
8890
sb = context.sb
8991
text = normalize_text(text)
@@ -220,28 +222,28 @@ def open_if_not_url(context, url):
220222

221223

222224
@step("Select if unselected '{selector}'")
223-
@step('Select if unselected "{selector}"')
225+
@step('Select if unselected "{selector}"')
224226
def select_if_unselected(context, selector):
225227
sb = context.sb
226228
sb.select_if_unselected(selector)
227229

228230

229231
@step("Unselect if selected '{selector}'")
230-
@step('Unselect if selected "{selector}"')
232+
@step('Unselect if selected "{selector}"')
231233
def unselect_if_selected(context, selector):
232234
sb = context.sb
233235
sb.unselect_if_selected(selector)
234236

235237

236238
@step("Check if unchecked '{selector}'")
237-
@step('Check if unchecked "{selector}"')
239+
@step('Check if unchecked "{selector}"')
238240
def check_if_unchecked(context, selector):
239241
sb = context.sb
240242
sb.check_if_unchecked(selector)
241243

242244

243245
@step("Uncheck if checked '{selector}'")
244-
@step('Uncheck if checked "{selector}"')
246+
@step('Uncheck if checked "{selector}"')
245247
def uncheck_if_checked(context, selector):
246248
sb = context.sb
247249
sb.uncheck_if_checked(selector)

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "3.2.6"
2+
__version__ = "3.2.7"

seleniumbase/behave/behave_helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ def generate_gherkin(srt_actions):
6464
)
6565
elif '"' not in action[1] and '"' in text:
6666
sb_actions.append(
67-
'Into "%s" type \'%s\')' % (action[1], text)
67+
'Into "%s" type \'%s\'' % (action[1], text)
6868
)
6969
elif '"' in action[1] and '"' not in text:
7070
sb_actions.append(
71-
'Into \'%s\' type "%s")' % (action[1], text)
71+
'Into \'%s\' type "%s"' % (action[1], text)
7272
)
7373
elif '"' in action[1] and '"' in text:
7474
sb_actions.append(
75-
"Into '%s' type '%s')" % (action[1], text)
75+
"Into '%s' type '%s'" % (action[1], text)
7676
)
7777
elif action[0] == "e_mfa":
7878
text = action[2].replace("\n", "\\n")
@@ -258,7 +258,7 @@ def generate_gherkin(srt_actions):
258258
sb_actions.append('%s "%s" to downloads' % (method, file_url))
259259
else:
260260
sb_actions.append(
261-
'%s "%s" to "%s")' % (method, file_url, dest)
261+
'%s "%s" to "%s"' % (method, file_url, dest)
262262
)
263263
elif action[0] == "as_at":
264264
if ('"' not in action[1][0]) and action[1][2]:

seleniumbase/behave/behave_sb.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
-D use-auto-ext (Use Chrome's automation extension.)
6969
-D remote-debug (Enable Chrome's Remote Debugger on http://localhost:9222)
7070
-D dashboard (Enable the SeleniumBase Dashboard. Saved at: dashboard.html)
71+
-D dash-title=STRING (Set the title shown for the generated dashboard.)
7172
-D swiftshader (Use Chrome's "--use-gl=swiftshader" feature.)
7273
-D incognito (Enable Chrome's Incognito mode.)
7374
-D guest (Enable Chrome's Guest mode.)
@@ -177,6 +178,7 @@ def get_configured_sb(context):
177178
sb.time_limit = None
178179
sb.demo_sleep = None
179180
sb.dashboard = False
181+
sb.dash_title = None
180182
sb._dash_initialized = False
181183
sb.message_duration = None
182184
sb.block_images = False
@@ -537,6 +539,10 @@ def get_configured_sb(context):
537539
if low_key == "dashboard":
538540
sb.dashboard = True
539541
continue
542+
# Handle: -D dash-title=TITLE / dash_title=TITLE
543+
if low_key in ["dash-title", "dash_title"]:
544+
sb.dash_title = userdata[key]
545+
continue
540546
# Handle: -D message-duration / message_duration
541547
if low_key in ["message-duration", "message_duration"]:
542548
message_duration = userdata[key]
@@ -689,9 +695,14 @@ def get_configured_sb(context):
689695
sb.protocol = "https"
690696

691697
# Set sb_config
698+
sb_config.browser = sb.browser
699+
sb_config.headless = sb.headless
700+
sb_config.headed = sb.headed
701+
sb_config.xvfb = sb.xvfb
692702
sb_config.save_screenshot = sb.save_screenshot_after_test
693703
sb_config.variables = sb.variables
694704
sb_config.dashboard = sb.dashboard
705+
sb_config.dash_title = sb.dash_title
695706
sb_config.pdb_option = sb.pdb_option
696707
sb_config.rec_behave = sb.rec_behave
697708
sb_config.record_sleep = sb.record_sleep
@@ -720,6 +731,9 @@ def get_configured_sb(context):
720731
sb_config._dash_final_summary = None # Dash status to add to html report
721732
sb_config._html_report_name = None # The name of the pytest html report
722733

734+
if sb_config.dash_title:
735+
constants.Dashboard.TITLE = sb_config.dash_title.replace("_", " ")
736+
723737
log_helper.log_folder_setup(sb.log_path, sb.archive_logs)
724738
download_helper.reset_downloads_folder()
725739
proxy_helper.remove_proxy_zip_if_present()
@@ -799,7 +813,11 @@ def dashboard_pre_processing():
799813
filename = None
800814
feature_name = None
801815
scenario_name = None
802-
for row in output.decode("utf-8").split("\n"):
816+
if is_windows:
817+
output = output.decode("latin1")
818+
else:
819+
output = output.decode("utf-8")
820+
for row in output.replace("\r", "").split("\n"):
803821
if row.startswith("Feature: "):
804822
filename_count += 1
805823
feature_count += 1

0 commit comments

Comments
 (0)