File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,21 @@ class ResembleHelper extends Helper {
75
75
* @returns {Promise<void }
76
76
*/
77
77
async screenshotElement ( selector , name ) {
78
- const helper = this . _getHelper ( ) ;
79
- const configuration = this . config ;
78
+
79
+ if ( this . helpers [ 'Puppeteer' ] ) {
80
+ const helper = this . _getHelper ( ) ;
81
+ const configuration = this . config ;
80
82
81
- await helper . waitForVisible ( selector ) ;
82
- const els = await helper . _locate ( selector ) ;
83
- if ( ! els . length ) throw new Error ( `Element ${ selector } couldn't be located` ) ;
84
- const el = els [ 0 ] ;
83
+ await helper . waitForVisible ( selector ) ;
84
+ const els = await helper . _locate ( selector ) ;
85
+ if ( ! els . length ) throw new Error ( `Element ${ selector } couldn't be located` ) ;
86
+ const el = els [ 0 ] ;
85
87
86
- await el . screenshot ( {
87
- path : configuration . screenshotFolder + name + '.png'
88
- } ) ;
88
+ await el . screenshot ( {
89
+ path : configuration . screenshotFolder + name + '.png'
90
+ } ) ;
91
+ }
92
+ else throw new Error ( "Method to be called only with Puppeteer. Other helpers not supported" ) ;
89
93
}
90
94
91
95
/**
You can’t perform that action at this time.
0 commit comments