UNPKG

@wdio/visual-service

Version:

Image comparison / visual regression testing for WebdriverIO

82 lines 4.31 kB
import type { Options } from '@wdio/types'; import type { ClassOptions } from '@wdio/image-comparison-core'; import type { CategoryComponent, CreateItContent, CreateTestContent, CreateTestFileOptions, ScanStorybookReturnData, Stories, EmulatedDeviceType, CapabilityMap, WaitForStorybookComponentToBeLoaded } from './Types.js'; /** * Check if we run for Storybook */ export declare function isStorybookMode(): boolean; /** * Check if the framework is cucumber */ export declare function isCucumberFramework(framework: Required<Options.Testrunner>['framework']): boolean; /** * Check if the framework is Jasmine */ export declare function isJasmineFramework(framework: Required<Options.Testrunner>['framework']): boolean; /** * Check if the framework is Mocha */ export declare function isMochaFramework(framework: Required<Options.Testrunner>['framework']): boolean; /** * Check if there is an instance of Storybook running */ export declare function checkStorybookIsRunning(url: string): Promise<void>; /** * Sanitize the URL to ensure it's in a proper format */ export declare function sanitizeURL(url: string): string; /** * Extract the category and component from the story ID */ export declare function extractCategoryAndComponent(id: string): CategoryComponent; /** * Get the stories JSON from the Storybook instance */ export declare function getStoriesJson(url: string): Promise<Stories>; /** * Get arg value from the process.argv */ export declare function getArgvValue<ParseFuncReturnType>(argName: string, parseFunc: (value: string) => ParseFuncReturnType): ParseFuncReturnType | undefined; /** * Creates a it function for the test file * @TODO: improve this */ export declare function itFunction({ additionalSearchParams, clip, clipSelector, compareOptions, folders, framework, skipStories, storyData, storybookUrl, getStoriesBaselinePath }: CreateItContent): string; /** * Write the test file */ export declare function writeTestFile(directoryPath: string, fileID: string, testContent: string): void; /** * Create the test content */ export declare function createTestContent({ additionalSearchParams, clip, clipSelector, compareOptions, folders, framework, getStoriesBaselinePath, skipStories, stories, storybookUrl }: CreateTestContent, itFunc?: typeof itFunction): string; /** * The custom command */ export declare function waitForStorybookComponentToBeLoaded(options: WaitForStorybookComponentToBeLoaded, isStorybookModeFunc?: typeof isStorybookMode): Promise<void>; /** * Create the file data */ export declare function createFileData(describeTitle: string, testContent: string): string; /** * Create the test files */ export declare function createTestFiles({ additionalSearchParams, clip, clipSelector, compareOptions, directoryPath, folders, framework, getStoriesBaselinePath, numShards, skipStories, storiesJson, storybookUrl }: CreateTestFileOptions, createTestCont?: typeof createTestContent, createFileD?: typeof createFileData, writeTestF?: typeof writeTestFile): void; export declare function createChromeCapabilityWithEmulation({ screen: { width, height, dpr }, name, userAgent }: EmulatedDeviceType, isHeadless: boolean): WebdriverIO.Capabilities; /** * Throw an error message if the capabilities are not set up correctly */ export declare function capabilitiesErrorMessage(browsers: string[], capabilityMap: CapabilityMap, devices: string[], deviceDescriptors: EmulatedDeviceType[], isMobileEmulation: boolean): void; /** * Create the storybook capabilities based on the specified browsers */ export declare function createStorybookCapabilities(capabilities: WebdriverIO.Capabilities[], createChromeCapabilityWithEmulationFunc?: typeof createChromeCapabilityWithEmulation, capabilitiesErrorMessageFunc?: typeof capabilitiesErrorMessage): void; /** * Scan the storybook instance */ export declare function scanStorybook(config: WebdriverIO.Config, options: ClassOptions, getArgvVal?: typeof getArgvValue, checkStorybookIsRun?: typeof checkStorybookIsRunning, sanitizeURLFunc?: typeof sanitizeURL, getStoriesJsonFunc?: typeof getStoriesJson): Promise<ScanStorybookReturnData>; /** * Parse the stories to skip */ export declare function parseSkipStories(skipStories: string | string[]): RegExp | string[]; //# sourceMappingURL=utils.d.ts.map