@applitools/eyes.cypress
Advanced tools
Comparing version 3.0.13 to 3.0.14
{ | ||
"name": "@applitools/eyes.cypress", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"main": "index.js", | ||
@@ -35,4 +35,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@applitools/dom-capture": "^2.0.0", | ||
"@applitools/visual-grid-client": "^4.2.4", | ||
"@applitools/dom-capture": "^2.0.1", | ||
"@applitools/visual-grid-client": "^4.2.6", | ||
"body-parser": "1.18.2", | ||
@@ -47,3 +47,3 @@ "cors": "^2.8.4", | ||
"cypress": "^3.1.0", | ||
"eslint": "^5.3.0", | ||
"eslint": "^5.5.0", | ||
"eslint-plugin-mocha-no-only": "^1.0.0", | ||
@@ -50,0 +50,0 @@ "eslint-plugin-node": "^7.0.1", |
@@ -200,3 +200,3 @@ # Eyes.Cypress | ||
It is important to call this at the end of each test, symmetrically to `eyesOpen`(or in `afterEach()`, see [Best practice for using the SDK]()). | ||
It is important to call this at the end of each test, symmetrically to `eyesOpen`(or in `afterEach()`, see [Best practice for using the SDK](#best-practice-for-using-the-sdk)). | ||
@@ -214,5 +214,5 @@ Close receives no arguments. | ||
| Property name | Default value | Description | | ||
| ------------- |:------------- |:----------- | | ||
| ------------- |:------------- |:----------- | | ||
| `testName` | The value of Cypress's test title | Test name. If this is not specified, the test name will be the title of the `it` block where the test is running. | | ||
| `browser` | { width: 800, height: 600, name: 'chrome' } | The size and browser of the generated screenshots. This doesn't need to be the same as the browser that Cypress is running. It could be a different size and also a different browser. Currently, `firefox` is supported in addition to `chrome`.<br/><br/>It's also possible to send an array of browsers, e.g. `[{width: 800, height: 600, name: 'firefox'}, { width: 1024, height: 768, name: 'chrome' }]`.| | ||
| `browser` | { width: 800, height: 600, name: 'chrome' } | The size and browser of the generated screenshots. This doesn't need to be the same as the browser that Cypress is running. It could be a different size and also a different browser. Currently, `firefox` and `chrome` are supported. For more info, see the [browser section below](#configuring-the-browser).| | ||
| `showLogs` | false | Whether or not you want to see logs of the Eyes.Cypress plugin. Logs are written to the same output of the Cypress process. | | ||
@@ -285,2 +285,54 @@ | `saveDebugData` | false | Whether to save troubleshooting data. See the troubleshooting section of this doc for more info. | | ||
## Configuring the browser | ||
Eyes.Cypress will take a screenshot of the page in the browser passed as an argument to `cy.eyesOpen`. | ||
It's also possible to send an array of browsers, for example: | ||
```js | ||
cy.eyesOpen({ | ||
... | ||
browser: [ | ||
{width: 800, height: 600, name: 'firefox'}, | ||
{width: 1024, height: 768, name: 'chrome'} | ||
] | ||
} | ||
``` | ||
### Device emulation | ||
To enable chrome's device emulation, it's possible to send a device name and screen orientation, for example: | ||
```js | ||
cy.eyesOpen({ | ||
... | ||
browser: { | ||
deviceName: 'iPhone X', | ||
screenOrientation: 'landscape' | ||
} | ||
} | ||
``` | ||
The list of device names is taken from [chrome devtools predefined devices](https://raw.githubusercontent.com/chromium/chromium/0aee4434a4dba42a42abaea9bfbc0cd196a63bc1/third_party/blink/renderer/devtools/front_end/emulated_devices/module.json), and can be obtained by running the following command in a unix-based shell (installing [`jq`](https://stedolan.github.io/jq/) might be needed): | ||
```sh | ||
curl -s https://raw.githubusercontent.com/chromium/chromium/0aee4434a4dba42a42abaea9bfbc0cd196a63bc1/third_party/blink/renderer/devtools/front_end/emulated_devices/module.json | jq '.extensions[].device.title' | ||
``` | ||
Possible values for screen orientation are `landscape` and `portrait`. | ||
In addition, it's possible to use chrome's device emulation with custom viewport sizes, pixel density and mobile mode, by passing `deviceScaleFactor` and `mobile` in addition to `width` and `height`. For example: | ||
```js | ||
cy.eyesOpen({ | ||
... | ||
browser: { | ||
width: 800, | ||
height: 600, | ||
deviceScaleFactor: 3, | ||
mobile: true | ||
} | ||
} | ||
``` | ||
## Setting a timeout | ||
@@ -287,0 +339,0 @@ |
@@ -45,3 +45,3 @@ /* global Cypress,cy,window,before,after */ | ||
const cdt = domNodesToCdt(doc); | ||
const domCapture = captureFrame(defaultDomProps); | ||
const domCapture = captureFrame(defaultDomProps, doc); | ||
const url = win.location.href; | ||
@@ -48,0 +48,0 @@ return extractResources(doc, win).then(({resourceUrls, blobs}) => { |
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
33055
344