def capture_screenshot_for_step(step, when): """ Useful method for debugging acceptance tests that are run in Vagrant. This method runs automatically before and after each step of an acceptance test scenario. The variable: world.auto_capture_screenshots either enables or disabled the taking of screenshots. To change the variable there is a convenient step defined: I (enable|disable) auto screenshots If you just want to capture a single screenshot at a desired point in code, you should use the method: world.capture_screenshot("image_name") """ if world.auto_capture_screenshots: scenario_num = step.scenario.feature.scenarios.index(step.scenario) + 1 step_num = step.scenario.steps.index(step) + 1 step_func_name = step.defined_at.function.func_name image_name = "{prefix:03d}__{num:03d}__{name}__{postfix}".format( prefix=scenario_num, num=step_num, name=step_func_name, postfix=when ) world.capture_screenshot(image_name)
def capture_screenshot_for_step(step, when): """ Useful method for debugging acceptance tests that are run in Vagrant. This method runs automatically before and after each step of an acceptance test scenario. The variable: world.auto_capture_screenshots either enables or disabled the taking of screenshots. To change the variable there is a convenient step defined: I (enable|disable) auto screenshots If you just want to capture a single screenshot at a desired point in code, you should use the method: world.capture_screenshot("image_name") """ if world.auto_capture_screenshots: scenario_num = step.scenario.feature.scenarios.index(step.scenario) + 1 step_num = step.scenario.steps.index(step) + 1 step_func_name = step.defined_at.function.func_name image_name = "{prefix:03d}__{num:03d}__{name}__{postfix}".format( prefix=scenario_num, num=step_num, name=step_func_name, postfix=when) world.capture_screenshot(image_name)
def inner(*args, **kwargs): prefix = round(time.time() * 1000) world.capture_screenshot("{}_{}_{}".format(prefix, func.func_name, "before")) ret_val = func(*args, **kwargs) world.capture_screenshot("{}_{}_{}".format(prefix, func.func_name, "after")) return ret_val
def inner(*args, **kwargs): prefix = round(time.time() * 1000) world.capture_screenshot("{}_{}_{}".format(prefix, func.func_name, 'before')) ret_val = func(*args, **kwargs) world.capture_screenshot("{}_{}_{}".format(prefix, func.func_name, 'after')) return ret_val