Skip to content

Commit

Permalink
SBVT-1479: updating README.md around layout mode (#114)
Browse files Browse the repository at this point in the history
* SBVT-1479: updating README.md

* SBVT-1479: updating README.md

* SBVT-1479: updating README.md

* SBVT-1479: changinging element capture

---------

Co-authored-by: trevor.nelms <trevor.nelms@smartbear.com>
  • Loading branch information
tnelms1 and trevor.nelms authored Jun 7, 2023
1 parent 25f4a1c commit ff4957a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,47 +35,47 @@ Simply change all instances of ```cy.screenshot``` with ```cy.sbvtCapture```.
For example, this will run regression tests against **Fullpage Home Capture** in that project

```javascript
cy.sbvtCapture('Fullpage Home Capture')
cy.sbvtCapture('Home Page')
```

To have a capture with layout mode
To override project settings — take a capture with layout mode on low sensitivity

```javascript
cy.sbvtCapture('layout test', {
comparisonMode: 'layout',
sensitivity: "low", // 'low', 'medium', or 'high'
cy.sbvtCapture('Home Page', {
comparisonMode: 'layout', // if 'layout', then sensitivity is requried, OR 'detailed' with no sensitivity
sensitivity: "low" // 'medium', or 'high'
})
```

For lazy-loaded websites use:

```javascript
cy.sbvtCapture('lazyloaded capture', {
lazyload: 250, //number is milliseconds between scrolls
cy.sbvtCapture('Home Page', {
lazyload: 250 //number is milliseconds between scrolls
})
```

To ignore elements on the comparison, add the cssSelector to the array:

```javascript
cy.sbvtCapture('ignoreElements-example', {
ignoreElements: ['.exampleClass', '.class1 > div > li:nth-child(1)'],
cy.sbvtCapture('Home Page', {
ignoreElements: ['.exampleClass', '.class1 > div > li:nth-child(1)']
})
```

You can also run tests against just certain elements, this will run regression tests against the header.

```javascript
cy.get('.container').eq(0).sbvtCapture('Capture of the homepage header')
cy.get('.container').eq(0).sbvtCapture('Home Page Header')
```

To pass in other [arguments](https://docs.cypress.io/api/commands/screenshot#Arguments) , the syntax would be the same as ```cy.screenshot```

```javascript
cy.sbvtCapture('Clipping the homepage viewport', {
cy.sbvtCapture('Home Page', {
capture: 'viewport',
overwrite: true,
clip: {x: 100, y: 100, width: 1000, height: 1000},
clip: {x: 100, y: 100, width: 1000, height: 1000}
})
```

Expand Down

0 comments on commit ff4957a

Please sign in to comment.