@argos-ci/util
Version:
Set of utilities used across all Argos SDKs.
78 lines • 3.77 kB
text/typescript
//#region src/metadata.d.ts
type ScreenshotMetadata = {
/** @description The URL of the page that was screenshotted */url?: string | null; /** @description An URL to an accessible preview of the screenshot */
previewUrl?: string | null;
viewport?: {
/** @description The width of the viewport */width: number; /** @description The height of the viewport */
height: number;
} | null; /** @description The color scheme when the screenshot was taken */
colorScheme?: ("light" | "dark") | null; /** @description The media type when the screenshot was taken */
mediaType?: ("screen" | "print") | null; /** @description Tags associated with the screenshot */
tags?: string[];
test?: ({
/** @description The unique identifier of the test */id?: string | null; /** @description The title of the test */
title: string; /** @description The path of titles leading to the test */
titlePath: string[]; /** @description Tags associated with the test */
tags?: string[]; /** @description The number of retries for the test */
retries?: number | null; /** @description The current retry count */
retry?: number | null; /** @description The repeat count for the test */
repeat?: number | null; /** @description The location of the test in the source code */
location?: {
/** @description The located file */file: string; /** @description The line number in the file */
line: number; /** @description The column number in the file */
column: number;
}; /** @description Annotations associated to the test */
annotations?: {
/** @description The type of annotation */type: string; /** @description The description of the annotation */
description?: string; /** @description The location of the annotation in the source code */
location?: {
/** @description The located file */file: string; /** @description The line number in the file */
line: number; /** @description The column number in the file */
column: number;
};
}[];
} | null) | null;
story?: {
/** @description Unique ID of the story */id: string; /** @description Tags attached to the story */
tags: string[]; /** @description Story mode */
mode?: string; /** @description True if the story has a play function */
play?: boolean;
};
browser?: {
/** @description The name of the browser */name: string; /** @description The version of the browser */
version: string;
} | null; /** @description The automation library that generated the screenshot */
automationLibrary: {
/** @description The name of the automation library */name: string; /** @description The version of the automation library */
version: string;
}; /** @description The Argos SDK that generated the screenshot */
sdk: {
/** @description The name of the Argos SDK */name: string; /** @description The version of the Argos SDK */
version: string;
};
transient?: {
/** Threshold configured for this screenshot. */threshold?: number; /** Override the name to find the comparison baseline. */
baseName?: string; /** Name of the parent screenshot. */
parentName?: string;
};
};
/**
* Get metadata path from snapshot path.
*/
declare function getMetadataPath(snapshotPath: string): string;
//#endregion
//#region src/name.d.ts
/**
* Build a screenshot name from a test name and options.
*/
declare function getScreenshotName(name: string, options?: {
viewportWidth?: number;
}): string;
//#endregion
//#region src/threshold.d.ts
/**
* Validates the threshold value.
*/
declare function validateThreshold(threshold: number): void;
//#endregion
export { getMetadataPath as i, getScreenshotName as n, ScreenshotMetadata as r, validateThreshold as t };