Ejemplo n.º 1
0
def _capture_screenshot():
    '''
    截图保存为base64
    '''
    now_time = datetime_strftime("%Y%m%d%H%M%S")
    if not os.path.exists(SCREENSHOT_DIR):
        os.makedirs(SCREENSHOT_DIR)
    screen_path = os.path.join(SCREENSHOT_DIR, "{}.png".format(now_time))
    driver.save_screenshot(screen_path)
    allure.attach.file(screen_path, "测试失败截图...{}".format(now_time),
                       allure.attachment_type.PNG)
    with open(screen_path, 'rb') as f:
        imagebase64 = base64.b64encode(f.read())
    return imagebase64.decode()
Ejemplo n.º 2
0
 def log_path(self):
     if not os.path.exists(LOG_PATH):
         os.makedirs(LOG_PATH)
     return os.path.join(LOG_PATH, '{}.log'.format(datetime_strftime()))
Ejemplo n.º 3
0
 def log_path(self):
     return os.path.join(LOG_PATH, '{}.log'.format(datetime_strftime()))
Ejemplo n.º 4
0
def report_path():
    """报告文件"""
    if not os.path.exists(REPORT_PATH):
        os.makedirs(REPORT_PATH)
    return os.path.join(REPORT_PATH, '{}.html'.format(datetime_strftime("%Y%m%d_%H%M%S")))