def after_scenario(context, scenario): if getattr(context, "browser", None): has_warnings = False for entry in context.browser.driver.get_log('browser'): if entry["level"] not in ["WARNING", "ERROR"]: continue try: msg = json.loads(entry["message"])["message"] except (ValueError, KeyError): pass else: # in chrome we can extract much more info! if msg["level"] in ["warn", "error"] and \ msg.get("source") == "console-api": entry = dict(level=msg["level"], timestamp=entry["timestamp"], message=msg["text"]) else: continue has_warnings = True log.warning( "Browser {level}: {timestamp}: {message}".format(**entry)) if BEHAVE_ERROR_ON_BROWSER_WARNINGS and has_warnings: print("Exciting – Browser Warnings/Errors!") exit(1) benv.after_scenario(context, scenario)
def after_scenario(context, scenario): if scenario.status == 'failed': print('Scenario %s Failed. Put a breakpoint here to inspect stuff' % scenario.name) if context.screenshots_dir and hasattr(context, 'browser'): create_scenario_screenshot(context, scenario) if 'persist_browser' not in scenario.tags: benv.after_scenario(context, scenario)
def after_scenario(context, scenario): if getattr(context, "browser", None): has_warnings = False for entry in context.browser.driver.get_log('browser'): if entry["level"] not in ["WARNING", "ERROR"]: continue try: msg = json.loads(entry["message"])["message"] except (ValueError, KeyError): pass else: # in chrome we can extract much more info! if msg["level"] in ["warn", "error"] and \ msg.get("source") == "console-api": entry = dict(level=msg["level"], timestamp=entry["timestamp"], message=msg["text"]) else: continue has_warnings = True log.warning("Browser {level}: {timestamp}: {message}".format( **entry)) if BEHAVE_ERROR_ON_BROWSER_WARNINGS and has_warnings: print("Exciting – Browser Warnings/Errors!") exit(1) benv.after_scenario(context, scenario)
def after_scenario(context, scenario): if scenario.status == 'failed': print (""" Failed. Place a breakpoint within `after_scenario`, environment.py to inspect the context and scenario. """) if 'persist_browser' not in scenario.tags: benv.after_scenario(context, scenario)
def after_scenario(context, scenario): benv.after_scenario(context, scenario)
def after_scenario(context, scenario): behaving_env.after_scenario(context, scenario) for task in context.cleanup_tasks: task()
def after_scenario(context, scenario): behaving_env.after_scenario(context, scenario)
def after_scenario(context, scenario): if context.failed: fullpath = os.path.join(context.screenshot_dir, "failed_" + scenario.name + ".png") context.browser.driver.get_screenshot_as_file(fullpath) benv.after_scenario(context, scenario)
def after_scenario(context, scenario): call_trello_api("DELETE", f"/boards/{board_id}") benv.after_scenario(context, scenario)