Skip to content

Commit 2e072c9

Browse files
committed
Fix Behave-BDD output on Windows
1 parent 4a17595 commit 2e072c9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13168,12 +13168,26 @@ def tearDown(self):
1316813168
else:
1316913169
# (Nosetests / Behave / Pure Python)
1317013170
if hasattr(self, "is_behave") and self.is_behave:
13171+
import colorama
13172+
1317113173
if sb_config.behave_scenario.status.name == "failed":
1317213174
has_exception = True
1317313175
sb_config._has_exception = True
13174-
print(" ❌ Scenario Failed! (Skipping remaining steps:)")
13176+
msg = " ❌ Scenario Failed! (Skipping remaining steps:)"
13177+
if is_windows:
13178+
c1 = colorama.Fore.RED + colorama.Back.LIGHTRED_EX
13179+
cr = colorama.Style.RESET_ALL
13180+
colorama.init(autoreset=True)
13181+
msg = msg.replace("❌", c1 + "><" + cr)
13182+
print(msg)
1317513183
else:
13176-
print(" ✅ Scenario Passed!")
13184+
msg = " ✅ Scenario Passed!"
13185+
if is_windows:
13186+
c2 = colorama.Fore.GREEN + colorama.Back.LIGHTGREEN_EX
13187+
cr = colorama.Style.RESET_ALL
13188+
colorama.init(autoreset=True)
13189+
msg = msg.replace("✅", c2 + "<>" + cr)
13190+
print(msg)
1317713191
if self.dashboard:
1317813192
self.__process_dashboard(has_exception)
1317913193
if self.headless or self.xvfb:

0 commit comments

Comments
 (0)