happo 5.0.0 โ 6.0.0-beta.0
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/README.md +147 -0
- package/dist/browser/applyConstructedStylesPatch.d.ts +14 -0
- package/dist/browser/applyConstructedStylesPatch.d.ts.map +1 -0
- package/dist/browser/assertElement.d.ts +6 -0
- package/dist/browser/assertElement.d.ts.map +1 -0
- package/dist/browser/main.d.ts +5 -0
- package/dist/browser/main.d.ts.map +1 -0
- package/dist/browser/main.js +1007 -0
- package/dist/browser/main.js.map +7 -0
- package/dist/browser/md5.d.ts +71 -0
- package/dist/browser/md5.d.ts.map +1 -0
- package/dist/browser/takeDOMSnapshot.d.ts +5 -0
- package/dist/browser/takeDOMSnapshot.d.ts.map +1 -0
- package/dist/cli/cancelJob-XYGTO4AF.js +27 -0
- package/dist/cli/cancelJob-XYGTO4AF.js.map +7 -0
- package/dist/cli/chunk-GG2PHBJN.js +103 -0
- package/dist/cli/chunk-GG2PHBJN.js.map +7 -0
- package/dist/cli/chunk-M7AOGYNY.js +173 -0
- package/dist/cli/chunk-M7AOGYNY.js.map +7 -0
- package/dist/cli/chunk-XKV5E7US.js +142 -0
- package/dist/cli/chunk-XKV5E7US.js.map +7 -0
- package/dist/cli/createAsyncComparison-VAWSU2DZ.js +54 -0
- package/dist/cli/createAsyncComparison-VAWSU2DZ.js.map +7 -0
- package/dist/cli/createAsyncReport-SKIUD5UR.js +40 -0
- package/dist/cli/createAsyncReport-SKIUD5UR.js.map +7 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +608 -0
- package/dist/cli/index.js.map +7 -0
- package/dist/cli/package-IN6SNH5I.js +7 -0
- package/dist/cli/package-IN6SNH5I.js.map +7 -0
- package/dist/cli/prepareSnapRequests-YU4KMB2F.js +669 -0
- package/dist/cli/prepareSnapRequests-YU4KMB2F.js.map +7 -0
- package/dist/cli/startJob-5GOJ4LZE.js +39 -0
- package/dist/cli/startJob-5GOJ4LZE.js.map +7 -0
- package/dist/cli/wrapper-DS2ZGTQ7.js +423 -0
- package/dist/cli/wrapper-DS2ZGTQ7.js.map +7 -0
- package/dist/config/RemoteBrowserTarget.d.ts +31 -0
- package/dist/config/RemoteBrowserTarget.d.ts.map +1 -0
- package/dist/config/index.d.ts +259 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +7 -0
- package/dist/config/loadConfig.d.ts +4 -0
- package/dist/config/loadConfig.d.ts.map +1 -0
- package/dist/cypress/chunk-RKK2MPML.js +20 -0
- package/dist/cypress/chunk-RKK2MPML.js.map +7 -0
- package/dist/cypress/chunked.d.ts +2 -0
- package/dist/cypress/chunked.d.ts.map +1 -0
- package/dist/cypress/index.d.ts +33 -0
- package/dist/cypress/index.d.ts.map +1 -0
- package/dist/cypress/index.js +1001 -0
- package/dist/cypress/index.js.map +7 -0
- package/dist/cypress/task.d.ts +17 -0
- package/dist/cypress/task.d.ts.map +1 -0
- package/dist/cypress/task.js +1943 -0
- package/dist/cypress/task.js.map +7 -0
- package/dist/e2e/controller.d.ts +86 -0
- package/dist/e2e/controller.d.ts.map +1 -0
- package/dist/e2e/convertBase64FileToReal.d.ts +2 -0
- package/dist/e2e/convertBase64FileToReal.d.ts.map +1 -0
- package/dist/e2e/createAssetPackage.d.ts +10 -0
- package/dist/e2e/createAssetPackage.d.ts.map +1 -0
- package/dist/e2e/makeAbsolute.d.ts +2 -0
- package/dist/e2e/makeAbsolute.d.ts.map +1 -0
- package/dist/e2e/makeExternalUrlsAbsolute.d.ts +2 -0
- package/dist/e2e/makeExternalUrlsAbsolute.d.ts.map +1 -0
- package/dist/e2e/wrapper.d.ts +23 -0
- package/dist/e2e/wrapper.d.ts.map +1 -0
- package/dist/environment/index.d.ts +13 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/isomorphic/findCSSAssetUrls.d.ts +5 -0
- package/dist/isomorphic/findCSSAssetUrls.d.ts.map +1 -0
- package/dist/isomorphic/types.d.ts +59 -0
- package/dist/isomorphic/types.d.ts.map +1 -0
- package/dist/network/cancelJob.d.ts +12 -0
- package/dist/network/cancelJob.d.ts.map +1 -0
- package/dist/network/createAsyncComparison.d.ts +16 -0
- package/dist/network/createAsyncComparison.d.ts.map +1 -0
- package/dist/network/createAsyncReport.d.ts +10 -0
- package/dist/network/createAsyncReport.d.ts.map +1 -0
- package/dist/network/fetchWithRetry.d.ts +35 -0
- package/dist/network/fetchWithRetry.d.ts.map +1 -0
- package/dist/network/makeHappoAPIRequest.d.ts +48 -0
- package/dist/network/makeHappoAPIRequest.d.ts.map +1 -0
- package/dist/network/postGitHubComment.d.ts +11 -0
- package/dist/network/postGitHubComment.d.ts.map +1 -0
- package/dist/network/prepareSnapRequests.d.ts +3 -0
- package/dist/network/prepareSnapRequests.d.ts.map +1 -0
- package/dist/network/startJob.d.ts +15 -0
- package/dist/network/startJob.d.ts.map +1 -0
- package/dist/network/startServer.d.ts +7 -0
- package/dist/network/startServer.d.ts.map +1 -0
- package/dist/network/uploadAssets.d.ts +12 -0
- package/dist/network/uploadAssets.d.ts.map +1 -0
- package/dist/playwright/index.d.ts +17 -0
- package/dist/playwright/index.d.ts.map +1 -0
- package/dist/playwright/index.js +1954 -0
- package/dist/playwright/index.js.map +7 -0
- package/dist/static/__happo__/index.d.ts +2 -0
- package/dist/static/__happo__/index.d.ts.map +1 -0
- package/dist/static/index.d.ts +14 -0
- package/dist/static/index.d.ts.map +1 -0
- package/dist/static/index.js +81 -0
- package/dist/static/index.js.map +7 -0
- package/dist/storybook/browser/addon.d.ts +2 -0
- package/dist/storybook/browser/addon.d.ts.map +1 -0
- package/dist/storybook/browser/addon.js +95 -0
- package/dist/storybook/browser/addon.js.map +7 -0
- package/dist/storybook/browser/chunk-NTB4BWOG.js +7 -0
- package/dist/storybook/browser/chunk-NTB4BWOG.js.map +7 -0
- package/dist/storybook/browser/constants.d.ts +2 -0
- package/dist/storybook/browser/constants.d.ts.map +1 -0
- package/dist/storybook/browser/decorator.d.ts +4 -0
- package/dist/storybook/browser/decorator.d.ts.map +1 -0
- package/dist/storybook/browser/decorator.js +71 -0
- package/dist/storybook/browser/decorator.js.map +7 -0
- package/dist/storybook/browser/register.d.ts +27 -0
- package/dist/storybook/browser/register.d.ts.map +1 -0
- package/dist/storybook/browser/register.js +378 -0
- package/dist/storybook/browser/register.js.map +7 -0
- package/dist/storybook/getStorybookBuildCommandParts.d.ts +2 -0
- package/dist/storybook/getStorybookBuildCommandParts.d.ts.map +1 -0
- package/dist/storybook/getStorybookVersionFromPackageJson.d.ts +2 -0
- package/dist/storybook/getStorybookVersionFromPackageJson.d.ts.map +1 -0
- package/dist/storybook/index.d.ts +3 -0
- package/dist/storybook/index.d.ts.map +1 -0
- package/dist/storybook/index.js +181 -0
- package/dist/storybook/index.js.map +7 -0
- package/dist/storybook/isomorphic/types.d.ts +7 -0
- package/dist/storybook/isomorphic/types.d.ts.map +1 -0
- package/dist/storybook/preset.d.ts +3 -0
- package/dist/storybook/preset.d.ts.map +1 -0
- package/dist/storybook/preset.js +13 -0
- package/dist/storybook/preset.js.map +7 -0
- package/dist/utils/Logger.d.ts +26 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/createHash.d.ts +7 -0
- package/dist/utils/createHash.d.ts.map +1 -0
- package/dist/utils/deterministicArchive.d.ts +20 -0
- package/dist/utils/deterministicArchive.d.ts.map +1 -0
- package/dist/utils/validateArchive.d.ts +11 -0
- package/dist/utils/validateArchive.d.ts.map +1 -0
- package/package.json +157 -13
- package/.importjs.js +0 -1
- package/bin/happo +0 -3
- package/lib/cli.js +0 -104
- package/lib/initializeConfig.js +0 -30
- package/lib/processSerially.js +0 -15
- package/lib/validateConfig.js +0 -45
- package/src/__tests__/.eslintrc.js +0 -9
- package/src/__tests__/initializeConfig-test.js +0 -20
- package/src/__tests__/processSerially-test.js +0 -19
- package/src/cli.js +0 -95
- package/src/initializeConfig.js +0 -31
- package/src/processSerially.js +0 -9
- package/src/validateConfig.js +0 -42
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Happo
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
An open source library for integrating with [happo.io](https://happo.io) - a visual regression testing platform that helps you catch unintended visual changes in your applications.
|
|
6
|
+
|
|
7
|
+
## โ ๏ธ Active Development
|
|
8
|
+
|
|
9
|
+
This library is currently under active development. Features and APIs may change between releases. Follow this repository to get notified about new releases and updates.
|
|
10
|
+
|
|
11
|
+
## ๐ Documentation
|
|
12
|
+
|
|
13
|
+
For comprehensive documentation, visit [docs.happo.io](https://docs.happo.io).
|
|
14
|
+
|
|
15
|
+
## ๐ Features
|
|
16
|
+
|
|
17
|
+
- **CLI Tool**: Includes a command-line interface for easy integration
|
|
18
|
+
- **Flexible Configuration**: Support for multiple configuration file formats
|
|
19
|
+
- **TypeScript Support**: Built with TypeScript and provides full type definitions
|
|
20
|
+
- **ES Modules**: Uses modern ES modules for better tree-shaking and performance
|
|
21
|
+
- **Cross-Platform**: Works on all major operating systems
|
|
22
|
+
|
|
23
|
+
## ๐ฆ Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install happo --save-dev
|
|
27
|
+
# or
|
|
28
|
+
pnpm add happo --save-dev
|
|
29
|
+
# or
|
|
30
|
+
yarn add happo --dev
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## ๐ ๏ธ Usage
|
|
34
|
+
|
|
35
|
+
### Basic Configuration
|
|
36
|
+
|
|
37
|
+
Create a `happo.config.ts` file in your project root:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { defineConfig } from 'happo';
|
|
41
|
+
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
apiKey: process.env.HAPPO_API_KEY!,
|
|
44
|
+
apiSecret: process.env.HAPPO_API_SECRET!,
|
|
45
|
+
targets: {
|
|
46
|
+
'chrome-desktop': {
|
|
47
|
+
browserType: 'chrome',
|
|
48
|
+
viewport: '1280x720',
|
|
49
|
+
},
|
|
50
|
+
'firefox-desktop': {
|
|
51
|
+
browserType: 'firefox',
|
|
52
|
+
viewport: '1280x720',
|
|
53
|
+
},
|
|
54
|
+
'ios-safari': {
|
|
55
|
+
browserType: 'ios-safari',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### CLI Usage
|
|
62
|
+
|
|
63
|
+
Run Happo using the CLI:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx happo
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The CLI will automatically find your configuration file and execute the visual regression tests.
|
|
70
|
+
|
|
71
|
+
## ๐ง Configuration Options
|
|
72
|
+
|
|
73
|
+
### Supported Configuration Files
|
|
74
|
+
|
|
75
|
+
The library automatically detects configuration files in the following order:
|
|
76
|
+
|
|
77
|
+
- `happo.config.js`
|
|
78
|
+
- `happo.config.mjs`
|
|
79
|
+
- `happo.config.cjs`
|
|
80
|
+
- `happo.config.ts`
|
|
81
|
+
- `happo.config.mts`
|
|
82
|
+
- `happo.config.cts`
|
|
83
|
+
|
|
84
|
+
### Key Configuration Properties
|
|
85
|
+
|
|
86
|
+
- **`apiKey`** & **`apiSecret`**: Authentication credentials for happo.io
|
|
87
|
+
- **`targets`**: Browser configurations for testing
|
|
88
|
+
- **`project`**: Optional project name for multi-project accounts
|
|
89
|
+
|
|
90
|
+
### Browser Targets
|
|
91
|
+
|
|
92
|
+
Supported browser types:
|
|
93
|
+
|
|
94
|
+
- **Desktop**: `chrome`, `firefox`, `edge`, `safari`, `accessibility`
|
|
95
|
+
- **Mobile**: `ios-safari`, `ipad-safari`
|
|
96
|
+
|
|
97
|
+
Each target supports advanced options like:
|
|
98
|
+
|
|
99
|
+
- Viewport sizing
|
|
100
|
+
- Maximum height/width
|
|
101
|
+
- Color scheme preferences
|
|
102
|
+
|
|
103
|
+
## ๐งช Testing
|
|
104
|
+
|
|
105
|
+
This project uses Node.js built-in test runner:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm test
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## ๐ค Contributing
|
|
112
|
+
|
|
113
|
+
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
|
|
114
|
+
|
|
115
|
+
### Development Setup
|
|
116
|
+
|
|
117
|
+
1. Clone the repository
|
|
118
|
+
2. Install dependencies: `pnpm install`
|
|
119
|
+
3. Build the project: `pnpm build`
|
|
120
|
+
4. Run tests: `pnpm test` and `pnpm test:playwright`
|
|
121
|
+
|
|
122
|
+
To run the tests you will need a `.env.local` file with some keys. Use
|
|
123
|
+
`env.example` as a starting point.
|
|
124
|
+
|
|
125
|
+
### Code Style
|
|
126
|
+
|
|
127
|
+
- Uses ESLint for code linting
|
|
128
|
+
- Prettier for code formatting
|
|
129
|
+
- TypeScript for type safety
|
|
130
|
+
|
|
131
|
+
## ๐ License
|
|
132
|
+
|
|
133
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
134
|
+
|
|
135
|
+
## ๐ Links
|
|
136
|
+
|
|
137
|
+
- [Documentation](https://docs.happo.io)
|
|
138
|
+
- [happo.io](https://happo.io)
|
|
139
|
+
- [npm package](https://www.npmjs.com/package/happo)
|
|
140
|
+
|
|
141
|
+
## ๐ก Support
|
|
142
|
+
|
|
143
|
+
For support and questions:
|
|
144
|
+
|
|
145
|
+
- Check the [documentation](https://docs.happo.io)
|
|
146
|
+
- Open an issue in this GitHub repository
|
|
147
|
+
- Contact happo.io support at support@happo.io
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const recordedCSSSymbol: unique symbol;
|
|
2
|
+
declare const isInstalledSymbol: unique symbol;
|
|
3
|
+
interface ExtendedCSSStyleSheetConstructor {
|
|
4
|
+
new (options?: CSSStyleSheetInit): CSSStyleSheet;
|
|
5
|
+
[isInstalledSymbol]?: boolean;
|
|
6
|
+
prototype: CSSStyleSheet;
|
|
7
|
+
}
|
|
8
|
+
interface ExtendedWindow extends Window {
|
|
9
|
+
CSSStyleSheet: ExtendedCSSStyleSheetConstructor;
|
|
10
|
+
}
|
|
11
|
+
export declare function isExtendedWindow(w: Window): w is ExtendedWindow;
|
|
12
|
+
export default function applyConstructedStylesPatch(win?: ExtendedWindow): void;
|
|
13
|
+
export { recordedCSSSymbol };
|
|
14
|
+
//# sourceMappingURL=applyConstructedStylesPatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyConstructedStylesPatch.d.ts","sourceRoot":"","sources":["../../src/browser/applyConstructedStylesPatch.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,EAAE,OAAO,MAAmC,CAAC;AAEpE,QAAA,MAAM,iBAAiB,EAAE,OAAO,MAA8B,CAAC;AAS/D,UAAU,gCAAgC;IACxC,KAAK,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC;IACjD,CAAC,iBAAiB,CAAC,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,aAAa,CAAC;CAC1B;AAGD,UAAU,cAAe,SAAQ,MAAM;IACrC,aAAa,EAAE,gCAAgC,CAAC;CACjD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,cAAc,CAK/D;AAwCD,MAAM,CAAC,OAAO,UAAU,2BAA2B,CACjD,GAAG,GAAE,cAAoD,GACxD,IAAI,CA+HN;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws if the element is not a valid Element instance, an array of elements,
|
|
3
|
+
* or a NodeList of elements.
|
|
4
|
+
*/
|
|
5
|
+
export default function assertElement(element: unknown, gt?: typeof globalThis): asserts element is Element | Array<Element> | NodeListOf<Element>;
|
|
6
|
+
//# sourceMappingURL=assertElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertElement.d.ts","sourceRoot":"","sources":["../../src/browser/assertElement.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,OAAO,EAAE,OAAO,EAChB,EAAE,GAAE,OAAO,UAA8B,GACxC,OAAO,CAAC,OAAO,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAuBnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/browser/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;CACpC"}
|