@applitools/eyes-sdk-core
Advanced tools
Comparing version 5.19.0 to 5.20.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [5.20.0](https://github.com/applitools/eyes.sdk.javascript1/compare/@applitools/eyes-sdk-core@5.19.0...@applitools/eyes-sdk-core@5.20.0) (2019-10-06) | ||
### Bug Fixes | ||
* **visual-grid-client, eyes-common, eyes-sdk-core, eyes-selenium:** renamed setAccessibilityLevel to setAccessibilityValidation ([77d60e8](https://github.com/applitools/eyes.sdk.javascript1/commit/77d60e8)) | ||
### Features | ||
* **eyes-common:** move BrowserType, DeviceName, ScreenOrientation, StitchMode to common module ([7dbdb41](https://github.com/applitools/eyes.sdk.javascript1/commit/7dbdb41)) | ||
# [5.19.0](https://github.com/applitools/eyes.sdk.javascript1/compare/@applitools/eyes-sdk-core@5.18.1...@applitools/eyes-sdk-core@5.19.0) (2019-10-02) | ||
@@ -8,0 +24,0 @@ |
45
index.js
@@ -69,3 +69,2 @@ 'use strict'; | ||
exports.EmulationDevice = require('./lib/renderer/EmulationDevice').EmulationDevice; | ||
exports.ScreenOrientation = require('./lib/renderer/ScreenOrientation').ScreenOrientation; | ||
@@ -106,14 +105,24 @@ exports.ContextBasedScaleProvider = require('./lib/scaling/ContextBasedScaleProvider').ContextBasedScaleProvider; | ||
// Classes from eyes-common which may be used as part of public API | ||
exports.EyesError = common.EyesError; | ||
exports.Configuration = common.Configuration; | ||
exports.PropertyData = common.PropertyData; | ||
exports.ProxySettings = common.ProxySettings; | ||
exports.AccessibilityLevel = common.AccessibilityLevel; | ||
exports.AccessibilityMatchSettings = common.AccessibilityMatchSettings; | ||
exports.AccessibilityRegionType = common.AccessibilityRegionType; | ||
exports.AccessibilityMatchSettings = common.AccessibilityMatchSettings; | ||
exports.BatchInfo = common.BatchInfo; | ||
exports.MatchLevel = common.MatchLevel; | ||
exports.ImageMatchSettings = common.ImageMatchSettings; | ||
exports.BrowserType = common.BrowserType; | ||
exports.Configuration = common.Configuration; | ||
exports.DeviceName = common.DeviceName; | ||
exports.ExactMatchSettings = common.ExactMatchSettings; | ||
exports.FloatingMatchSettings = common.FloatingMatchSettings; | ||
exports.ImageMatchSettings = common.ImageMatchSettings; | ||
exports.MatchLevel = common.MatchLevel; | ||
exports.PropertyData = common.PropertyData; | ||
exports.ProxySettings = common.ProxySettings; | ||
exports.ScreenOrientation = common.ScreenOrientation; | ||
exports.StitchMode = common.StitchMode; | ||
exports.DebugScreenshotsProvider = common.DebugScreenshotsProvider; | ||
exports.FileDebugScreenshotsProvider = common.FileDebugScreenshotsProvider; | ||
exports.NullDebugScreenshotProvider = common.NullDebugScreenshotProvider; | ||
exports.EyesError = common.EyesError; | ||
exports.CoordinatesType = common.CoordinatesType; | ||
@@ -123,20 +132,22 @@ exports.Location = common.Location; | ||
exports.Region = common.Region; | ||
exports.PropertyHandler = common.PropertyHandler; | ||
exports.ReadOnlyPropertyHandler = common.ReadOnlyPropertyHandler; | ||
exports.SimplePropertyHandler = common.SimplePropertyHandler; | ||
exports.ImageDeltaCompressor = common.ImageDeltaCompressor; | ||
exports.MutableImage = common.MutableImage; | ||
exports.ConsoleLogHandler = common.ConsoleLogHandler; | ||
exports.DebugLogHandler = common.DebugLogHandler; | ||
exports.FileLogHandler = common.FileLogHandler; | ||
exports.Logger = common.Logger; | ||
exports.LogHandler = common.LogHandler; | ||
exports.ConsoleLogHandler = common.ConsoleLogHandler; | ||
exports.FileLogHandler = common.FileLogHandler; | ||
exports.NullLogHandler = common.NullLogHandler; | ||
exports.DebugScreenshotsProvider = common.DebugScreenshotsProvider; | ||
exports.FileDebugScreenshotsProvider = common.FileDebugScreenshotsProvider; | ||
exports.NullDebugScreenshotProvider = common.NullDebugScreenshotProvider; | ||
exports.PropertyHandler = common.PropertyHandler; | ||
exports.ReadOnlyPropertyHandler = common.ReadOnlyPropertyHandler; | ||
exports.SimplePropertyHandler = common.SimplePropertyHandler; | ||
// Classes which can be used internally, but should not be exported from final SDKs | ||
exports.ImageDeltaCompressor = common.ImageDeltaCompressor; | ||
exports.BrowserNames = common.BrowserNames; | ||
exports.OSNames = common.OSNames; | ||
exports.UserAgent = common.UserAgent; | ||
exports.ArgumentGuard = common.ArgumentGuard; | ||
@@ -143,0 +154,0 @@ exports.ConfigUtils = common.ConfigUtils; |
@@ -25,3 +25,3 @@ 'use strict'; | ||
async getRegion(eyesBase, screenshot) { // eslint-disable-line no-unused-vars | ||
return new AccessibilityMatchSettings({ | ||
const accessibilityRegion = new AccessibilityMatchSettings({ | ||
left: this._rect.getLeft(), | ||
@@ -33,2 +33,3 @@ top: this._rect.getTop(), | ||
}); | ||
return [accessibilityRegion]; | ||
} | ||
@@ -35,0 +36,0 @@ } |
@@ -186,3 +186,3 @@ 'use strict'; | ||
*/ | ||
accessibilityLevel(accessibilityLevel) { | ||
accessibilityValidation(accessibilityLevel) { | ||
this._accessibilityLevel = accessibilityLevel; | ||
@@ -196,3 +196,3 @@ return this; | ||
*/ | ||
getAccessibilityLevel() { | ||
getAccessibilityValidation() { | ||
return this._accessibilityLevel; | ||
@@ -199,0 +199,0 @@ } |
@@ -31,3 +31,3 @@ 'use strict'; | ||
async getRegion(eyesBase, screenshot) { // eslint-disable-line no-unused-vars | ||
return new FloatingMatchSettings({ | ||
const floatingRegion = new FloatingMatchSettings({ | ||
left: this._rect.getLeft(), | ||
@@ -42,2 +42,3 @@ top: this._rect.getTop(), | ||
}); | ||
return [floatingRegion]; | ||
} | ||
@@ -44,0 +45,0 @@ } |
@@ -14,3 +14,3 @@ 'use strict'; | ||
* @param {EyesScreenshot} screenshot | ||
* @return {Promise<AccessibilityMatchSettings>} | ||
* @return {Promise<AccessibilityMatchSettings[]>} | ||
*/ | ||
@@ -17,0 +17,0 @@ async getRegion(eyesBase, screenshot) { |
@@ -14,3 +14,3 @@ 'use strict'; | ||
* @param {EyesScreenshot} screenshot | ||
* @return {Promise<FloatingMatchSettings>} | ||
* @return {Promise<FloatingMatchSettings[]>} | ||
*/ | ||
@@ -17,0 +17,0 @@ async getRegion(eyesBase, screenshot) { |
@@ -20,3 +20,3 @@ 'use strict'; | ||
* @param {EyesScreenshot} screenshot | ||
* @return {Promise<Region>} | ||
* @return {Promise<Region[]>} | ||
*/ | ||
@@ -23,0 +23,0 @@ async getRegion(eyesBase, screenshot) { |
@@ -21,3 +21,3 @@ 'use strict'; | ||
async getRegion(eyesBase, screenshot) { // eslint-disable-line no-unused-vars | ||
return this._region; | ||
return [this._region]; | ||
} | ||
@@ -24,0 +24,0 @@ } |
@@ -66,37 +66,18 @@ 'use strict'; | ||
/** | ||
* @param {CheckSettings} checkSettings | ||
* @param {ImageMatchSettings} imageMatchSettings | ||
* @param {GetRegion[]|GetFloatingRegion[]|GetAccessibilityRegion[]} regionProviders | ||
* @param {EyesScreenshot} screenshot | ||
* @return {Promise} | ||
* @return {Promise<Region[]|FloatingMatchSettings[]|AccessibilityMatchSettings[]>} | ||
*/ | ||
async _collectSimpleRegions(checkSettings, imageMatchSettings, screenshot) { | ||
const ignoreRegions = await this._collectRegions(checkSettings.getIgnoreRegions(), screenshot); | ||
imageMatchSettings.setIgnoreRegions(ignoreRegions); | ||
const layoutRegions = await this._collectRegions(checkSettings.getLayoutRegions(), screenshot); | ||
imageMatchSettings.setLayoutRegions(layoutRegions); | ||
const strictRegions = await this._collectRegions(checkSettings.getStrictRegions(), screenshot); | ||
imageMatchSettings.setStrictRegions(strictRegions); | ||
const contentRegions = await this._collectRegions(checkSettings.getContentRegions(), screenshot); | ||
imageMatchSettings.setContentRegions(contentRegions); | ||
} | ||
/** | ||
* @param {GetRegion[]} regionProviders | ||
* @param {EyesScreenshot} screenshot | ||
* @return {Promise<Region[]>} | ||
*/ | ||
async _collectRegions(regionProviders, screenshot) { | ||
async _getTotalRegions(regionProviders, screenshot) { | ||
const eyes = this._eyes; | ||
const regionsPromises = []; | ||
regionProviders.forEach((regionProvider) => { | ||
const totalRegions = []; | ||
for (let i = 0; i < regionProviders.length; i += 1) { | ||
try { | ||
regionsPromises.push(regionProvider.getRegion(eyes, screenshot)); | ||
const regions = await regionProviders[i].getRegion(eyes, screenshot); | ||
totalRegions.push(...regions); | ||
} catch (e) { | ||
eyes.log('WARNING - region was out of bounds.', e); | ||
} | ||
}); | ||
return Promise.all(regionsPromises); | ||
} | ||
return totalRegions; | ||
} | ||
@@ -110,13 +91,20 @@ | ||
*/ | ||
async _collectCustomRegions(checkSettings, imageMatchSettings, screenshot) { | ||
const eyes = this._eyes; | ||
const floatingPromises = checkSettings.getFloatingRegions() | ||
.map(container => container.getRegion(eyes, screenshot)); | ||
const accessibilityPromises = checkSettings.getAccessibilityRegions() | ||
.map(container => container.getRegion(eyes, screenshot)); | ||
async _collectRegions(checkSettings, imageMatchSettings, screenshot) { | ||
const ignoreRegions = await this._getTotalRegions(checkSettings.getIgnoreRegions(), screenshot); | ||
imageMatchSettings.setIgnoreRegions(ignoreRegions); | ||
const floatingPromise = Promise.all(floatingPromises).then(fr => imageMatchSettings.setFloatingRegions(fr)); | ||
const accessibilityPromise = Promise.all(accessibilityPromises).then(ar => imageMatchSettings.setAccessibilityRegions(ar)); | ||
const layoutRegions = await this._getTotalRegions(checkSettings.getLayoutRegions(), screenshot); | ||
imageMatchSettings.setLayoutRegions(layoutRegions); | ||
await Promise.all([floatingPromise, accessibilityPromise]); | ||
const strictRegions = await this._getTotalRegions(checkSettings.getStrictRegions(), screenshot); | ||
imageMatchSettings.setStrictRegions(strictRegions); | ||
const contentRegions = await this._getTotalRegions(checkSettings.getContentRegions(), screenshot); | ||
imageMatchSettings.setContentRegions(contentRegions); | ||
const floatingRegions = await this._getTotalRegions(checkSettings.getFloatingRegions(), screenshot); | ||
imageMatchSettings.setFloatingRegions(floatingRegions); | ||
const accessibilityRegions = await this._getTotalRegions(checkSettings.getAccessibilityRegions(), screenshot); | ||
imageMatchSettings.setAccessibilityRegions(accessibilityRegions); | ||
} | ||
@@ -138,5 +126,5 @@ | ||
let accessibilityLevel = checkSettings.getAccessibilityLevel(); | ||
let accessibilityLevel = checkSettings.getAccessibilityValidation(); | ||
if (TypeUtils.isNull(accessibilityLevel)) { | ||
accessibilityLevel = this._eyes.getDefaultMatchSettings().getAccessibilityLevel(); | ||
accessibilityLevel = this._eyes.getDefaultMatchSettings().getAccessibilityValidation(); | ||
} | ||
@@ -174,4 +162,3 @@ | ||
await this._collectSimpleRegions(checkSettings, imageMatchSettings, screenshot); | ||
await this._collectCustomRegions(checkSettings, imageMatchSettings, screenshot); | ||
await this._collectRegions(checkSettings, imageMatchSettings, screenshot); | ||
} | ||
@@ -178,0 +165,0 @@ return imageMatchSettings; |
{ | ||
"name": "@applitools/eyes-sdk-core", | ||
"version": "5.19.0", | ||
"version": "5.20.0", | ||
"description": "The core components of Eyes JavaScript SDK", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@applitools/eyes-common": "^3.10.3", | ||
"@applitools/eyes-common": "^3.11.0", | ||
"axios": "^0.19.0", | ||
@@ -50,3 +50,3 @@ "es6-promise-pool": "^2.5.0" | ||
}, | ||
"gitHead": "c86f37902a48aa76a9ae020ca64bede49cf9765d" | ||
"gitHead": "ba0801340fa74a759ba6340ffe56ba458f641eda" | ||
} |
387353
97
10917