silverwolf-x's picture
download
raw
821 Bytes
import type { TestInfo } from '@playwright/test'
import { test } from '@playwright/test'
export interface StepProps {
category: string
title: string
apiName?: string
params?: Record<string, string | number | boolean | null | undefined>
}
type Complete = (result: { error?: any }) => void
export async function step<T>(
_testInfo: TestInfo,
props: StepProps,
handler: (complete: Complete) => Promise<Awaited<T>>
): Promise<Awaited<T>> {
let result: Awaited<T>
let reportedError: any
try {
await test.step(props.title, async () => {
result = await handler(({ error }) => {
reportedError = error
if (reportedError) {
throw reportedError
}
})
})
} catch (error) {
if (error !== reportedError) {
throw error
}
}
return result!
}

Xet Storage Details

Size:
821 Bytes
·
Xet hash:
45112d91b0f5d34d6c304c8a88ddb2c82874691509595b7bcd7960448032ff26

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.