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.3.0 to 1.3.1

src/render-grid/sdk/renderBatch.js

2

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

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -30,5 +30,28 @@ # Eyes.Cypress

## Usage
After completing all of the above, you will be able to use the following commands to take screenshots during tests and use Applitools Eyes to manage them:
### Open
After completing all of the above, you will be able to use commands from `eyes.cypress` in your cypress tests to take screenshots and use Applitools Eyes to manage them:
### Example
```
describe('Hello world', () => {
it('', () => {
cy.visit('https://applitools.com/helloworld');
cy.eyesOpen({
appName: 'Hello World!',
testName: 'My first JavaScript test!',
viewportSize: { width: 800, height: 600 },
});
cy.eyesCheckWindow('Main Page');
cy.get('button').click();
cy.eyesCheckWindow('Click!');
cy.eyesClose();
});
});
```
Note: don't forget to set the `APPLITOOLS_API_KEY` environment variable.
### Commands
Here's an overview of the available commands:
##### Open
This will start a session with the Applitools server. It should be called for each test, so that all screenshots for each test are grouped together.

@@ -39,3 +62,3 @@ ```

### Check window
##### Check window
This will take a screenshot of your application at the moment of calling, and upload it to Applitools Eyes for matcing against the baseline.

@@ -46,3 +69,3 @@ ```

### Close
##### Close
This will close the session that was started with the `eyesOpen` call. It is important to call this at the end (or `after()`) each test, symmetrically to `eyesOpen`.

@@ -49,0 +72,0 @@ ```

'use strict';
/**
* For this function to be testable via puppeteer, it should be seriablizable. So all utility functions are written as closures and there are no external imports
* @param {HTMLElement} el the root element from under which DOM tree to extract resources
*/
function extractResources(el) {

@@ -35,3 +39,5 @@ function extractResourcesFromStyleSheet(styleSheet) {

const srcUrls = [...el.querySelectorAll('img[src]')].map(srcEl => srcEl.getAttribute('src'));
const srcUrls = [...el.querySelectorAll('img[src],source[src]')].map(srcEl =>
srcEl.getAttribute('src'),
);

@@ -42,14 +48,16 @@ const cssUrls = [...el.querySelectorAll('link[rel="stylesheet"]')].map(link =>

const videoPosterUrls = [...el.querySelectorAll('video[poster]')].map(videoEl =>
videoEl.getAttribute('poster'),
);
const urlsFromStyleElements = [...el.getElementsByTagName('style')]
.map(styleEl => styleEl.sheet)
.reduce((acc, curr) => {
console.log('acc', acc);
const resourceUrls = extractResourcesFromStyleSheet(curr);
console.log('resources', resourceUrls);
return acc.concat(resourceUrls);
}, []);
return uniq([...srcUrls, ...cssUrls, ...urlsFromStyleElements]);
return uniq([...srcUrls, ...cssUrls, ...urlsFromStyleElements, ...videoPosterUrls]);
}
module.exports = extractResources;

@@ -59,6 +59,9 @@ const {

async renderBatch(renderRequests) {
const runningRenders = await this._renderWindowTask.postRenderBatch(renderRequests);
return runningRenders.map(rr => rr.getRenderId());
return await this._renderWindowTask.postRenderBatch(renderRequests);
}
async putResources(rGridDom, runningRender) {
return await this._renderWindowTask.putResources(rGridDom, runningRender);
}
async getRenderStatus(renderId) {

@@ -65,0 +68,0 @@ return await this._serverConnector.renderStatusById(renderId);

@@ -8,2 +8,3 @@ const EyesWrapper = require('./EyesWrapper');

const createRenderRequests = require('./createRenderRequests');
const renderBatch = require('./renderBatch');

@@ -40,3 +41,3 @@ let batchInfo;

});
const renderIds = await renderWrapper.renderBatch(renderRequests);
const renderIds = await renderBatch(renderRequests, renderWrapper);

@@ -43,0 +44,0 @@ if (saveDebugData) {

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