@applitools/eyes-playwright
Version:
Applitools Eyes SDK for Playwright
50 lines (43 loc) • 1.59 kB
TypeScript
import type {
ConfigurationPlain,
RunnerOptionsPlain,
TestResultContainer,
LogHandlerPlain,
Eyes as BaseEyes,
CheckSettingsAutomationPlain,
MatchResult,
} from "./index"
import {test as base, type TestInfo} from '@playwright/test'
export type EyesFixture = {
eyesConfig: EyesConfig
}
export type EyesConfig = Omit<
ConfigurationPlain,
'concurrentSessions' | 'dontCloseBatches' | 'displayName' | 'testName'
> & {
displayName?: string | ((testInfo: TestInfo) => string)
testName?: string | ((testInfo: TestInfo) => string)
logConfig?:
| LogHandlerPlain
| ((testInfo: TestInfo) => LogHandlerPlain)
| LogHandlerPlain[]
| ((testInfo: TestInfo) => LogHandlerPlain[])
} & RunnerOptionsPlain & {
type?: 'ufg' | 'classic'
/**
* * If set to "afterEach", visual differences will be thrown after each test.
* * If set to "afterAll", visual differences will be thrown after all tests (more performant, but less granular).
* * If set to false, visual differences will not be thrown - best used with Eyes' CSM integration.
*/
failTestsOnDiff?: 'afterEach' | 'afterAll' | false
afterAll?: (results: Array<TestResultContainer>) => Promise<void>
}
export type Eyes = Pick<BaseEyes, 'locate' | 'extractText' | 'extractTextRegions'> & {
check(name?: string, checkSettings?: CheckSettingsAutomationPlain): Promise<MatchResult>
}
type EyesTestFixture = EyesFixture & {
eyes: Eyes
}
type EyesWorkerFixture = EyesFixture
export const test: ReturnType<typeof base.extend<EyesTestFixture, EyesWorkerFixture>>
export {expect} from '@playwright/test'