@applitools/core 4.56.1 → 4.56.3
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/CHANGELOG.md +121 -0
- package/README.md +200 -0
- package/dist/automation/get-nml-client.js +6 -1
- package/dist/classic/check.js +17 -5
- package/dist/classic/utils/take-dom-capture.js +4 -4
- package/dist/classic/utils/take-screenshots.js +12 -9
- package/dist/index.js +3 -3
- package/package.json +23 -49
- package/types/automation/get-nml-client.d.ts +1 -0
- package/types/automation/utils/take-screenshot.d.ts +2 -1
- package/types/index.d.ts +1 -2
- package/dist/cli/cli.js +0 -160
- package/dist/universal/core-server-process.js +0 -31
- package/dist/universal/core-server.js +0 -216
- package/dist/universal/history.js +0 -90
- package/dist/universal/refer.js +0 -67
- package/dist/universal/spec-driver.js +0 -189
- package/dist/universal/types.js +0 -2
- package/dist/universal/ws-server.js +0 -66
- package/types/cli/cli.d.ts +0 -2
- package/types/universal/core-server-process.d.ts +0 -9
- package/types/universal/core-server.d.ts +0 -18
- package/types/universal/history.d.ts +0 -2
- package/types/universal/refer.d.ts +0 -8
- package/types/universal/spec-driver.d.ts +0 -15
- package/types/universal/types.d.ts +0 -205
- package/types/universal/ws-server.d.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,126 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.56.3](https://github.com/Applitools-Dev/sdk/compare/js/core@4.56.2...js/core@4.56.3) (2026-03-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Performance Improvements
|
|
7
|
+
|
|
8
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/dom-snapshot bumped to 4.15.9
|
|
14
|
+
#### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* expand CSS vars in CSSOM-injected style tags | FLD-4106 ([0821f9e](https://github.com/Applitools-Dev/sdk/commit/0821f9e7f6b20ec05387a8523dc0254bac22591b))
|
|
17
|
+
* @applitools/image bumped to 1.2.7
|
|
18
|
+
#### Performance Improvements
|
|
19
|
+
|
|
20
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
21
|
+
* @applitools/screenshoter bumped to 3.12.14
|
|
22
|
+
#### Performance Improvements
|
|
23
|
+
|
|
24
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* @applitools/nml-client bumped to 1.11.17
|
|
29
|
+
#### Performance Improvements
|
|
30
|
+
|
|
31
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
* @applitools/ufg-client bumped to 1.19.2
|
|
36
|
+
#### Performance Improvements
|
|
37
|
+
|
|
38
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
* @applitools/core-base bumped to 1.31.3
|
|
43
|
+
#### Performance Improvements
|
|
44
|
+
|
|
45
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
* @applitools/ec-client bumped to 1.12.19
|
|
50
|
+
#### Performance Improvements
|
|
51
|
+
|
|
52
|
+
* use sharp to accelerate png performance in all js packages ([#3547](https://github.com/Applitools-Dev/sdk/issues/3547)) ([6e3c7b9](https://github.com/Applitools-Dev/sdk/commit/6e3c7b9e34815f470032ece52a161001592ad1b1))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [4.56.2](https://github.com/Applitools-Dev/sdk/compare/js/core@4.56.1...js/core@4.56.2) (2026-02-16)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* closing eyes without open | FLD-2814 ([#2916](https://github.com/Applitools-Dev/sdk/issues/2916)) ([d5425df](https://github.com/Applitools-Dev/sdk/commit/d5425dfedcc98bebd547d0d1ce5bcd10fa675c0d))
|
|
63
|
+
* tunnel client binary ([#3535](https://github.com/Applitools-Dev/sdk/issues/3535)) ([5c4752e](https://github.com/Applitools-Dev/sdk/commit/5c4752e3dd9cc42052d23793284dc6a0cd8e3b72))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Performance Improvements
|
|
67
|
+
|
|
68
|
+
* add timing logs to classic | FLD-4137 ([#3543](https://github.com/Applitools-Dev/sdk/issues/3543)) ([de2b0aa](https://github.com/Applitools-Dev/sdk/commit/de2b0aaf08d813f2c59e9552947c2f4fbc12da48))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
* @applitools/logger bumped to 2.2.8
|
|
74
|
+
#### Bug Fixes
|
|
75
|
+
|
|
76
|
+
* use utils for environment variable retrieval in logger handlers ([#3551](https://github.com/Applitools-Dev/sdk/issues/3551)) ([caf97f3](https://github.com/Applitools-Dev/sdk/commit/caf97f34207bc3b8ee6ccda2855c27a99a262f8c))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
#### Performance Improvements
|
|
80
|
+
|
|
81
|
+
* add timing logs to classic | FLD-4137 ([#3543](https://github.com/Applitools-Dev/sdk/issues/3543)) ([de2b0aa](https://github.com/Applitools-Dev/sdk/commit/de2b0aaf08d813f2c59e9552947c2f4fbc12da48))
|
|
82
|
+
* @applitools/tunnel-client bumped to 1.11.6
|
|
83
|
+
#### Bug Fixes
|
|
84
|
+
|
|
85
|
+
* tunnel client binary ([#3535](https://github.com/Applitools-Dev/sdk/issues/3535)) ([5c4752e](https://github.com/Applitools-Dev/sdk/commit/5c4752e3dd9cc42052d23793284dc6a0cd8e3b72))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
* @applitools/dom-snapshot bumped to 4.15.8
|
|
90
|
+
|
|
91
|
+
* @applitools/socket bumped to 1.3.9
|
|
92
|
+
|
|
93
|
+
* @applitools/req bumped to 1.8.8
|
|
94
|
+
|
|
95
|
+
* @applitools/dom-capture bumped to 11.6.9
|
|
96
|
+
|
|
97
|
+
* @applitools/driver bumped to 1.25.1
|
|
98
|
+
|
|
99
|
+
* @applitools/spec-driver-webdriver bumped to 1.5.6
|
|
100
|
+
|
|
101
|
+
* @applitools/spec-driver-selenium bumped to 1.7.12
|
|
102
|
+
|
|
103
|
+
* @applitools/spec-driver-puppeteer bumped to 1.7.1
|
|
104
|
+
|
|
105
|
+
* @applitools/screenshoter bumped to 3.12.13
|
|
106
|
+
|
|
107
|
+
* @applitools/nml-client bumped to 1.11.16
|
|
108
|
+
|
|
109
|
+
* @applitools/ufg-client bumped to 1.19.1
|
|
110
|
+
|
|
111
|
+
* @applitools/ec-client bumped to 1.12.18
|
|
112
|
+
|
|
113
|
+
* @applitools/test-server bumped to 1.4.0
|
|
114
|
+
#### Features
|
|
115
|
+
|
|
116
|
+
* make eyes-browser truly browser-importable ([#3512](https://github.com/Applitools-Dev/sdk/issues/3512)) ([9574a2f](https://github.com/Applitools-Dev/sdk/commit/9574a2fa45ec80466dfe93744c8a736f40fb51c3))
|
|
117
|
+
* mcp server test results support and improvements to initial setup ([#3518](https://github.com/Applitools-Dev/sdk/issues/3518)) ([ef6c27b](https://github.com/Applitools-Dev/sdk/commit/ef6c27b9e35dc54fd588e19a4811631433e15dbb))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
* @applitools/core-base bumped to 1.31.2
|
|
122
|
+
|
|
123
|
+
|
|
3
124
|
## [4.56.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.56.0...js/core@4.56.1) (2026-01-27)
|
|
4
125
|
|
|
5
126
|
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# @applitools/core
|
|
2
|
+
|
|
3
|
+
The core SDK package that orchestrates visual testing via two distinct check strategies: **Classic** and **UFG** (Ultrafast Grid).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Check Strategies Overview
|
|
8
|
+
|
|
9
|
+
Both strategies share the same entry point (`src/check.ts`) which normalizes settings and then delegates to the appropriate typed implementation based on the `type` parameter (`'classic'` or `'ufg'`).
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
eyes.check()
|
|
13
|
+
└── src/check.ts ← normalizes settings, resolves type
|
|
14
|
+
├── classic/check.ts ← screenshot-based flow
|
|
15
|
+
└── ufg/check.ts ← DOM snapshot + cloud rendering flow
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Classic Check
|
|
21
|
+
|
|
22
|
+
**Concept**: Capture a screenshot locally (in the test runner's browser/device) and send it to Applitools for comparison against the baseline.
|
|
23
|
+
|
|
24
|
+
### Flow
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
check()
|
|
28
|
+
│
|
|
29
|
+
├── [driver target?]
|
|
30
|
+
│ │
|
|
31
|
+
│ ├── beforeScreenshot()
|
|
32
|
+
│ │ ├── setScrollingElement
|
|
33
|
+
│ │ └── waitForLazyLoad (if enabled)
|
|
34
|
+
│ │
|
|
35
|
+
│ ├── [web or native?]
|
|
36
|
+
│ │ ├── takeWebScreenshot()
|
|
37
|
+
│ │ │ ├── takeScreenshot() ← scrolls, stitches, captures PNG
|
|
38
|
+
│ │ │ └── takeDomCapture() ← captures DOM (if sendDom=true)
|
|
39
|
+
│ │ │
|
|
40
|
+
│ │ └── takeNMLScreenshot()
|
|
41
|
+
│ │ └── nmlClient.takeScreenshots() ← native mobile (NML)
|
|
42
|
+
│ │
|
|
43
|
+
│ └── [matchTimeout set?]
|
|
44
|
+
│ ├── YES → checkEnvironment() synchronously, retry until passes
|
|
45
|
+
│ └── NO → checkInTheBackground() ← fire-and-forget, non-blocking
|
|
46
|
+
│
|
|
47
|
+
└── [image target?]
|
|
48
|
+
└── checkInTheBackground() ← directly queue pre-captured image
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Key files
|
|
52
|
+
|
|
53
|
+
| File | Purpose |
|
|
54
|
+
|------|---------|
|
|
55
|
+
| `src/classic/check.ts` | Orchestrates the classic check flow |
|
|
56
|
+
| `src/classic/utils/take-screenshots.ts` | Takes the screenshot and optional DOM capture |
|
|
57
|
+
| `src/classic/utils/take-dom-capture.ts` | Captures the page DOM for RCA |
|
|
58
|
+
| `src/automation/utils/take-screenshot.ts` | Low-level screenshot + stitching logic |
|
|
59
|
+
|
|
60
|
+
### What happens on each check
|
|
61
|
+
|
|
62
|
+
1. **Settings normalization** — applied in `src/check.ts` (defaults for `fully`, `matchLevel`, `sendDom`, etc.)
|
|
63
|
+
2. **Scroll root / lazy load** — the driver scrolls and waits for deferred content
|
|
64
|
+
3. **Screenshot** — a full-page or viewport PNG is captured locally
|
|
65
|
+
4. **DOM capture** (optional) — if `sendDom=true`, the serialized DOM is captured for Root Cause Analysis (RCA)
|
|
66
|
+
5. **Session open** (lazy) — `getBaseEyes()` opens the Applitools test session on first use
|
|
67
|
+
6. **Upload + compare** — `baseEyes.check()` uploads the image+DOM and triggers comparison
|
|
68
|
+
|
|
69
|
+
### matchTimeout behavior
|
|
70
|
+
|
|
71
|
+
When `matchTimeout > 0`, the SDK retries the entire screenshot→compare cycle until the result matches expectations or the timeout expires. This blocks the test execution thread and is designed to tolerate transient UI states (e.g., loading spinners).
|
|
72
|
+
|
|
73
|
+
### Background queuing
|
|
74
|
+
|
|
75
|
+
When `matchTimeout = 0` (default), checks are queued as background promises. The test thread is not blocked. `eyes.close()` awaits all queued jobs before resolving results.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## UFG Check (Ultrafast Grid)
|
|
80
|
+
|
|
81
|
+
**Concept**: Capture a DOM snapshot locally, upload it to the Applitools rendering farm (UFG - Ultrafast Grid), which renders it in multiple browsers and devices in the cloud and then compares each rendered image against the baseline.
|
|
82
|
+
|
|
83
|
+
### Flow
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
check()
|
|
87
|
+
│
|
|
88
|
+
├── getUFGClient() ← initialize methods for UFG purposes
|
|
89
|
+
│
|
|
90
|
+
├── [driver target?]
|
|
91
|
+
│ └── takeSnapshots()
|
|
92
|
+
│ ├── setScrollingElement
|
|
93
|
+
│ ├── takeDomSnapshots() ← serialized DOM + resources
|
|
94
|
+
│ │ └── (per environment: browser widths, layout breakpoints)
|
|
95
|
+
│ └── driver.getUrl() / getTitle() / getUserAgent()
|
|
96
|
+
│
|
|
97
|
+
├── [for each snapshot × environment]
|
|
98
|
+
│ ├── createRenderTargetFromSnapshot()
|
|
99
|
+
│ │ └── ufgClient.uploadResources() ← CSS, fonts, images → UFG CDN
|
|
100
|
+
│ │
|
|
101
|
+
│ ├── getBaseEyes() ← open test session (lazy, per environment)
|
|
102
|
+
│ │
|
|
103
|
+
│ ├── ufgClient.render()
|
|
104
|
+
│ │ └── UFG renders DOM in target browser/device → returns rendered image
|
|
105
|
+
│ │
|
|
106
|
+
│ └── baseEyes.check() ← compare rendered image against baseline
|
|
107
|
+
│
|
|
108
|
+
└── all environment promises queued in eyes.storage
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Key files
|
|
112
|
+
|
|
113
|
+
| File | Purpose |
|
|
114
|
+
|------|---------|
|
|
115
|
+
| `src/ufg/check.ts` | Orchestrates the UFG check flow |
|
|
116
|
+
| `src/ufg/take-snapshots.ts` | Takes DOM snapshots per environment |
|
|
117
|
+
| `src/ufg/create-render-target-from-snapshot.ts` | Uploads resources to UFG CDN, builds render target |
|
|
118
|
+
| `src/ufg/utils/take-dom-snapshots.ts` | Serializes DOM including cross-frame content |
|
|
119
|
+
|
|
120
|
+
### What happens on each check
|
|
121
|
+
|
|
122
|
+
1. **Settings normalization** — same as Classic (`src/check.ts`)
|
|
123
|
+
2. **DOM snapshot** — the page's full DOM (HTML, CSS, iframes) is serialized and resources are collected
|
|
124
|
+
3. **Resource upload** — CSS, fonts, images are uploaded to the UFG CDN (cached by URL to avoid re-uploads)
|
|
125
|
+
4. **Render request** — sent to the UFG rendering farm per target environment (browser + viewport or device)
|
|
126
|
+
5. **Session open** (lazy, per environment) — `getBaseEyes()` opens one Applitools session per environment
|
|
127
|
+
6. **Compare** — `baseEyes.check()` receives the rendered image reference (`renderId`) and triggers comparison
|
|
128
|
+
|
|
129
|
+
### Environment targeting
|
|
130
|
+
|
|
131
|
+
UFG supports rendering in multiple environments per check:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
settings.environments = [
|
|
135
|
+
{ name: 'chrome', width: 1280, height: 800 },
|
|
136
|
+
{ name: 'firefox', width: 1280, height: 800 },
|
|
137
|
+
{ chromeEmulationInfo: { deviceName: 'Pixel 4 XL' } },
|
|
138
|
+
{ iosDeviceInfo: { deviceName: 'iPhone 12', version: 'latest' } },
|
|
139
|
+
]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Each environment produces one independent test session, one render, and one comparison result.
|
|
143
|
+
|
|
144
|
+
### Layout breakpoints
|
|
145
|
+
|
|
146
|
+
UFG supports `layoutBreakpoints` — the DOM is snapshotted at each specified viewport width to capture responsive layout differences, and UFG renders each environment at the closest matching breakpoint.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Classic vs UFG: Key Differences
|
|
151
|
+
|
|
152
|
+
| Aspect | Classic | UFG |
|
|
153
|
+
|--------|---------|-----|
|
|
154
|
+
| **What's captured locally** | Screenshot (PNG) | DOM snapshot (HTML/CSS/resources) |
|
|
155
|
+
| **Where rendering happens** | Local driver (real browser) | Applitools cloud (UFG rendering farm) |
|
|
156
|
+
| **Multi-environment** | Takes one screenshot, reuses for all envs | Renders separately per environment |
|
|
157
|
+
| **Native mobile** | Supported via NML (real devices) | Supported via cloud device emulation |
|
|
158
|
+
| **DOM capture** | Optional (for RCA) | Always — it's the input |
|
|
159
|
+
| **Concurrency usage** | One slot per environment | One slot per environment |
|
|
160
|
+
| **matchTimeout** | Supported (retry loop) | Not supported |
|
|
161
|
+
| **Scroll/stitch** | Done locally by the SDK | Done by UFG renderer |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Environment Terminology
|
|
166
|
+
|
|
167
|
+
Two distinct environment shapes flow through classic check. Confusing them is the source of a known bug.
|
|
168
|
+
|
|
169
|
+
| Name | TypeScript type | Shape | Where it comes from |
|
|
170
|
+
|------|----------------|-------|---------------------|
|
|
171
|
+
| **Requested environment** (also called *unique environment*) | `RenderEnvironment` | `{iosDeviceInfo: {deviceName: 'iPhone 12'}}` or `{name: 'chrome', width: 1280, height: 800}` | Comes from `settings.environments` (user input). After `uniquifyEnvironments()`, duplicates get a synthetic `environmentId` to map to separate sessions. |
|
|
172
|
+
| **Actual / exact environment** | `ExactEnvironment` | `{environmentId, deviceName, os, viewportSize, requested: <RenderEnvironment>}` | Returned by `takeWebScreenshot` / `takeNMLScreenshot` after the device is resolved. The flat shape that `core-base` and the Applitools server understand. Always has `requested` pointing back to the original `RenderEnvironment`. |
|
|
173
|
+
|
|
174
|
+
**Key invariant:** `toEnvironmentKey(exactEnvironment)` === `toEnvironmentKey(requestedEnvironment)` because `toEnvironmentKey` uses `env.requested ?? env`. This is how the `makeGetBaseEyes` cache correctly matches an early session-open (keyed on the requested environment) to the later check (keyed on the exact environment).
|
|
175
|
+
|
|
176
|
+
**Known bug:** In the `matchTimeout` path, `base.openEyes` is called with the *requested* environment (`{iosDeviceInfo: ...}`) instead of the *exact* environment (`{deviceName, os, viewportSize, ...}`). `core-base/server/requests.ts` reads the flat fields (`os`, `deviceName`, `viewportSize`) which are `undefined` on the requested form, so the session opens on the server with empty environment info. This only affects NML (iOS/Android native) environments since web environments are not transformed and `exactEnvironment === requestedEnvironment`.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Session Lifecycle (Both Strategies)
|
|
181
|
+
|
|
182
|
+
Sessions are opened **lazily** — the Applitools test session is not created during `openEyes()`, but on the first `getBaseEyes()` call within a check. This avoids charging concurrency for tests that open but never check.
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
openEyes() → creates in-memory Eyes object, no server call
|
|
186
|
+
check() → getBaseEyes() → POST /api/sessions (first time only)
|
|
187
|
+
check() → getBaseEyes() → returns cached session (subsequent calls)
|
|
188
|
+
close() / abort() → closes all open sessions, awaits all queued jobs
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Storage Model
|
|
194
|
+
|
|
195
|
+
Both strategies push check promises into `eyes.storage`, a `Map<environmentKey, {eyes, jobs[]}>`:
|
|
196
|
+
|
|
197
|
+
- `eyes` — a controlled promise resolving to the base eyes session
|
|
198
|
+
- `jobs` — array of check promises for that environment
|
|
199
|
+
|
|
200
|
+
`close()` waits for all jobs across all environments before collecting results.
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeGetNMLClient = void 0;
|
|
3
|
+
exports.makeGetNMLClient = exports.clearNMLClients = void 0;
|
|
4
4
|
const nml_client_1 = require("@applitools/nml-client");
|
|
5
5
|
const clients = new Map();
|
|
6
|
+
// for tests
|
|
7
|
+
function clearNMLClients() {
|
|
8
|
+
clients.clear();
|
|
9
|
+
}
|
|
10
|
+
exports.clearNMLClients = clearNMLClients;
|
|
6
11
|
function makeGetNMLClient({ client, logger: mainLogger }) {
|
|
7
12
|
return {
|
|
8
13
|
getNMLClient,
|
package/dist/classic/check.js
CHANGED
|
@@ -96,19 +96,31 @@ function makeCheck({ eyes, target: defaultTarget, environments: defaultEnvironme
|
|
|
96
96
|
} while (!asExpected && Date.now() - start < settings.matchTimeout);
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
+
// Eagerly start opening sessions for web environments while screenshots are being taken.
|
|
100
|
+
// NML environments are excluded because their exact environment shape (deviceName, os,
|
|
101
|
+
// viewportSize) is only resolved after generateBaseScreenshotsAndSettings() returns, and
|
|
102
|
+
// using the unique env shape would open the session with wrong/empty fields.
|
|
103
|
+
const environmentLoggers = new Map();
|
|
104
|
+
uniqueEnvironments
|
|
105
|
+
.filter(env => !('iosDeviceInfo' in env) && !('androidDeviceInfo' in env))
|
|
106
|
+
.forEach(environment => {
|
|
107
|
+
const environmentLogger = logger.extend({ tags: [`environment-${utils.general.shortid()}`] });
|
|
108
|
+
environmentLoggers.set((0, to_environment_key_1.toEnvironmentKey)(environment), environmentLogger);
|
|
109
|
+
void getBaseEyes({ environment, driver, logger: environmentLogger });
|
|
110
|
+
});
|
|
99
111
|
// generate base targets (images to be compared) and settings for each environment
|
|
100
112
|
const baseScreenshotsAndSettings = await generateBaseScreenshotsAndSettings(settings, uniqueEnvironments, eyes, logger, driver);
|
|
101
113
|
// when no match timeout is set, queue all environment checks against the server without stalling the client test execution
|
|
102
114
|
baseScreenshotsAndSettings.forEach(({ exactEnvironment: environment, baseSetting, baseTarget }) => {
|
|
103
|
-
checkInTheBackground(environment, baseTarget, baseSetting);
|
|
115
|
+
checkInTheBackground(environment, baseTarget, baseSetting, environmentLoggers.get((0, to_environment_key_1.toEnvironmentKey)(environment)));
|
|
104
116
|
});
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
else {
|
|
108
120
|
uniqueEnvironments.forEach(environment => checkInTheBackground(environment, target, settings));
|
|
109
121
|
}
|
|
110
|
-
function checkInTheBackground(environment, target, settings) {
|
|
111
|
-
putInStorage(environment, eyes, checkEnvironment({ eyes, driver, target, environment, signal, logger, settings }));
|
|
122
|
+
function checkInTheBackground(environment, target, settings, environmentLogger) {
|
|
123
|
+
putInStorage(environment, eyes, checkEnvironment({ eyes, driver, target, environment, signal, logger, settings, environmentLogger }));
|
|
112
124
|
}
|
|
113
125
|
};
|
|
114
126
|
function putInStorage(environment, eyes, promise) {
|
|
@@ -155,9 +167,9 @@ async function logAmmutabilityIfNeeded({ eyes, baseEyes, settings, }) {
|
|
|
155
167
|
settings.assumesMutability = false; // prevent from logging this message again for the same check
|
|
156
168
|
}
|
|
157
169
|
}
|
|
158
|
-
async function checkEnvironment({ eyes, driver, target, environment, signal, logger, settings, }) {
|
|
170
|
+
async function checkEnvironment({ eyes, driver, target, environment, signal, logger, settings, environmentLogger: providedEnvironmentLogger, }) {
|
|
159
171
|
var _a, _b;
|
|
160
|
-
const environmentLogger = logger.extend({ tags: [`environment-${utils.general.shortid()}`] });
|
|
172
|
+
const environmentLogger = providedEnvironmentLogger !== null && providedEnvironmentLogger !== void 0 ? providedEnvironmentLogger : logger.extend({ tags: [`environment-${utils.general.shortid()}`] });
|
|
161
173
|
environmentLogger.log('Command "check" is called with settings', settings);
|
|
162
174
|
try {
|
|
163
175
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
@@ -5,8 +5,8 @@ const req_1 = require("@applitools/req");
|
|
|
5
5
|
const { captureDomPoll, pollResult, captureDomPollForIE, pollResultForIE } = require('@applitools/dom-capture');
|
|
6
6
|
async function takeDomCapture({ driver, settings, logger, }) {
|
|
7
7
|
var _a;
|
|
8
|
-
const environment = await driver.getEnvironment();
|
|
9
|
-
const features = await driver.getFeatures();
|
|
8
|
+
const environment = await logger.withTime(driver.getEnvironment(), 'takeDomCapture.getEnvironment');
|
|
9
|
+
const features = await logger.withTime(driver.getFeatures(), 'takeDomCapture.getFeatures');
|
|
10
10
|
const isLegacyBrowser = environment.isIE || environment.isEdgeLegacy;
|
|
11
11
|
const arg = {
|
|
12
12
|
chunkByteLength: (_a = settings === null || settings === void 0 ? void 0 : settings.chunkByteLength) !== null && _a !== void 0 ? _a : (Number(process.env.APPLITOOLS_SCRIPT_RESULT_MAX_BYTE_LENGTH) ||
|
|
@@ -21,8 +21,8 @@ async function takeDomCapture({ driver, settings, logger, }) {
|
|
|
21
21
|
? pollResult
|
|
22
22
|
: `/* @applitools/dom-capture */return (${isLegacyBrowser ? pollResultForIE : pollResult}).apply(null, arguments);`,
|
|
23
23
|
};
|
|
24
|
-
const url = await driver.getUrl();
|
|
25
|
-
const dom = await captureContextDom(driver.mainContext);
|
|
24
|
+
const url = await logger.withTime(driver.getUrl(), 'takeDomCapture.getUrl');
|
|
25
|
+
const dom = await logger.withTime(captureContextDom(driver.mainContext), 'takeDomCapture.captureContextDom');
|
|
26
26
|
// TODO save debug DOM like we have for debug screenshots
|
|
27
27
|
return dom;
|
|
28
28
|
async function captureContextDom(context) {
|
|
@@ -29,25 +29,28 @@ const take_screenshot_1 = require("../../automation/utils/take-screenshot");
|
|
|
29
29
|
const utils = __importStar(require("@applitools/utils"));
|
|
30
30
|
async function takeScreenshots({ driver, settings, logger, }) {
|
|
31
31
|
var _a, _b;
|
|
32
|
-
const screenshot = await (0, take_screenshot_1.takeScreenshot)({ driver, settings, logger });
|
|
32
|
+
const screenshot = await logger.withTime((0, take_screenshot_1.takeScreenshot)({ driver, settings, logger }), 'takeScreenshot');
|
|
33
|
+
const name = await logger.withTime(driver.getTitle(), 'getTitle');
|
|
34
|
+
const source = await logger.withTime(driver.getUrl(), 'getUrl');
|
|
35
|
+
const image = await logger.withTime(screenshot.image.toPng(), 'toPng');
|
|
33
36
|
const baseTarget = {
|
|
34
|
-
name
|
|
35
|
-
source
|
|
36
|
-
image
|
|
37
|
+
name,
|
|
38
|
+
source,
|
|
39
|
+
image,
|
|
37
40
|
locationInViewport: utils.geometry.location(screenshot.region),
|
|
38
41
|
calculatedRegions: screenshot.calculatedRegions,
|
|
39
42
|
isTransformed: true,
|
|
40
43
|
};
|
|
41
|
-
const environment = await driver.getEnvironment();
|
|
44
|
+
const environment = await logger.withTime(driver.getEnvironment(), 'getEnvironment');
|
|
42
45
|
if (environment.isWeb && settings.domSettings) {
|
|
43
46
|
if (settings.fully)
|
|
44
|
-
await ((_a = screenshot.scrollingElement) === null || _a === void 0 ? void 0 : _a.setAttribute('data-applitools-scroll', 'true'));
|
|
47
|
+
await logger.withTime((_a = screenshot.scrollingElement) === null || _a === void 0 ? void 0 : _a.setAttribute('data-applitools-scroll', 'true'), 'setAttribute');
|
|
45
48
|
else
|
|
46
|
-
await ((_b = screenshot.element) === null || _b === void 0 ? void 0 : _b.setAttribute('data-applitools-scroll', 'true'));
|
|
47
|
-
baseTarget.dom = await (0, take_dom_capture_1.takeDomCapture)({ driver, settings: settings.domSettings, logger }).catch(error => {
|
|
49
|
+
await logger.withTime((_b = screenshot.element) === null || _b === void 0 ? void 0 : _b.setAttribute('data-applitools-scroll', 'true'), 'setAttribute');
|
|
50
|
+
baseTarget.dom = await logger.withTime((0, take_dom_capture_1.takeDomCapture)({ driver, settings: settings.domSettings, logger }).catch(error => {
|
|
48
51
|
logger.error('failed to capture DOM', error);
|
|
49
52
|
return undefined;
|
|
50
|
-
});
|
|
53
|
+
}), 'takeDomCapture');
|
|
51
54
|
}
|
|
52
55
|
if (settings.calculateView) {
|
|
53
56
|
const scrollingElement = await driver.mainContext.getScrollingElement();
|
package/dist/index.js
CHANGED
|
@@ -26,14 +26,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.MissingApiKeyError = exports.logs = exports.formatters = void 0;
|
|
29
|
+
exports.MissingApiKeyError = exports.checkNetwork = exports.logs = exports.formatters = void 0;
|
|
30
30
|
__exportStar(require("./types"), exports);
|
|
31
31
|
__exportStar(require("./core"), exports);
|
|
32
|
-
__exportStar(require("./universal/core-server"), exports);
|
|
33
|
-
__exportStar(require("./universal/core-server-process"), exports);
|
|
34
32
|
__exportStar(require("./autonomous/core"), exports);
|
|
35
33
|
__exportStar(require("@applitools/driver/dist/debug"), exports);
|
|
36
34
|
exports.formatters = __importStar(require("./utils/format-results"));
|
|
37
35
|
exports.logs = __importStar(require("./troubleshoot/logs"));
|
|
36
|
+
var check_network_1 = require("./troubleshoot/check-network");
|
|
37
|
+
Object.defineProperty(exports, "checkNetwork", { enumerable: true, get: function () { return check_network_1.checkNetwork; } });
|
|
38
38
|
var core_base_1 = require("@applitools/core-base");
|
|
39
39
|
Object.defineProperty(exports, "MissingApiKeyError", { enumerable: true, get: function () { return core_base_1.MissingApiKeyError; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.56.
|
|
3
|
+
"version": "4.56.3",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
34
34
|
"bin": {
|
|
35
|
-
"eyes-check-network": "./dist/troubleshoot/check-network.js"
|
|
36
|
-
"eyes-core": "./dist/cli/cli.js"
|
|
35
|
+
"eyes-check-network": "./dist/troubleshoot/check-network.js"
|
|
37
36
|
},
|
|
38
37
|
"main": "./dist/index.js",
|
|
39
38
|
"types": "./types/index.d.ts",
|
|
@@ -48,13 +47,9 @@
|
|
|
48
47
|
"lint": "run --top-level eslint '**/*.ts'",
|
|
49
48
|
"build": "yarn build:dist",
|
|
50
49
|
"build:dist": "run --top-level tsc --project ./tsconfig.build.json",
|
|
51
|
-
"
|
|
52
|
-
"build:bin:zip": "zip -j ./bin/core.zip $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
53
|
-
"build:bin:tgz": "tar -czf ./bin/core.tar.gz $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
54
|
-
"test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/bin/**' --exclude './test/e2e/mocha-sync/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit --require ./test/mocha-global-setup.js",
|
|
50
|
+
"test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/e2e/mocha-sync/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit --require ./test/mocha-global-setup.js",
|
|
55
51
|
"test:local": "MOCHA_OMIT_TAGS=sauce,browserstack run test",
|
|
56
52
|
"test:sauce": "MOCHA_ONLY_TAGS=sauce,browserstack run test",
|
|
57
|
-
"test:bin": "MOCHA_GROUP=bin run --top-level mocha './test/bin/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15} --require ./test/mocha-global-setup.js",
|
|
58
53
|
"test:e2e": "MOCHA_GROUP=e2e run --top-level mocha './test/e2e/**/*.spec.ts' --exclude './test/e2e/mocha-sync/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit --require ./test/mocha-global-setup.js",
|
|
59
54
|
"test:it": "MOCHA_GROUP=it run --top-level mocha './test/it/**/*.spec.ts' --require ./test/mocha-global-setup.js",
|
|
60
55
|
"test:e2e:sync": "MOCHA_GROUP=e2e SYNC=true run --top-level mocha './test/e2e/mocha-sync/**/*.spec.ts' --exit --require ./test/mocha-global-setup.js",
|
|
@@ -62,61 +57,37 @@
|
|
|
62
57
|
"setup": "run --top-level browsers:setup && run --top-level xvfb:setup",
|
|
63
58
|
"setup:standalone": "sh -c 'yarn chromedriver --port=4444 --verbose &'"
|
|
64
59
|
},
|
|
65
|
-
"sea": {
|
|
66
|
-
"bin": "eyes-core",
|
|
67
|
-
"certs": {
|
|
68
|
-
"win": {
|
|
69
|
-
"cert": "env.CODE_SIGNING_CERT_WIN",
|
|
70
|
-
"pass": "env.CODE_SIGNING_PASS_WIN"
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"targets": {
|
|
74
|
-
"node20.11-linux-x64-glibc-217": "./bin/core-linux",
|
|
75
|
-
"node20-linux-x64-musl": "./bin/core-alpine",
|
|
76
|
-
"node20-linux-arm64": "./bin/core-linux-arm64",
|
|
77
|
-
"node20-darwin-x64": "./bin/core-macos",
|
|
78
|
-
"node20-win-x64": "./bin/core-win.exe",
|
|
79
|
-
"node20-darwin-arm64": "./bin/core-macos-arm64"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
60
|
"dependencies": {
|
|
83
|
-
"@applitools/core-base": "1.31.
|
|
84
|
-
"@applitools/dom-capture": "11.6.
|
|
85
|
-
"@applitools/dom-snapshot": "4.15.
|
|
86
|
-
"@applitools/driver": "1.25.
|
|
87
|
-
"@applitools/ec-client": "1.12.
|
|
88
|
-
"@applitools/logger": "2.2.
|
|
89
|
-
"@applitools/nml-client": "1.11.
|
|
90
|
-
"@applitools/req": "1.8.
|
|
91
|
-
"@applitools/screenshoter": "3.12.
|
|
61
|
+
"@applitools/core-base": "1.31.3",
|
|
62
|
+
"@applitools/dom-capture": "11.6.9",
|
|
63
|
+
"@applitools/dom-snapshot": "4.15.9",
|
|
64
|
+
"@applitools/driver": "1.25.1",
|
|
65
|
+
"@applitools/ec-client": "1.12.19",
|
|
66
|
+
"@applitools/logger": "2.2.8",
|
|
67
|
+
"@applitools/nml-client": "1.11.17",
|
|
68
|
+
"@applitools/req": "1.8.8",
|
|
69
|
+
"@applitools/screenshoter": "3.12.14",
|
|
92
70
|
"@applitools/snippets": "2.7.0",
|
|
93
|
-
"@applitools/socket": "1.3.
|
|
94
|
-
"@applitools/
|
|
95
|
-
"@applitools/ufg-client": "1.19.0",
|
|
71
|
+
"@applitools/socket": "1.3.9",
|
|
72
|
+
"@applitools/ufg-client": "1.19.2",
|
|
96
73
|
"@applitools/utils": "1.14.1",
|
|
97
|
-
"@types/ws": "8.5.5",
|
|
98
74
|
"abort-controller": "3.0.0",
|
|
99
75
|
"chalk": "4.1.2",
|
|
100
76
|
"node-fetch": "2.6.7",
|
|
101
77
|
"semver": "7.6.2",
|
|
102
|
-
"throat": "6.0.2"
|
|
103
|
-
"webdriver": "7.31.1",
|
|
104
|
-
"ws": "8.17.1",
|
|
105
|
-
"yargs": "17.7.2"
|
|
78
|
+
"throat": "6.0.2"
|
|
106
79
|
},
|
|
107
80
|
"devDependencies": {
|
|
108
81
|
"@applitools/bongo": "^5.10.0",
|
|
109
|
-
"@applitools/
|
|
110
|
-
"@applitools/spec-driver-
|
|
111
|
-
"@applitools/
|
|
112
|
-
"@applitools/test-server": "^1.3.5",
|
|
82
|
+
"@applitools/spec-driver-puppeteer": "^1.7.1",
|
|
83
|
+
"@applitools/spec-driver-selenium": "^1.7.12",
|
|
84
|
+
"@applitools/test-server": "^1.4.0",
|
|
113
85
|
"@applitools/test-utils": "^1.5.17",
|
|
114
|
-
"@applitools/tunnel-client": "^1.11.
|
|
86
|
+
"@applitools/tunnel-client": "^1.11.6",
|
|
115
87
|
"@types/mocha": "^10.0.7",
|
|
116
88
|
"@types/node": "^12.20.55",
|
|
117
89
|
"@types/selenium-webdriver": "^4.1.2",
|
|
118
90
|
"@types/semver": "^7.5.8",
|
|
119
|
-
"@types/yargs": "^17.0.22",
|
|
120
91
|
"chromedriver": "^131.0.5",
|
|
121
92
|
"crypto": "^1.0.1",
|
|
122
93
|
"nock": "^13.3.2",
|
|
@@ -135,7 +106,10 @@
|
|
|
135
106
|
"chromedriver": true,
|
|
136
107
|
"puppeteer": true,
|
|
137
108
|
"ws>bufferutil": false,
|
|
138
|
-
"ws>utf-8-validate": false
|
|
109
|
+
"ws>utf-8-validate": false,
|
|
110
|
+
"@applitools/core-base>@applitools/image>sharp": false,
|
|
111
|
+
"selenium-webdriver>ws>bufferutil": false,
|
|
112
|
+
"selenium-webdriver>ws>utf-8-validate": false
|
|
139
113
|
}
|
|
140
114
|
}
|
|
141
115
|
}
|
|
@@ -5,6 +5,7 @@ type Options = {
|
|
|
5
5
|
client?: NMLClient;
|
|
6
6
|
logger: Logger;
|
|
7
7
|
};
|
|
8
|
+
export declare function clearNMLClients(): void;
|
|
8
9
|
export declare function makeGetNMLClient({ client, logger: mainLogger }: Options): {
|
|
9
10
|
getNMLClient: ({ driver, settings, logger, }: {
|
|
10
11
|
driver: Driver<SpecType>;
|
|
@@ -2,8 +2,9 @@ import type { Region } from '@applitools/utils';
|
|
|
2
2
|
import type { ScreenshotSettings } from '../../classic/types';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
4
|
import { type Driver, type Element, type ElementReference, type Selector, type SpecType } from '@applitools/driver';
|
|
5
|
+
import type { Image } from '@applitools/image';
|
|
5
6
|
export type Screenshot<TSpec extends SpecType> = {
|
|
6
|
-
image:
|
|
7
|
+
image: Image;
|
|
7
8
|
region: Region;
|
|
8
9
|
element: Element<TSpec>;
|
|
9
10
|
scrollingElement: Element<TSpec>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './core';
|
|
3
|
-
export * from './universal/core-server';
|
|
4
|
-
export * from './universal/core-server-process';
|
|
5
3
|
export * from './autonomous/core';
|
|
6
4
|
export { type SpecType, type SpecDriver, type Selector } from '@applitools/driver';
|
|
7
5
|
export * from '@applitools/driver/dist/debug';
|
|
8
6
|
export * as formatters from './utils/format-results';
|
|
9
7
|
export * as logs from './troubleshoot/logs';
|
|
8
|
+
export { checkNetwork } from './troubleshoot/check-network';
|
|
10
9
|
export { MissingApiKeyError } from '@applitools/core-base';
|