/// /// import Storage from '@google-cloud/storage'; export default class Screenshot { urlPath_: string; /** * @param {string} urlPath The URL path to test */ constructor(urlPath: string); /** * Captures a screenshot of the test URL and marks it as the new golden image */ capture(): void; /** * Diffs a screenshot of the test URL with the existing golden screenshot */ diff(): void; /** * Generates a unique hash from an image's contents * @param {!Buffer} imageBuffer The image buffer to hash * @return {string} * @private */ generateImageHash_(imageBuffer: Buffer): string; /** * Returns the golden hash * @return {string|undefined} * @private */ getGoldenHash_(): Promise; /** * Returns the correct image path * @param {string} imageHash The image hash * @param {string} imageType The image type * @return {string|undefined} * @private */ getImagePath_(imageHash: string, imageType: string): string | undefined; /** * Downloads an image from Google Cloud Storage * @param {string} gcsFilePath The file path on Google Cloud Storage * @return {Buffer} * @private */ readImage_(gcsFilePath: string): Promise; /** * Saves the golden hash * @param {string} goldenHash The hash of the golden image * @private */ saveGoldenHash_(goldenHash: string): Promise; /** * Saves the given image to Google Cloud Storage with optional metadata * @param {string} imagePath The path to the image * @param {!Buffer} imageBuffer The image buffer * @param {!Object=} customMetadata Optional custom metadata * @private */ saveImage_(imagePath: string, imageBuffer: Buffer, customMetadata?: Storage.CustomFileMetadata): Promise; /** * Takes a screenshot of the URL * @return {!Buffer} * @private */ takeScreenshot_(): Promise; }