@@ -0,0 +1,1050 @@
+%22%22%22Steps and utility functions for taking screenshots.%22%22%22%0A%0Afrom lettuce import (%0A    step,%0A    world,%0A)%0Aimport os.path%0A%0Adef set_save_directory(root):%0A    %22%22%22Sets the root save directory for saving screenshots.%0A    %0A    Screenshots will be saved in subdirectories under this directory by%0A    browser window size. %22%22%22%0A    if not os.path.isdir(root):%0A        os.makedirs(root)%0A%0A    world.screenshot_root = root%0A%0A%0A@step(r'I capture a screenshot named %22(.*?)%22$')%0Adef capture_screenshot(step, name):%0A    window_size = world.browser.get_window_size()%0A    dir_path = os.path.join(%0A        world.screenshot_root,%0A        '%7B%7Dx%7B%7D'.format(window_size%5B'width'%5D, window_size%5B'height'%5D),%0A    )%0A    if not os.path.isdir(dir_path):%0A        os.makedirs(dir_path)%0A    filename = os.path.join(%0A        dir_path,%0A        '%7B%7D.png'.format(name)%0A    )%0A    world.browser.get_screenshot_as_file(filename)%0A%0A%0A@step(r'I capture a screenshot named %22(.*?)%22 after (%5Cd+) seconds?$')%0Adef capture_screenshot_delay(step, name, delay):%0A    time.sleep(delay)%0A    capture_screenshot(name)%0A

Add utility method & steps for capturing screenshots