无法将屏幕快照附加到摩卡诱惑者以进行量角器测试

问题描述 投票:0回答:1

我正在尝试将屏幕截图附加到魅力报告中。我没有收到任何错误,但报告未显示任何屏幕截图“ mocha-allure-reporter”:“ 1.4.0”,

这里是testbase.ts

import { login_Page } from '../pageObjects/LL1_loginPage'
import { browser } from 'protractor'
declare const allure: any;
before(function () {
  login_Page.login()
  browser.sleep(3000)
  login_Page.pageLoadConfirmation()
})
afterEach(function () {
  allure.createStep('initial', () => {
    browser.takeScreenshot().then(function (png) { allure.createAttachment('title', new Buffer(png, 'base64')); })
    console.log("successful")
  });
})

摩卡咖啡在配置文件中设置mochaOpts:{慢:90000,超时:180000,记者:“摩卡魅力报道”},

框架:'mocha',


typescript protractor mocha ui-automation allure
1个回答
0
投票

通过下面的代码获得

 afterEach(async function(){
    const png = await browser.takeScreenshot()
    allure.createAttachment('screenshot',new Buffer(png,'base64'),'image/png')
  })

0
投票

这将为您提供帮助。

afterEach(async function () { const png = await browser.takeScreenshot(); allure.createAttachment('Screenshot', new Buffer(png, 'base64'), 'image/png'); })

© www.soinside.com 2019 - 2024. All rights reserved.