@applitools/eyes-sdk-core
Advanced tools
Comparing version 5.10.0 to 5.11.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [5.11.0](https://github.com/applitools/eyes.sdk.javascript1/compare/@applitools/eyes-sdk-core@5.10.0...@applitools/eyes-sdk-core@5.11.0) (2019-06-30) | ||
### Features | ||
* add source (current url) to MatchWindowData.Options ([1989824](https://github.com/applitools/eyes.sdk.javascript1/commit/1989824)) | ||
# [5.10.0](https://github.com/applitools/eyes.sdk.javascript1/compare/@applitools/eyes-sdk-core@5.9.3...@applitools/eyes-sdk-core@5.10.0) (2019-06-24) | ||
@@ -8,0 +19,0 @@ |
@@ -546,6 +546,7 @@ 'use strict'; | ||
* @param {CheckSettings} [checkSettings] - The settings to use. | ||
* @param {string} [source] - The tested source page. | ||
* @return {Promise<MatchResult>} - The result of matching the output with the expected output. | ||
* @throws DiffsFoundError - Thrown if a mismatch is detected and immediate failure reports are enabled. | ||
*/ | ||
async checkWindowBase(regionProvider, tag = '', ignoreMismatch = false, checkSettings = new CheckSettings(USE_DEFAULT_TIMEOUT)) { | ||
async checkWindowBase(regionProvider, tag = '', ignoreMismatch = false, checkSettings = new CheckSettings(USE_DEFAULT_TIMEOUT), source) { | ||
if (this._configuration.getIsDisabled()) { | ||
@@ -571,3 +572,3 @@ this._logger.verbose('Ignored'); | ||
await this._sessionEventHandlers.validationWillStart(this._autSessionId, validationInfo); | ||
const matchResult = await EyesBase.matchWindow(regionProvider, tag, ignoreMismatch, checkSettings, this); | ||
const matchResult = await EyesBase.matchWindow(regionProvider, tag, ignoreMismatch, checkSettings, this, undefined, source); | ||
await this.afterMatchWindow(); | ||
@@ -747,5 +748,6 @@ | ||
* @param {boolean} [skipStartingSession=false] | ||
* @param {string} [source] | ||
* @return {Promise<MatchResult>} | ||
*/ | ||
static async matchWindow(regionProvider, tag, ignoreMismatch, checkSettings, self, skipStartingSession = false) { | ||
static async matchWindow(regionProvider, tag, ignoreMismatch, checkSettings, self, skipStartingSession = false, source) { | ||
let retryTimeout = -1; | ||
@@ -769,3 +771,3 @@ | ||
self.getUserInputs(), region, tag, self._shouldMatchWindowRunOnceOnTimeout, | ||
ignoreMismatch, checkSettings, retryTimeout | ||
ignoreMismatch, checkSettings, retryTimeout, source | ||
); | ||
@@ -772,0 +774,0 @@ } |
@@ -24,5 +24,6 @@ 'use strict'; | ||
* match. | ||
* @param {ImageMatchSettings} imageMatchSettings | ||
* @param {ImageMatchSettings} imageMatchSettings - Settings specifying how the server should compare the image. | ||
* @param {string} source | ||
*/ | ||
constructor({ name, renderId, userInputs, ignoreMismatch, ignoreMatch, forceMismatch, forceMatch, imageMatchSettings } = {}) { | ||
constructor({ name, renderId, userInputs, ignoreMismatch, ignoreMatch, forceMismatch, forceMatch, imageMatchSettings, source } = {}) { | ||
if (arguments.length > 1) { | ||
@@ -42,2 +43,3 @@ throw new TypeError('Please, use object as a parameter to the constructor!'); | ||
this._imageMatchSettings = imageMatchSettings; | ||
this._source = source; | ||
} | ||
@@ -109,3 +111,11 @@ | ||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @return {string} | ||
*/ | ||
getSource() { | ||
return this._source; | ||
} | ||
/** | ||
* @override | ||
@@ -112,0 +122,0 @@ */ |
@@ -54,7 +54,8 @@ 'use strict'; | ||
* @param {ImageMatchSettings} imageMatchSettings - The settings to use. | ||
* @param {string} source | ||
* @return {Promise<MatchResult>} - The match result. | ||
*/ | ||
async performMatch(userInputs, appOutput, name, renderId, ignoreMismatch, imageMatchSettings) { | ||
async performMatch(userInputs, appOutput, name, renderId, ignoreMismatch, imageMatchSettings, source) { | ||
// Prepare match model. | ||
const options = new Options({ name, renderId, userInputs, ignoreMismatch, ignoreMatch: false, forceMismatch: false, forceMatch: false, imageMatchSettings }); | ||
const options = new Options({ name, renderId, userInputs, ignoreMismatch, ignoreMatch: false, forceMismatch: false, forceMatch: false, imageMatchSettings, source }); | ||
const data = new MatchWindowData({ userInputs, appOutput: appOutput.getAppOutput(), tag: name, ignoreMismatch, options }); | ||
@@ -179,5 +180,6 @@ // Perform match. | ||
* default retry timeout. | ||
* @param {string} [source] | ||
* @return {Promise<MatchResult>} - Returns the results of the match | ||
*/ | ||
async matchWindow(userInputs, region, tag, shouldRunOnceOnTimeout, ignoreMismatch, checkSettings, retryTimeout) { | ||
async matchWindow(userInputs, region, tag, shouldRunOnceOnTimeout, ignoreMismatch, checkSettings, retryTimeout, source) { | ||
ArgumentGuard.notNull(userInputs, 'userInputs'); | ||
@@ -196,3 +198,3 @@ ArgumentGuard.notNull(region, 'region'); | ||
this._logger.verbose(`retryTimeout = ${retryTimeout}`); | ||
const screenshot = await this._takeScreenshot(userInputs, region, tag, shouldRunOnceOnTimeout, ignoreMismatch, checkSettings, retryTimeout); | ||
const screenshot = await this._takeScreenshot(userInputs, region, tag, shouldRunOnceOnTimeout, ignoreMismatch, checkSettings, retryTimeout, source); | ||
if (ignoreMismatch) { | ||
@@ -216,5 +218,6 @@ return this._matchResult; | ||
* @param {number} retryTimeout | ||
* @param {string} source | ||
* @return {Promise<EyesScreenshot>} | ||
*/ | ||
async _takeScreenshot(userInputs, region, tag, shouldRunOnceOnTimeout, ignoreMismatch, checkSettings, retryTimeout) { | ||
async _takeScreenshot(userInputs, region, tag, shouldRunOnceOnTimeout, ignoreMismatch, checkSettings, retryTimeout, source) { | ||
const timeStart = PerformanceUtils.start(); | ||
@@ -229,3 +232,3 @@ | ||
screenshot = await this._tryTakeScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings); | ||
screenshot = await this._tryTakeScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings, source); | ||
} else { | ||
@@ -247,5 +250,6 @@ screenshot = await this._retryTakingScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout); | ||
* @param {number} retryTimeout | ||
* @param {string} source | ||
* @return {Promise<EyesScreenshot>} | ||
*/ | ||
async _retryTakingScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout) { | ||
async _retryTakingScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout, source) { | ||
const start = Date.now(); // Start the retry timer. | ||
@@ -255,7 +259,7 @@ const retry = Date.now() - start; | ||
// The match retry loop. | ||
const screenshot = await this._takingScreenshotLoop(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout, retry, start); | ||
const screenshot = await this._takingScreenshotLoop(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout, retry, start, source); | ||
// if we're here because we haven't found a match yet, try once more | ||
if (!this._matchResult.getAsExpected()) { | ||
return this._tryTakeScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings); | ||
return this._tryTakeScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings, source); | ||
} | ||
@@ -276,5 +280,6 @@ return screenshot; | ||
* @param {EyesScreenshot} [screenshot] | ||
* @param {string} [source] | ||
* @return {Promise<EyesScreenshot>} | ||
*/ | ||
async _takingScreenshotLoop(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout, retry, start, screenshot) { | ||
async _takingScreenshotLoop(userInputs, region, tag, ignoreMismatch, checkSettings, retryTimeout, retry, start, screenshot, source) { | ||
if (retry >= retryTimeout) { | ||
@@ -286,3 +291,3 @@ return screenshot; | ||
const newScreenshot = await this._tryTakeScreenshot(userInputs, region, tag, true, checkSettings); | ||
const newScreenshot = await this._tryTakeScreenshot(userInputs, region, tag, true, checkSettings, source); | ||
@@ -303,5 +308,6 @@ if (this._matchResult.getAsExpected()) { | ||
* @param {CheckSettings} checkSettings | ||
* @param {string} source | ||
* @return {Promise<EyesScreenshot>} | ||
*/ | ||
async _tryTakeScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings) { | ||
async _tryTakeScreenshot(userInputs, region, tag, ignoreMismatch, checkSettings, source) { | ||
const appOutput = await this._appOutputProvider.getAppOutput(region, this._lastScreenshot, checkSettings); | ||
@@ -311,3 +317,3 @@ const renderId = checkSettings.getRenderId(); | ||
const matchSettings = await this.createImageMatchSettings(checkSettings, screenshot); | ||
this._matchResult = await this.performMatch(userInputs, appOutput, tag, renderId, ignoreMismatch, matchSettings); | ||
this._matchResult = await this.performMatch(userInputs, appOutput, tag, renderId, ignoreMismatch, matchSettings, source); | ||
return screenshot; | ||
@@ -314,0 +320,0 @@ } |
{ | ||
"name": "@applitools/eyes-sdk-core", | ||
"version": "5.10.0", | ||
"version": "5.11.0", | ||
"description": "The core components of Eyes JavaScript SDK", | ||
@@ -49,3 +49,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "aa1eed8c7e2aa2a7083a5f6e5c7fa252e27f5578" | ||
"gitHead": "f1eb9fc075a19ea50eb4d840fca29ea39eaffa67" | ||
} |
371208
10659