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

@applitools/eyes.cypress

Package Overview
Dependencies
Maintainers
12
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/eyes.cypress - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

src/cypress/config.js

3

package.json
{
"name": "@applitools/eyes.cypress",
"version": "1.2.5",
"version": "1.3.0",
"main": "index.js",

@@ -30,2 +30,3 @@ "license": "MIT",

"mime-types": "^2.1.18",
"mkdirp": "^0.5.1",
"morgan": "^1.9.0",

@@ -32,0 +33,0 @@ "node-fetch": "^2.1.2"

@@ -9,4 +9,4 @@ /* global fetch, Cypress, cy */

const EyesServer = {
open(url, appName, testName, viewportSize, isVerbose) {
return this._send('open', {url, appName, testName, viewportSize, isVerbose});
open(args) {
return this._send('open', args);
},

@@ -22,14 +22,22 @@

_send: function() {
return send
.apply(this, arguments)
.then(resp => resp.text())
.then(text => console.log('server answered', text));
_send: function(command, data) {
let resp;
return send(command, data)
.then(_resp => {
resp = _resp;
return resp.text();
})
.then(text => {
if (resp.status === 500) {
return Promise.reject(text);
}
});
},
};
Cypress.Commands.add('eyesOpen', (appName, testName, viewportSize, isVerbose) => {
Cypress.Commands.add('eyesOpen', (args = {}) => {
Cypress.log({name: 'Eyes: open'});
return cy.window({log: false}).then(win => {
return EyesServer.open(win.location.href, appName, testName, viewportSize, isVerbose);
const openArgs = Object.assign({url: win.location.href}, args);
return EyesServer.open(openArgs);
});

@@ -41,5 +49,4 @@ });

return cy.document({log: false}).then({timeout: timeout || 60000}, doc => {
const {documentElement} = doc;
const cdt = domNodesToCdt([documentElement]);
const resourceUrls = extractResources(documentElement);
const cdt = domNodesToCdt(doc);
const resourceUrls = extractResources(doc);
return EyesServer.checkWindow(resourceUrls, cdt, tag);

@@ -46,0 +53,0 @@ });

@@ -8,2 +8,3 @@ require('dotenv').config();

const {promisify: p} = require('util');
const {initConfig} = require('./config');

@@ -13,6 +14,3 @@ /*****************************/

/*****************************/
const apiKey = process.env.APPLITOOLS_API_KEY;
if (!apiKey) {
throw new Error('APPLITOOLS_API_KEY env variable is not defined');
}
const getConfig = initConfig(process.cwd());

@@ -25,6 +23,7 @@ /*****************************/

const eyesCommands = {
open: async ({url, appName, testName, viewportSize, isVerbose}) => {
const eyes = await openEyes({apiKey, url, appName, testName, viewportSize, isVerbose});
checkWindow = eyes.checkWindow.bind(eyes);
close = eyes.close.bind(eyes);
open: async args => {
const config = Object.assign(getConfig(args));
const eyes = await openEyes(config);
checkWindow = eyes.checkWindow;
close = eyes.close;
},

@@ -78,3 +77,4 @@

console.error('error in eyes api:', ex);
res.sendStatus(500);
console.log(ex.message);
res.status(500).send(ex.message);
}

@@ -81,0 +81,0 @@ });

@@ -9,3 +9,3 @@ /* eslint-disable no-use-before-define */

function domNodesToCdt(elementNodes) {
function domNodesToCdt(docNode) {
const domNodes = [

@@ -16,3 +16,3 @@ {

];
domNodes[0].childNodeIndexes = childrenFactory(domNodes, elementNodes);
domNodes[0].childNodeIndexes = childrenFactory(domNodes, docNode.childNodes);
return domNodes;

@@ -55,6 +55,6 @@ }

};
} else if (nodeType === NODE_TYPES.DOCUMENT) {
} else if (nodeType === NODE_TYPES.DOCUMENT_TYPE) {
node = {
nodeType: NODE_TYPES.DOCUMENT_TYPE,
nodeName: 'HTML',
nodeName: elementNode.nodeName,
};

@@ -61,0 +61,0 @@ }

@@ -44,3 +44,3 @@ const {

async getRenderInfo() {
return await this._serverConnector.renderInfo();
return this._serverConnector.renderInfo();
}

@@ -47,0 +47,0 @@

@@ -49,2 +49,4 @@ const EyesWrapper = require('./EyesWrapper');

if (!screenshotUrls) throw new Error(`no screenshots found for renderIds ${renderIds}`);
return {screenshotUrls, tag};

@@ -81,2 +83,6 @@ }

if (!apiKey) {
throw new Error('APPLITOOLS_API_KEY env variable is not defined');
}
const viewportSizes = Array.isArray(viewportSize) ? viewportSize : [viewportSize];

@@ -83,0 +89,0 @@ if (!wrappers) {

@@ -7,12 +7,15 @@ 'use strict';

const {renderDomNodesToHtml, createAbsolutizedDomNodes, getResourceName} = require('./cdt');
const getFolderName = require('./getFolderName');
const {mapValues} = require('lodash');
const _mkdirp = require('mkdirp');
const writeFile = p(fs.writeFile);
const mkdir = p(fs.mkdir);
const mkdirp = p(_mkdirp);
async function saveData({renderId, cdt, resources, url}) {
log(`saving data for renderId=${renderId}`);
const path = resolve(__dirname, '../../../.applitools', renderId); // TODO production path
const folderName = getFolderName(renderId, new Date());
const path = resolve(process.cwd(), '.applitools', folderName);
try {
await mkdir(path);
await mkdirp(path);
} catch (ex) {

@@ -19,0 +22,0 @@ log(`${path} already exists`);

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