Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/visual-grid-client

Package Overview
Dependencies
Maintainers
12
Versions
574
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/visual-grid-client - npm Package Compare versions

Comparing version 4.0.11 to 4.0.13

src/sdk/openEyesLimitedConcurrency.js

2

package.json
{
"name": "@applitools/visual-grid-client",
"version": "4.0.11",
"version": "4.0.13",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/visual-grid-client.js",

@@ -28,4 +28,5 @@ 'use strict';

renderWrapper,
renderThroat,
}) {
return async function checkWindow({
return function checkWindow({
resourceUrls = [],

@@ -57,2 +58,4 @@ resourceContents = {},

let renderJobs; // This will be an array of `resolve` functions to rendering jobs. See `createRenderJob` below.
setCheckWindowPromises(

@@ -103,2 +106,6 @@ browsers.map((_browser, i) => checkWindowJob(getCheckWindowPromises()[i], i).catch(setError)),

if (renderJobs) {
renderJobs[index]();
}
const wrapper = wrappers[index];

@@ -129,4 +136,15 @@ wrapper.setInferredEnvironment(`useragent:${userAgent}`);

const renderInfo = await renderInfoPromise;
if (getError()) {
logger.log(`aborting startRender because there was an error in getRenderInfo`);
return;
}
const resources = await getResourcesPromise;
if (getError()) {
logger.log(`aborting startRender because there was an error in getAllResources`);
return;
}
const renderRequests = createRenderRequests({

@@ -143,4 +161,6 @@ url,

});
const renderIds = await renderBatch(renderRequests, renderWrapper);
let renderIds = await renderThroat(() => renderBatch(renderRequests, renderWrapper));
renderJobs = renderIds.map(createRenderJob);
if (saveDebugData) {

@@ -164,4 +184,14 @@ for (const renderId of renderIds) {

};
/**
* Run a function down the renderThroat and return a way to resolve it. Once resolved (in another place) it makes room in the throat for the next renders that
*/
function createRenderJob() {
let resolve;
const p = new Promise(res => (resolve = res));
renderThroat(() => p);
return resolve;
}
}
module.exports = makeCheckWindow;

@@ -30,2 +30,3 @@ 'use strict';

'serverUrl',
'concurrency',
];

@@ -38,3 +38,3 @@ 'use strict';

*/
async getRenderInfo() {
getRenderInfo() {
return this._serverConnector.renderInfo();

@@ -54,19 +54,19 @@ }

*/
async renderBatch(renderRequests) {
return await this._renderWindowTask.postRenderBatch(renderRequests);
renderBatch(renderRequests) {
return this._serverConnector.render(renderRequests);
}
async putResource(runningRender, resource) {
return await this._serverConnector.renderPutResource(runningRender, resource);
putResource(runningRender, resource) {
return this._serverConnector.renderPutResource(runningRender, resource);
}
async getRenderStatus(renderId) {
return await this._serverConnector.renderStatusById(renderId);
getRenderStatus(renderId) {
return this._serverConnector.renderStatusById(renderId);
}
async checkWindow({screenshotUrl, tag, domUrl, checkSettings}) {
checkWindow({screenshotUrl, tag, domUrl, checkSettings}) {
const regionProvider = new NullRegionProvider(this.getPromiseFactory()); // TODO receive from outside?
this.screenshotUrl = screenshotUrl;
this.domUrl = domUrl;
return await this.checkWindowBase(regionProvider, tag, false, checkSettings);
return this.checkWindowBase(regionProvider, tag, false, checkSettings);
}

@@ -73,0 +73,0 @@

@@ -16,2 +16,3 @@ 'use strict';

resourceCache,
renderThroat,
}) {

@@ -124,2 +125,3 @@ return async function openEyes({

renderWrapper,
renderThroat,
});

@@ -144,3 +146,3 @@

function disabledFunc(name) {
return () => {
return async () => {
logger.log(`${name}: isDisabled=true, skipping checks`);

@@ -147,0 +149,0 @@ };

'use strict';
const throatPkg = require('throat');
const getBatch = require('./getBatch');

@@ -15,2 +16,3 @@ const createLogger = require('./createLogger');

const makeWaitForTestResults = require('./waitForTestResults');
const makeOpenEyesLimitedConcurrency = require('./openEyesLimitedConcurrency');

@@ -24,3 +26,13 @@ function makeRenderingGridClient({

renderStatusInterval,
concurrency = Infinity,
renderConcurrencyFactor = 5,
}) {
const openEyesConcurrency = Number(getConfig({concurrency}).concurrency);
if (isNaN(openEyesConcurrency)) {
throw new Error('concurrency is not a number');
}
const renderThroat = throatPkg(openEyesConcurrency * renderConcurrencyFactor);
let error;

@@ -54,3 +66,8 @@ const logger = createLogger(showLogs);

resourceCache,
renderThroat,
});
const openEyesLimitedConcurrency = makeOpenEyesLimitedConcurrency(
openEyesWithConfig,
openEyesConcurrency,
);
const waitForTestResults = makeWaitForTestResults({logger, getError});

@@ -63,3 +80,3 @@

return {
openEyes: openEyesWithConfig,
openEyes: openEyesLimitedConcurrency,
waitForTestResults,

@@ -77,3 +94,3 @@ getError,

async function openEyesWithConfig(args) {
function openEyesWithConfig(args) {
const config = getConfig(args);

@@ -80,0 +97,0 @@ return openEyes(config);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc