File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ cy.matchImage({
160
160
// helps with screenshots being scaled 2x on high-density screens like Mac Retina
161
161
// default: true
162
162
forceDeviceScaleFactor: false ,
163
+ // title used for naming the image file
164
+ // default: Cypress.currentTest.titlePath (your test title)
165
+ title: ` ${Cypress .currentTest .titlePath .join (' ' )} (${Cypress .browser .displayName }) `
163
166
})
164
167
```
165
168
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ declare global {
10
10
updateImages ?: boolean ;
11
11
imagesDir ?: string ;
12
12
maxDiffThreshold ?: number ;
13
+ title ?: string ;
13
14
} ;
14
15
15
16
interface Chainable < Subject > {
@@ -30,7 +31,7 @@ Cypress.Commands.add(
30
31
{ prevSubject : "optional" } ,
31
32
( subject , options = { } ) => {
32
33
const $el = subject as JQuery < HTMLElement > | undefined ;
33
- let title = Cypress . currentTest . titlePath . join ( " " ) ;
34
+ let title = options . title || Cypress . currentTest . titlePath . join ( " " ) ;
34
35
if ( typeof nameCacheCounter [ title ] === "undefined" )
35
36
nameCacheCounter [ title ] = - 1 ;
36
37
title += ` #${ ++ nameCacheCounter [ title ] } ` ;
You can’t perform that action at this time.
0 commit comments