/*
* The types here are compiled via `tspc` and `api-extractor`, and are used to describe the inputs to
* Eyes-Cypress custom commands. The reason they are not written in the `index.d.ts` file next to the
* `declare global { namespace Cypress {...}}` statement is that `api-extractor` has a limitation (at
* the time of writing this) that drops the `declare global` statement. So it's important to not pass
* `index.d.ts` through `api-extractor`,but keep the types in this file go through it, to produce the
* correct types for the SDK just like all other conventional SDK's.
**/
///
import type * as api from '@applitools/eyes'
import type * as core from '@applitools/core'
import {
type EyesSelector,
type TestResultsStatus,
type DeviceName,
type ScreenOrientationPlain,
type AccessibilityRegionTypePlain,
} from '@applitools/eyes'
export type MaybeArray = T | T[]
export type {EyesSelector, TestResultsStatus, DeviceName, ScreenOrientationPlain}
export type LegacyRegion = {left: number; top: number; width: number; height: number}
export type Selector = {selector: string; type?: 'css' | 'xpath'; nodeType?: 'element' | 'shadow-root'} | string
export type Element = HTMLElement | JQuery
export type ElementWithOptions = {element: Element; regionId?: string; padding?: any}
export type SelectorWithOptions = {region: Selector; regionId?: string; padding?: number | LegacyRegion}
type SpecType = core.SpecType
type CodedRegion = NonNullable
export type AccessibilityValidation = NonNullable['accessibilitySettings']
export type FloatingRegion = MaybeArray<
(ElementWithOptions | SelectorWithOptions | Selector | LegacyRegion) & {
maxUpOffset?: number
maxDownOffset?: number
maxLeftOffset?: number
maxRightOffset?: number
}
>
export type accessibilityRegion = MaybeArray<
| ((ElementWithOptions | Selector | LegacyRegion) & {
accessibilityType?: AccessibilityRegionTypePlain
})
| {
region: {selector: Selector; accessibilityType: AccessibilityRegionTypePlain}
regionId?: string
padding?: number | LegacyRegion
}
>
export type CypressCheckSettings = api.CheckSettingsAutomationPlain & {
tag?: string
target?: 'window' | 'region'
selector?: Selector
element?: Element
region?: LegacyRegion
ignore?: MaybeArray
layout?: MaybeArray
content?: MaybeArray
strict?: MaybeArray
floating?: FloatingRegion
accessibility?: accessibilityRegion
scriptHooks?: CypressCheckSettings['hooks']
browser?: MaybeArray<
| NonNullable[number]
| {deviceName: DeviceName; screenOrientation?: ScreenOrientationPlain; name?: string}
>
}
export type CypressEyesConfig = api.ConfigurationPlain & {
browser?: MaybeArray<
| NonNullable[number]
| {deviceName: DeviceName; screenOrientation?: ScreenOrientationPlain; name?: string}
>
batchId?: NonNullable['id']
batchName?: NonNullable['name']
batchSequence?: NonNullable['sequenceName']
notifyOnCompletion?: NonNullable['notifyOnCompletion']
batchSequenceName?: NonNullable['sequenceName']
envName?: CypressEyesConfig['environmentName']
scriptHooks?: {
beforeCaptureScreenshot: string
}
removeDuplicateTests?: boolean
}
export type appliConfFile = CypressEyesConfig & {
failCypressAfterAllSpecs?: boolean
tapDirPath?: string
tapFileName?: string
showLogs?: boolean
shouldDoPostSpecTasks?: boolean
isComponentTest?: boolean
saveNewTests?: boolean
}
export type CypressTestResultsSummary = api.TestResultsSummary
export type CypressTestResults = api.TestResults[]
export {type EyesPluginConfig} from './plugin'
import plugin from './plugin'
export default plugin