UNPKG

systelab-components-wdio-test

Version:
38 lines (37 loc) 1.26 kB
import allureReporter from '@wdio/allure-reporter'; import { Status } from "allure-js-commons"; export class ReportUtility { static setDescription(description) { allureReporter.addDescription(description, "text"); } static setFeature(feature) { allureReporter.addFeature(feature); } static addLabel(label, value) { allureReporter.addLabel(label, value); } static addLink(url, name, type) { allureReporter.addLink(url, name, type); } static async addExpectedResult(description, expectationFunction) { const testCaseReporter = (jasmine.getEnv().testCaseReporter); try { if (testCaseReporter) { testCaseReporter.onAssertStart(description); } allureReporter.startStep(description); await expectationFunction(); allureReporter.endStep(Status.PASSED); if (testCaseReporter) { testCaseReporter.onAssertEnd(description); } } catch (error) { allureReporter.endStep(Status.FAILED); if (testCaseReporter) { testCaseReporter.onAssertEnd(description, true); } throw (error); } } }