import { AllureRuntime } from "./AllureRuntime" ; import { testResult } from "./constructors" ; import { ExecutableItemWrapper } from "./ExecutableItemWrapper" ; import { LinkType , TestResult } from "./model" ; export class AllureTest extends ExecutableItemWrapper { private readonly testResult : TestResult ; constructor ( private readonly runtime , start = Date . now ( ) ) { super ( testResult ( ) ) ; this . testResult = this . wrappedItem as TestResult ; this . testResult . start = start ; } endTest ( stop = Date . now ( ) ) { this . testResult . stop = stop ; this . runtime . writeResult ( this . testResult ) ; } get uuid ( ) : string { return this . testResult . uuid ; } set historyId ( id ) { this . testResult . historyId = id ; } set fullName ( fullName ) { this . testResult . fullName = fullName ; } addLabel ( name , value ) { this . testResult . labels . push ( { name , value } ) ; } addLink ( url , name ? , type ? ) { this . testResult . links . push ( { name , url , type } ) ; } addIssueLink ( url , name ) { this . addLink ( url , name , LinkType . ISSUE ) ; } addTmsLink ( url , name ) { this . addLink ( url , name , LinkType . TMS ) ; } }