nl_tokens: The default is to save screenshots to the root of your project even though there is a screenshots path in the config object above! ... so we need a function that returns the correct path for storing our screenshots . While we re at it we are adding some meta - data to the filename specifically the Platform / Browser where the test was run and the test ( file ) name .
pl_tokens: function imgpath ( browser ) { var a = browser . options . desiredCapabilities ; var meta = [ a . platform ] ; meta . push ( a . browserName ? a . browserName : 'any' ) ; meta . <mask> ( a . version ? a . version : 'any' ) ; meta . push ( a . name ) ; // this is the test filename so always exists. var metadata = meta . join ( '~' ) . toLowerCase ( ) . replace ( / / g , '' ) ; return SCREENSHOT_PATH + metadata + '_' + padLeft ( FILECOUNT ++ ) + '_' ; }