happo 6.3.6 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cancelJob-ROJDWYPD.js +10 -0
- package/dist/cli/{chunk-2F4ONKOX.js → chunk-F4CUEMIS.js} +3 -3
- package/dist/cli/{chunk-VOPCZYUD.js → chunk-FZHTC4L5.js} +2 -2
- package/dist/cli/{chunk-VOPCZYUD.js.map → chunk-FZHTC4L5.js.map} +1 -1
- package/dist/cli/{chunk-4FHG27V2.js → chunk-JAUTKTZY.js} +4 -4
- package/dist/cli/chunk-JAUTKTZY.js.map +7 -0
- package/dist/cli/{chunk-QIVIGY3K.js → chunk-JQ5JKJGY.js} +2 -2
- package/dist/cli/{chunk-GBORF5SP.js → chunk-NAK4M3PS.js} +2 -2
- package/dist/cli/{chunk-B4NWDBAN.js → chunk-XM2DXDSO.js} +2 -2
- package/dist/cli/chunk-XM2DXDSO.js.map +7 -0
- package/dist/cli/createAsyncComparison-37KSA6M4.js +10 -0
- package/dist/cli/{createAsyncReport-MZGC4WYR.js → createAsyncReport-XKNIFAJB.js} +4 -4
- package/dist/cli/{getFlakes-OZICV3BM.js → getFlakes-KRJUAUHV.js} +4 -4
- package/dist/cli/main.js +11 -11
- package/dist/cli/package-S5HBIHRL.js +7 -0
- package/dist/cli/{prepareSnapRequests-6BOXFGHI.js → prepareSnapRequests-EXILTRP4.js} +112 -70
- package/dist/cli/prepareSnapRequests-EXILTRP4.js.map +7 -0
- package/dist/cli/startJob-KT7MPC4H.js +10 -0
- package/dist/cli/{wrapper-UNP6YKH6.js → wrapper-KRUJ2F4T.js} +7 -7
- package/dist/config/RemoteBrowserTarget.d.ts +8 -2
- package/dist/config/RemoteBrowserTarget.d.ts.map +1 -1
- package/dist/config/index.d.ts +5 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js.map +2 -2
- package/dist/cypress/task.js +19 -10
- package/dist/cypress/task.js.map +2 -2
- package/dist/network/fetchWithRetry.d.ts +1 -1
- package/dist/network/fetchWithRetry.d.ts.map +1 -1
- package/dist/network/makeHappoAPIRequest.d.ts +1 -1
- package/dist/network/makeHappoAPIRequest.d.ts.map +1 -1
- package/dist/network/prepareSnapRequests.d.ts.map +1 -1
- package/dist/playwright/index.js +19 -10
- package/dist/playwright/index.js.map +2 -2
- package/dist/storybook/getStorybookStoryCount.d.ts +7 -0
- package/dist/storybook/getStorybookStoryCount.d.ts.map +1 -0
- package/dist/storybook/index.d.ts +5 -1
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/storybook/index.js +56 -35
- package/dist/storybook/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/cli/cancelJob-LQPQPD5I.js +0 -10
- package/dist/cli/chunk-4FHG27V2.js.map +0 -7
- package/dist/cli/chunk-B4NWDBAN.js.map +0 -7
- package/dist/cli/createAsyncComparison-5ZQY53AW.js +0 -10
- package/dist/cli/package-FRXI4E4G.js +0 -7
- package/dist/cli/prepareSnapRequests-6BOXFGHI.js.map +0 -7
- package/dist/cli/startJob-GASMCYIM.js +0 -10
- /package/dist/cli/{cancelJob-LQPQPD5I.js.map → cancelJob-ROJDWYPD.js.map} +0 -0
- /package/dist/cli/{chunk-2F4ONKOX.js.map → chunk-F4CUEMIS.js.map} +0 -0
- /package/dist/cli/{chunk-QIVIGY3K.js.map → chunk-JQ5JKJGY.js.map} +0 -0
- /package/dist/cli/{chunk-GBORF5SP.js.map → chunk-NAK4M3PS.js.map} +0 -0
- /package/dist/cli/{createAsyncComparison-5ZQY53AW.js.map → createAsyncComparison-37KSA6M4.js.map} +0 -0
- /package/dist/cli/{createAsyncReport-MZGC4WYR.js.map → createAsyncReport-XKNIFAJB.js.map} +0 -0
- /package/dist/cli/{getFlakes-OZICV3BM.js.map → getFlakes-KRJUAUHV.js.map} +0 -0
- /package/dist/cli/{package-FRXI4E4G.js.map → package-S5HBIHRL.js.map} +0 -0
- /package/dist/cli/{startJob-GASMCYIM.js.map → startJob-KT7MPC4H.js.map} +0 -0
- /package/dist/cli/{wrapper-UNP6YKH6.js.map → wrapper-KRUJ2F4T.js.map} +0 -0
package/dist/config/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/config/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { SkipItems } from '../storybook/isomorphic/types.ts';\n\nexport interface StorybookIntegration {\n type: 'storybook';\n\n /**\n * The directory containing the Storybook configuration\n */\n configDir?: string;\n\n /**\n * The directory containing the static files to serve\n */\n staticDir?: string;\n\n /**\n * The directory to output the static Storybook package to\n */\n outputDir?: string;\n\n /**\n * Whether to use a prebuilt Storybook package. If you use this option, make\n * sure that files are built to the outputDir.\n */\n usePrebuiltPackage?: boolean;\n\n /**\n * Items to skip when generating snapshots.\n *\n * Can be an async function that resolves to an array of `{component,\n * variant}`, or an array of `{component, variant}`.\n */\n skip?: SkipItems | (() => Promise<SkipItems>) | undefined;\n}\n\ninterface BaseE2EIntegration {\n /**\n * Whether to allow failures.\n */\n allowFailures?: boolean;\n\n /**\n * Whether to download and include all assets in the asset package. If false\n * (default), only local assets will be included. When true, even external\n * assets will be included.\n */\n downloadAllAssets?: boolean;\n}\n\ninterface CypressIntegration extends BaseE2EIntegration {\n type: 'cypress';\n}\n\ninterface PlaywrightIntegration extends BaseE2EIntegration {\n type: 'playwright';\n}\n\nexport type E2EIntegration = CypressIntegration | PlaywrightIntegration;\n\ninterface CustomIntegration {\n type: 'custom';\n\n /**\n * An async function that generates a custom package. Returns an object with\n * the path to the folder containing the custom files and the path to the\n * entry point file relative to the root directory.\n *\n * @example\n * { rootDir: 'dist/custom', entryPoint: 'index.js' }\n */\n build: () => Promise<{ rootDir: string; entryPoint: string }>;\n}\n\nexport interface Page {\n /**\n * URL of the page to screenshot\n *\n * Note: The URLs to the website need to be publicly available, otherwise\n * Happo workers won't be able to access the pages.\n */\n url: string;\n\n /**\n * Title of the page to screenshot\n *\n * This is used as the \"component\" identifier in Happo reports, so ensure\n * it is unique for each page.\n */\n title: string;\n\n /**\n * Wait for the content to appear on the page before taking the screenshot.\n */\n waitForContent?: string;\n\n /**\n * Wait for a condition to be true before taking the screenshot.\n */\n waitForSelector?: string;\n}\n\ninterface PagesIntegration {\n type: 'pages';\n\n /**\n * A list of pages to screenshot.\n */\n pages: Array<Page>;\n}\n\n/**\n * Settings for deep compare functionality\n */\nexport interface DeepCompareSettings {\n /**\n * Threshold for comparing images with the given diff algorithm (float between\n * 0 and 1). 1 means all differences are allowed. 0 means no differences are\n * allowed. A good starting value is 0.03 for color-delta and 0.01 for ssim.\n */\n compareThreshold: number;\n\n /**\n * Algorithm to use for diff comparison. Must be \"color-delta\" or \"ssim\".\n * Defaults to \"color-delta\" if not provided. Note that \"ssim\" is experimental\n * and may be removed in the future.\n */\n diffAlgorithm?: 'color-delta' | 'ssim';\n\n /**\n * Threshold for ignoring individual pixel differences, side-stepping the\n * compare threshold. Used relatively to the image size. E.g. a value of 0.01\n * means 1% of the pixels can be above the compare threshold. Use this option\n * if your screenshots contain images or graphics with sharp noise. It is not\n * recommended to use this option for other types of diffs. (float\n * between 0 and 1).\n */\n ignoreThreshold?: number;\n\n /**\n * Whether to ignore whitespace in the diff. If true, whitespace differences\n * will not be considered when comparing images. Whitespace is defined as a\n * vertical section in a screenshot containing a single solid color.\n */\n ignoreWhitespace?: boolean;\n\n /**\n * Whether to apply blur to the diff. This can be used to smooth out subtle\n * differences that would otherwise be above the compare threshold. This\n * should mainly be used when your screenshots have a high contrast and you\n * want to smooth out some of the sharpness that can otherwise cause flakiness.\n */\n applyBlur?: boolean;\n}\n\nexport interface Config {\n /**\n * Key used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiKey?: string;\n\n /**\n * Secret used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiSecret?: string;\n\n /**\n * The endpoint to use for the happo run. Defaults to `https://happo.io`\n */\n endpoint?: string;\n\n /**\n * The name of the project to associate the Happo run with. If not provided,\n * the default project will be used.\n */\n project?: string;\n\n /**\n * Use this to post Happo statuses as comments to your PR. This can be useful\n * if the Happo server doesn't have access to your GitHub repository.\n *\n * The default is `'https://api.github.com'`. If you are using GitHub\n * Enterprise, enter the URL to your local GitHub API here, such as\n * `'https://ghe.mycompany.zone/api/v3'` (the default for GHE installation is\n * for the API to be located at `/api/v3`).\n */\n githubApiUrl?: string;\n\n /**\n * Browsers to use when generating snapshots\n */\n targets: Record<string, Target>;\n\n /**\n * Type of integration to use\n *\n * - 'storybook': Use Storybook to generate snapshots\n * - 'e2e': Use Playwright or Cypress to generate snapshots\n * - 'custom': Use a custom JS bundle to generate snapshots\n *\n * - 'pages': Use a list of pages to generate snapshots\n */\n integration?:\n | StorybookIntegration\n | CypressIntegration\n | PlaywrightIntegration\n | CustomIntegration\n | PagesIntegration;\n\n /**\n * An object with settings for deep compare.\n */\n deepCompare?: DeepCompareSettings;\n}\n\ntype MobileSafariBrowserType = 'ios-safari' | 'ipad-safari';\ntype DesktopBrowserType = 'chrome' | 'firefox' | 'edge' | 'safari' | 'accessibility';\nexport type BrowserType = MobileSafariBrowserType | DesktopBrowserType;\n\ninterface BaseTarget {\n type: BrowserType;\n\n /**\n * Split the target into chunks to be run on multiple workers in parallel\n *\n * This adds some overhead, so if your test suite isn't large, using more than\n * one chunk might actually slow things down.\n */\n chunks?: number;\n\n /**\n * Override the default maximum height (5000px) used by Happo workers\n *\n * This is useful when taking screenshots of tall components or pages.\n *\n * Note: The maximum width defaults to the maximum height, so if you set\n * `maxHeight`, you may also want to set `maxWidth` at the same time.\n */\n maxHeight?: number;\n\n /**\n * Override the default maximum width used by Happo workers (defaults to\n * `maxHeight`, which defaults to 5000 pixels)\n *\n * This is useful when taking screenshots of wide components or pages.\n */\n maxWidth?: number;\n\n /**\n * Controls how Happo handles elements with the `data-happo-hide` attribute.\n * By default, elements with this attribute are made invisible. Use the value\n * `'ignore'` to make the content appear in screenshots but exclude it from\n * comparison.\n */\n hideBehavior?: 'ignore';\n\n /**\n * When set to `true`, this option allows you to add `data-happo-hover`,\n * `data-happo-focus`, and `data-happo-active` attributes to your DOM elements\n * and have Happo apply the corresponding `:hover`, `:focus`, or `:active`\n * styles.\n *\n * For example, if you have this markup:\n *\n * ```html\n * <button>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * To apply the hover style before taking the screenshot (making the button\n * blue), change the markup to:\n *\n * ```html\n * <button data-happo-hover>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * Similarly, you can add focus to elements using `data-happo-focus`:\n *\n * ```html\n * <input type=\"text\" data-happo-focus />\n * ```\n *\n * And add `data-happo-active` to elements to simulate the `:active` state:\n *\n * ```html\n * <button data-happo-active>Click me</button>\n * <style>\n * button:active {\n * background-color: red;\n * }\n * </style>\n * ```\n */\n applyPseudoClasses?: boolean;\n\n /**\n * Set `prefersColorScheme: 'dark'` or `prefersColorScheme: 'light'` to set\n * the color scheme preference in the browser.\n */\n prefersColorScheme?: 'light' | 'dark';\n\n /**\n * Set `allowPointerEvents: true` to allow pointer events in the browser\n *\n * By default Happo injects some CSS to prevent spurious hover effects caused\n * by the system mouse pointer. If you rely on mouse interaction in your tests\n * (e.g., when using Storybook interactive stories), you might see an error\n * like this in your logs:\n *\n * > Error: Unable to perform pointer interaction as the element has\n * > `pointer-events: none`\n *\n * In some cases, this error prevents the variant from being included in the\n * report.\n *\n * To resolve this, set `allowPointerEvents: true` to tell Happo to skip\n * injecting the CSS that disables pointer events.\n *\n * If you're interested in testing `:hover`, `:focus`, and `:active` states\n * with Happo, you may also want to use the `applyPseudoClasses` option.\n */\n allowPointerEvents?: boolean;\n\n /**\n * Set `freezeAnimations: 'last-frame'` to freeze the animations at the last\n * frame. This is the default behavior.\n *\n * Set `freezeAnimations: 'first-frame'` to freeze the animations at the first\n * frame.\n */\n freezeAnimations?: 'last-frame' | 'first-frame';\n}\n\ninterface MobileSafariTarget extends BaseTarget {\n type: MobileSafariBrowserType;\n}\n\ninterface DesktopTarget extends BaseTarget {\n type: DesktopBrowserType;\n\n /**\n * Set the viewport size for the browser\n */\n viewport: `${number}x${number}`;\n\n /**\n * By default, Happo makes the browser prefer reduced motion when rendering\n * the UI. Set `prefersReducedMotion: false` to disable this behavior.\n */\n prefersReducedMotion?: boolean;\n\n /**\n * Add additional headers to the outgoing requests from the browser. This is\n * useful if you for instance need to tell a CDN that the request originates\n * from a Happo run.\n */\n outgoingRequestHeaders?: Array<{ name: string; value: string }>;\n}\n\nexport type Target = MobileSafariTarget | DesktopTarget;\n\nexport interface TargetWithDefaults extends BaseTarget {\n viewport: `${number}x${number}`;\n __dynamic: boolean;\n prefersReducedMotion?: boolean;\n}\n\nexport interface ConfigWithDefaults extends Config {\n apiKey: NonNullable<Config['apiKey']>;\n apiSecret: NonNullable<Config['apiSecret']>;\n integration: NonNullable<Config['integration']>;\n endpoint: NonNullable<Config['endpoint']>;\n githubApiUrl: NonNullable<Config['githubApiUrl']>;\n targets: Record<string, TargetWithDefaults>;\n}\n\nexport function defineConfig(config: Config): Config {\n return config;\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import type { SkipItems } from '../storybook/isomorphic/types.ts';\n\nexport interface StorybookIntegration {\n type: 'storybook';\n\n /**\n * The directory containing the Storybook configuration\n */\n configDir?: string;\n\n /**\n * The directory containing the static files to serve\n */\n staticDir?: string;\n\n /**\n * The directory to output the static Storybook package to\n */\n outputDir?: string;\n\n /**\n * Whether to use a prebuilt Storybook package. If you use this option, make\n * sure that files are built to the outputDir.\n */\n usePrebuiltPackage?: boolean;\n\n /**\n * Items to skip when generating snapshots.\n *\n * Can be an async function that resolves to an array of `{component,\n * variant}`, or an array of `{component, variant}`.\n */\n skip?: SkipItems | (() => Promise<SkipItems>) | undefined;\n}\n\ninterface BaseE2EIntegration {\n /**\n * Whether to allow failures.\n */\n allowFailures?: boolean;\n\n /**\n * Whether to download and include all assets in the asset package. If false\n * (default), only local assets will be included. When true, even external\n * assets will be included.\n */\n downloadAllAssets?: boolean;\n}\n\ninterface CypressIntegration extends BaseE2EIntegration {\n type: 'cypress';\n}\n\ninterface PlaywrightIntegration extends BaseE2EIntegration {\n type: 'playwright';\n}\n\nexport type E2EIntegration = CypressIntegration | PlaywrightIntegration;\n\ninterface CustomIntegration {\n type: 'custom';\n\n /**\n * An async function that generates a custom package. Returns an object with\n * the path to the folder containing the custom files and the path to the\n * entry point file relative to the root directory.\n *\n * Optionally return `estimatedSnapsCount` to enable server-side auto-chunking,\n * which parallelizes rendering across multiple workers.\n *\n * @example\n * { rootDir: 'dist/custom', entryPoint: 'index.js', estimatedSnapsCount: 42 }\n */\n build: () => Promise<{\n rootDir: string;\n entryPoint: string;\n estimatedSnapsCount?: number;\n }>;\n}\n\nexport interface Page {\n /**\n * URL of the page to screenshot\n *\n * Note: The URLs to the website need to be publicly available, otherwise\n * Happo workers won't be able to access the pages.\n */\n url: string;\n\n /**\n * Title of the page to screenshot\n *\n * This is used as the \"component\" identifier in Happo reports, so ensure\n * it is unique for each page.\n */\n title: string;\n\n /**\n * Wait for the content to appear on the page before taking the screenshot.\n */\n waitForContent?: string;\n\n /**\n * Wait for a condition to be true before taking the screenshot.\n */\n waitForSelector?: string;\n}\n\ninterface PagesIntegration {\n type: 'pages';\n\n /**\n * A list of pages to screenshot.\n */\n pages: Array<Page>;\n}\n\n/**\n * Settings for deep compare functionality\n */\nexport interface DeepCompareSettings {\n /**\n * Threshold for comparing images with the given diff algorithm (float between\n * 0 and 1). 1 means all differences are allowed. 0 means no differences are\n * allowed. A good starting value is 0.03 for color-delta and 0.01 for ssim.\n */\n compareThreshold: number;\n\n /**\n * Algorithm to use for diff comparison. Must be \"color-delta\" or \"ssim\".\n * Defaults to \"color-delta\" if not provided. Note that \"ssim\" is experimental\n * and may be removed in the future.\n */\n diffAlgorithm?: 'color-delta' | 'ssim';\n\n /**\n * Threshold for ignoring individual pixel differences, side-stepping the\n * compare threshold. Used relatively to the image size. E.g. a value of 0.01\n * means 1% of the pixels can be above the compare threshold. Use this option\n * if your screenshots contain images or graphics with sharp noise. It is not\n * recommended to use this option for other types of diffs. (float\n * between 0 and 1).\n */\n ignoreThreshold?: number;\n\n /**\n * Whether to ignore whitespace in the diff. If true, whitespace differences\n * will not be considered when comparing images. Whitespace is defined as a\n * vertical section in a screenshot containing a single solid color.\n */\n ignoreWhitespace?: boolean;\n\n /**\n * Whether to apply blur to the diff. This can be used to smooth out subtle\n * differences that would otherwise be above the compare threshold. This\n * should mainly be used when your screenshots have a high contrast and you\n * want to smooth out some of the sharpness that can otherwise cause flakiness.\n */\n applyBlur?: boolean;\n}\n\nexport interface Config {\n /**\n * Key used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiKey?: string;\n\n /**\n * Secret used to authenticate with the Happo API. Never store this in plain\n * text.\n */\n apiSecret?: string;\n\n /**\n * The endpoint to use for the happo run. Defaults to `https://happo.io`\n */\n endpoint?: string;\n\n /**\n * The name of the project to associate the Happo run with. If not provided,\n * the default project will be used.\n */\n project?: string;\n\n /**\n * Use this to post Happo statuses as comments to your PR. This can be useful\n * if the Happo server doesn't have access to your GitHub repository.\n *\n * The default is `'https://api.github.com'`. If you are using GitHub\n * Enterprise, enter the URL to your local GitHub API here, such as\n * `'https://ghe.mycompany.zone/api/v3'` (the default for GHE installation is\n * for the API to be located at `/api/v3`).\n */\n githubApiUrl?: string;\n\n /**\n * Browsers to use when generating snapshots\n */\n targets: Record<string, Target>;\n\n /**\n * Type of integration to use\n *\n * - 'storybook': Use Storybook to generate snapshots\n * - 'e2e': Use Playwright or Cypress to generate snapshots\n * - 'custom': Use a custom JS bundle to generate snapshots\n *\n * - 'pages': Use a list of pages to generate snapshots\n */\n integration?:\n | StorybookIntegration\n | CypressIntegration\n | PlaywrightIntegration\n | CustomIntegration\n | PagesIntegration;\n\n /**\n * An object with settings for deep compare.\n */\n deepCompare?: DeepCompareSettings;\n}\n\ntype MobileSafariBrowserType = 'ios-safari' | 'ipad-safari';\ntype DesktopBrowserType = 'chrome' | 'firefox' | 'edge' | 'safari' | 'accessibility';\nexport type BrowserType = MobileSafariBrowserType | DesktopBrowserType;\n\ninterface BaseTarget {\n type: BrowserType;\n\n /**\n * Split the target into chunks to be run on multiple workers in parallel\n *\n * This adds some overhead, so if your test suite isn't large, using more than\n * one chunk might actually slow things down.\n */\n chunks?: number;\n\n /**\n * Override the default maximum height (5000px) used by Happo workers\n *\n * This is useful when taking screenshots of tall components or pages.\n *\n * Note: The maximum width defaults to the maximum height, so if you set\n * `maxHeight`, you may also want to set `maxWidth` at the same time.\n */\n maxHeight?: number;\n\n /**\n * Override the default maximum width used by Happo workers (defaults to\n * `maxHeight`, which defaults to 5000 pixels)\n *\n * This is useful when taking screenshots of wide components or pages.\n */\n maxWidth?: number;\n\n /**\n * Controls how Happo handles elements with the `data-happo-hide` attribute.\n * By default, elements with this attribute are made invisible. Use the value\n * `'ignore'` to make the content appear in screenshots but exclude it from\n * comparison.\n */\n hideBehavior?: 'ignore';\n\n /**\n * When set to `true`, this option allows you to add `data-happo-hover`,\n * `data-happo-focus`, and `data-happo-active` attributes to your DOM elements\n * and have Happo apply the corresponding `:hover`, `:focus`, or `:active`\n * styles.\n *\n * For example, if you have this markup:\n *\n * ```html\n * <button>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * To apply the hover style before taking the screenshot (making the button\n * blue), change the markup to:\n *\n * ```html\n * <button data-happo-hover>Hover me</button>\n * <style>\n * button:hover {\n * background-color: blue;\n * }\n * </style>\n * ```\n *\n * Similarly, you can add focus to elements using `data-happo-focus`:\n *\n * ```html\n * <input type=\"text\" data-happo-focus />\n * ```\n *\n * And add `data-happo-active` to elements to simulate the `:active` state:\n *\n * ```html\n * <button data-happo-active>Click me</button>\n * <style>\n * button:active {\n * background-color: red;\n * }\n * </style>\n * ```\n */\n applyPseudoClasses?: boolean;\n\n /**\n * Set `prefersColorScheme: 'dark'` or `prefersColorScheme: 'light'` to set\n * the color scheme preference in the browser.\n */\n prefersColorScheme?: 'light' | 'dark';\n\n /**\n * Set `allowPointerEvents: true` to allow pointer events in the browser\n *\n * By default Happo injects some CSS to prevent spurious hover effects caused\n * by the system mouse pointer. If you rely on mouse interaction in your tests\n * (e.g., when using Storybook interactive stories), you might see an error\n * like this in your logs:\n *\n * > Error: Unable to perform pointer interaction as the element has\n * > `pointer-events: none`\n *\n * In some cases, this error prevents the variant from being included in the\n * report.\n *\n * To resolve this, set `allowPointerEvents: true` to tell Happo to skip\n * injecting the CSS that disables pointer events.\n *\n * If you're interested in testing `:hover`, `:focus`, and `:active` states\n * with Happo, you may also want to use the `applyPseudoClasses` option.\n */\n allowPointerEvents?: boolean;\n\n /**\n * Set `freezeAnimations: 'last-frame'` to freeze the animations at the last\n * frame. This is the default behavior.\n *\n * Set `freezeAnimations: 'first-frame'` to freeze the animations at the first\n * frame.\n */\n freezeAnimations?: 'last-frame' | 'first-frame';\n}\n\ninterface MobileSafariTarget extends BaseTarget {\n type: MobileSafariBrowserType;\n}\n\ninterface DesktopTarget extends BaseTarget {\n type: DesktopBrowserType;\n\n /**\n * Set the viewport size for the browser\n */\n viewport: `${number}x${number}`;\n\n /**\n * By default, Happo makes the browser prefer reduced motion when rendering\n * the UI. Set `prefersReducedMotion: false` to disable this behavior.\n */\n prefersReducedMotion?: boolean;\n\n /**\n * Add additional headers to the outgoing requests from the browser. This is\n * useful if you for instance need to tell a CDN that the request originates\n * from a Happo run.\n */\n outgoingRequestHeaders?: Array<{ name: string; value: string }>;\n}\n\nexport type Target = MobileSafariTarget | DesktopTarget;\n\nexport interface TargetWithDefaults extends BaseTarget {\n viewport: `${number}x${number}`;\n __dynamic: boolean;\n prefersReducedMotion?: boolean;\n}\n\nexport interface ConfigWithDefaults extends Config {\n apiKey: NonNullable<Config['apiKey']>;\n apiSecret: NonNullable<Config['apiSecret']>;\n integration: NonNullable<Config['integration']>;\n endpoint: NonNullable<Config['endpoint']>;\n githubApiUrl: NonNullable<Config['githubApiUrl']>;\n targets: Record<string, TargetWithDefaults>;\n}\n\nexport function defineConfig(config: Config): Config {\n return config;\n}\n"],
|
|
5
|
+
"mappings": ";AAyYO,SAAS,aAAa,QAAwB;AACnD,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cypress/task.js
CHANGED
|
@@ -18,7 +18,7 @@ import asyncRetry from "async-retry";
|
|
|
18
18
|
// package.json
|
|
19
19
|
var package_default = {
|
|
20
20
|
name: "happo",
|
|
21
|
-
version: "6.
|
|
21
|
+
version: "6.4.1",
|
|
22
22
|
description: "Catch unexpected visual and accessibility changes and UI bugs",
|
|
23
23
|
license: "MIT",
|
|
24
24
|
repository: {
|
|
@@ -207,12 +207,12 @@ var ErrorWithStatusCode = class extends Error {
|
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
function prepareFormData(data) {
|
|
210
|
-
if (
|
|
210
|
+
if (data == null) {
|
|
211
211
|
return null;
|
|
212
212
|
}
|
|
213
213
|
const form = new FormData();
|
|
214
214
|
for (const [key, value] of Object.entries(data)) {
|
|
215
|
-
if (value) {
|
|
215
|
+
if (value != null) {
|
|
216
216
|
form.append(key, value);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -708,6 +708,12 @@ function createHash(data) {
|
|
|
708
708
|
|
|
709
709
|
// src/config/RemoteBrowserTarget.ts
|
|
710
710
|
var VIEWPORT_PATTERN = /^([0-9]+)x([0-9]+)$/;
|
|
711
|
+
function computeDefaultChunks(estimatedSnapCount) {
|
|
712
|
+
if (!Number.isFinite(estimatedSnapCount) || estimatedSnapCount <= 0) {
|
|
713
|
+
return 1;
|
|
714
|
+
}
|
|
715
|
+
return Math.min(20, Math.ceil(estimatedSnapCount / 100));
|
|
716
|
+
}
|
|
711
717
|
function getPageSlices(pages, chunks) {
|
|
712
718
|
const result = [];
|
|
713
719
|
const pagesPerChunk = Math.ceil(pages.length / chunks);
|
|
@@ -730,7 +736,7 @@ var RemoteBrowserTarget = class {
|
|
|
730
736
|
otherOptions;
|
|
731
737
|
constructor(browserName, {
|
|
732
738
|
viewport = "1024x768",
|
|
733
|
-
chunks
|
|
739
|
+
chunks,
|
|
734
740
|
maxHeight,
|
|
735
741
|
...otherOptions
|
|
736
742
|
}) {
|
|
@@ -757,7 +763,8 @@ var RemoteBrowserTarget = class {
|
|
|
757
763
|
staticPackage,
|
|
758
764
|
snapPayloads,
|
|
759
765
|
pages,
|
|
760
|
-
targetName
|
|
766
|
+
targetName,
|
|
767
|
+
estimatedSnapsCount
|
|
761
768
|
}, config) {
|
|
762
769
|
const boundMakeRequest = async ({
|
|
763
770
|
slice,
|
|
@@ -813,22 +820,24 @@ var RemoteBrowserTarget = class {
|
|
|
813
820
|
};
|
|
814
821
|
const requestIds = [];
|
|
815
822
|
if (staticPackage) {
|
|
816
|
-
|
|
823
|
+
const effectiveChunks = this.chunks ?? Math.max(1, computeDefaultChunks(estimatedSnapsCount ?? 0));
|
|
824
|
+
for (let i = 0; i < effectiveChunks; i += 1) {
|
|
817
825
|
const requestId = await boundMakeRequest({
|
|
818
|
-
chunk: { index: i, total:
|
|
826
|
+
chunk: effectiveChunks > 1 ? { index: i, total: effectiveChunks } : void 0
|
|
819
827
|
});
|
|
820
828
|
requestIds.push(requestId);
|
|
821
829
|
}
|
|
822
830
|
} else if (pages) {
|
|
823
|
-
for (const pageSlice of getPageSlices(pages, this.chunks)) {
|
|
831
|
+
for (const pageSlice of getPageSlices(pages, this.chunks ?? 1)) {
|
|
824
832
|
const requestId = await boundMakeRequest({
|
|
825
833
|
pageSlice
|
|
826
834
|
});
|
|
827
835
|
requestIds.push(requestId);
|
|
828
836
|
}
|
|
829
837
|
} else {
|
|
830
|
-
const
|
|
831
|
-
|
|
838
|
+
const effectiveChunks = this.chunks ?? 1;
|
|
839
|
+
const snapsPerChunk = Math.ceil((snapPayloads?.length ?? 0) / effectiveChunks);
|
|
840
|
+
for (let i = 0; i < effectiveChunks; i += 1) {
|
|
832
841
|
const slice = snapPayloads?.slice(
|
|
833
842
|
i * snapsPerChunk,
|
|
834
843
|
i * snapsPerChunk + snapsPerChunk
|