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 3.0.4 to 3.0.5

2

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

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

@@ -95,2 +95,34 @@ # Eyes.Cypress

### Best practice for using the SDK
Every call to `cy.eyesOpen` and `cy.eyesClose` defines a test in Applitool Eyes, and all the calls to `cy.eyesCheckWindow` between them are called "steps". In order to get a test structure in Applitools that corresponds to the test structure in Cypress, it's best to open/close tests in every `it` call. This can be done via the `beforeEach` and `afterEach` functions that Cypress provides (via the mocha test runner).
After adjusting the example above, this becomes:
```js
describe('Hello world', () => {
beforEach(() => {
cy.eyesOpen({
appName: 'Hello World!',
testName: 'My first JavaScript test!',
browser: { width: 800, height: 600 },
});
});
afterEach(() => {
cy.eyesClose();
});
it('works', () => {
cy.visit('https://applitools.com/helloworld');
cy.eyesCheckWindow('Main Page');
cy.get('button').click();
cy.eyesCheckWindow('Click!');
});
});
```
Applitools will take screenshots and perform the visual comparisons in the background. Performance of the tests will not be affected during the test run, but there will be a small phase at the end of the test run that waits for visual tests to end.
**Note**: In Cypress interactive mode (`cypress open`) there is a bug that exceptions in root level `after` statements don't appear in the UI. They still appear in the browser's console, and considered failures in `cypress run`. See [this issue](https://github.com/cypress-io/cypress/issues/2296) for more information and tracking.
### Commands

@@ -254,36 +286,4 @@

### Plugin port
The Eyes.Cypress SDK has 2 parts: (1) a cypress plugin, and (2) custom commands that run in the browser. The SDK uses a local server for communication between those 2 parts. The plugin is responsible for starting the server, and the custom commands send requests to this server operate the SDK.
By default, the server listens at port `7373` , but that may be altered for cases where this port is already taken.
#### Option 1: Default port
When configuring the plugin as described in the section 'Configure Eyes.Cypress plugin' above, the port that will be used is `7373`:
```js
require('@applitools/eyes.cypress')(module)
```
#### Option 2: Custom port
In some cases, the `7373` port might be unavailable, so in order to use a different port, you may do the following:
```js
require('@applitools/eyes.cypress')(module, { port: 8484 })
```
#### Option 3: Available port
If you want to be absolutely sure that Eyes.Cypress will use an available port, it's also possible to pass `0` as the port:
```js
require('@applitools/eyes.cypress')({ port: 0 });
```
Now it is guaranteed that `eyesPort` is available.
## Troubleshooting
If issues occur, the `saveDebugData` config property can be set to true in order to save helpful information. The information will be saved under a folder named `.applitools` in the current working directory. This could be then used for getting support on your issue.

@@ -6,4 +6,3 @@ /* global Cypress,cy,window,before,after */

const makeSend = require('./makeSend');
const port = Cypress.config('eyesPort') || require('./plugin/defaultPort');
const send = makeSend(port, cy.request);
const send = makeSend(Cypress.config('eyesPort'), cy.request);
const captureFrame = require('@applitools/dom-capture/src/captureFrame');

@@ -10,0 +9,0 @@ const defaultDomProps = require('@applitools/dom-capture/src/defaultDomProps');

'use strict';
function makePluginExport({eyesPort, getEyesPort, setEyesPort, closeEyes}) {
return function pluginExport(pluginModule, {port = eyesPort} = {}) {
function makePluginExport({getEyesPort, closeEyes}) {
return function pluginExport(pluginModule) {
const pluginModuleExports = pluginModule.exports;

@@ -11,3 +11,2 @@ pluginModule.exports = async (...args) => {

};
setEyesPort(port);
return {

@@ -14,0 +13,0 @@ getEyesPort,

@@ -25,7 +25,4 @@ 'use strict';

let eyesPort = require('./defaultPort');
const pluginExport = makePluginExport({
eyesPort,
getEyesPort,
setEyesPort,
closeEyes,

@@ -37,6 +34,2 @@ });

function setEyesPort(port) {
eyesPort = port;
}
async function getEyesPort() {

@@ -64,5 +57,5 @@ let port;

.then(() => {
logger.log(`starting plugin at port ${eyesPort}`);
server = app.listen(eyesPort, () => {
logger.log(`server running at port: ${server.address().port}`);
logger.log(`starting plugin server`);
server = app.listen(0, () => {
logger.log(`plugin server running at port: ${server.address().port}`);
});

@@ -73,3 +66,5 @@

logger.log(
`error: plugin server could not start at port ${eyesPort}: port is already in use.`,
`error: plugin server could not start at port ${
server.address().port
}: port is already in use.`,
);

@@ -76,0 +71,0 @@ } else {

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