def test_can_make_screenshot_with_custom_name(): open_url(start_page) actual = take_screenshot(filename="custom") expected = os.path.join(get_default_screenshot_folder(), 'custom.png') assert expected == actual assert os.path.exists(actual)
def test_can_make_screenshot_with_default_name(): open_url(start_page) actual = take_screenshot() expected = os.path.join(get_default_screenshot_folder(), 'screen_{id}.png'.format(id=get_screen_id())) assert expected == actual assert os.path.exists(actual)
def test_can_save_screenshot_to_custom_folder_specified_as_parameter(): screenshot_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) actual = take_screenshot(path=screenshot_folder) expected = os.path.join(screenshot_folder, 'screen_{id}.png'.format(id=get_screen_id())) assert expected == actual assert os.path.isfile(actual) assert os.path.exists(actual)
def test_can_save_screenshot_to_custom_folder_specified_through_config(): config.reports_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) actual = take_screenshot() expected = os.path.join(get_default_screenshot_folder(), 'screen_{id}.png'.format(id=get_screen_id())) assert expected == actual assert os.path.isfile(actual) assert os.path.exists(actual)
def test_can_save_screenshot_to_custom_folder_with_custom_name(): screenshot_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) actual = take_screenshot(path=screenshot_folder, filename="custom_file_in_custom_folder") expected = os.path.join(screenshot_folder, 'custom_file_in_custom_folder.png') assert expected == actual assert os.path.isfile(actual) assert os.path.exists(actual)