@applitools/eyes.cypress
Advanced tools
Comparing version 1.3.7 to 1.4.0
{ | ||
"name": "@applitools/eyes.cypress", | ||
"version": "1.3.7", | ||
"version": "1.4.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"test:min": "mocha --no-timeouts 'tests/render-grid/**/*.test.js'", | ||
"test:mocha": "mocha --no-timeouts 'tests/**/*.test.js'", | ||
@@ -8,0 +9,0 @@ "eslint": "eslint '**/*.js'", |
@@ -15,3 +15,3 @@ /* global Cypress, cy */ | ||
checkWindow(resourceUrls, cdt, tag, sizeMode) { | ||
checkWindow({resourceUrls, cdt, tag, sizeMode}) { | ||
return sendRequest('checkWindow', {resourceUrls, cdt, tag, sizeMode}); | ||
@@ -33,3 +33,11 @@ }, | ||
Cypress.Commands.add('eyesCheckWindow', tag => { | ||
Cypress.Commands.add('eyesCheckWindow', args => { | ||
let tag, sizeMode; | ||
if (typeof args === 'string') { | ||
tag = args; | ||
} else if (typeof args === 'object') { | ||
tag = args.tag; | ||
sizeMode = args.sizeMode; | ||
} | ||
Cypress.log({name: 'Eyes: check window'}); | ||
@@ -39,3 +47,3 @@ return cy.document({log: false}).then(doc => { | ||
const resourceUrls = extractResources(doc); | ||
return EyesServer.checkWindow(resourceUrls, cdt, tag); | ||
return EyesServer.checkWindow({resourceUrls, cdt, tag, sizeMode}); | ||
}); | ||
@@ -42,0 +50,0 @@ }); |
@@ -62,3 +62,3 @@ 'use strict'; | ||
Object.assign(resources, mapValues(cacheEntry, fromCacheToRGridResource)); | ||
} else { | ||
} else if (/^https?:\/\//.test(url)) { | ||
missingResourceUrls.push(url); | ||
@@ -65,0 +65,0 @@ } |
@@ -26,7 +26,11 @@ const EyesWrapper = require('./EyesWrapper'); | ||
}) { | ||
setIsVerbose(showLogs); | ||
const renderPromises = []; | ||
async function checkWindow({resourceUrls, cdt, tag, sizeMode}) { | ||
async function checkWindowJob(renderPromise, prevJobPromise, index) { | ||
const renderId = (await renderPromise)[index]; | ||
const [screenshotUrl] = await waitForRenderedStatus([renderId], renderWrapper); | ||
await prevJobPromise; | ||
results.push(await wrappers[index].checkWindow({screenshotUrl, tag})); | ||
} | ||
async function checkWindow({resourceUrls, cdt, tag, sizeMode}) { | ||
async function checkWindowDo() { | ||
async function startRender() { | ||
const renderInfo = await renderInfoPromise; | ||
@@ -54,25 +58,16 @@ | ||
const screenshotUrls = await waitForRenderedStatus(renderIds, renderWrapper); | ||
return renderIds; | ||
} | ||
if (!screenshotUrls) throw new Error(`no screenshots found for renderIds ${renderIds}`); | ||
/******* checkWindow body start *******/ | ||
return {screenshotUrls, tag}; | ||
} | ||
const renderPromise = checkWindowDo(); | ||
renderPromises.push(renderPromise); | ||
const renderPromise = startRender(); | ||
checkWindowPromises = browsers.map((_browser, i) => | ||
checkWindowJob(renderPromise, checkWindowPromises[i], i), | ||
); | ||
} | ||
async function close() { | ||
const results = []; | ||
for (const renderPromise of renderPromises) { | ||
const {screenshotUrls, tag} = await renderPromise; | ||
for (let i = 0, ii = screenshotUrls.length; i < ii; i++) { | ||
results.push(await wrappers[i].checkWindow({screenshotUrl: screenshotUrls[i], tag})); | ||
} | ||
} | ||
await Promise.all(checkWindowPromises); | ||
await Promise.all(wrappers.map(wrapper => wrapper.close())); | ||
return results; | ||
@@ -95,2 +90,8 @@ } | ||
/******* openEyes body start *******/ | ||
setIsVerbose(showLogs); | ||
let checkWindowPromises = []; | ||
const results = []; | ||
if (!apiKey) { | ||
@@ -97,0 +98,0 @@ throw new Error( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46391
1057