|
2 | 2 | import type { Options } from '@wdio/types' |
3 | 3 | import { $ } from '@wdio/globals'; |
4 | 4 |
|
5 | | -export const config: Options.Testrunner = { |
6 | | - runner: 'local', |
7 | | - path: '/', |
| 5 | +export const config: WebdriverIO.Config = { |
| 6 | + runner: 'local', |
| 7 | + path: '/', |
8 | 8 | // |
9 | 9 | // ================== |
10 | 10 | // Specify Test Files |
@@ -238,29 +238,30 @@ export const config: Options.Testrunner = { |
238 | 238 | } |
239 | 239 |
|
240 | 240 | /* |
241 | | - * get the current date and clean it |
242 | | - * const date = (new Date()).toString().replace(/\s/g, '-').replace(/-\(\w+\)/, ''); |
243 | | - */ |
| 241 | + * get the current date and clean it |
| 242 | + * const date = (new Date()).toString().replace(/\s/g, '-').replace(/-\(\w+\)/, ''); |
| 243 | + */ |
244 | 244 | //const { browserName } = browser.desiredCapabilities; |
245 | 245 | const timestamp = new Date().toLocaleString('iso', { |
246 | 246 | year: 'numeric', |
247 | 247 | month: '2-digit', |
248 | 248 | day: '2-digit', |
249 | 249 | hour: '2-digit', |
250 | 250 | minute: '2-digit', |
| 251 | + second: '2-digit', |
251 | 252 | hour12: false |
252 | 253 | }).replace(/[ ]/g, '--').replace(':', '-'); |
253 | 254 |
|
254 | 255 | // get current test title and clean it, to use it as file name |
255 | 256 | const filename = encodeURIComponent( |
256 | | - `${ |
257 | | - test.fullTitle.replace(/\s+/g, '-') |
258 | | - }-chrome-${timestamp}`.replace(/[/]/g, '__') |
| 257 | + `chrome-${timestamp}`.replace(/[/]/g, '__') |
259 | 258 | ).replace(/%../, '.'); |
260 | 259 |
|
261 | 260 | const filePath = path.resolve(this.screenshotPath, `${filename}.png`); |
262 | 261 |
|
| 262 | + console.log('Saving screenshot to:', filePath); |
263 | 263 | browser.saveScreenshot(filePath); |
| 264 | + console.log('Saved screenshot to:', filePath); |
264 | 265 | }, |
265 | 266 | /** |
266 | 267 | * Hook that gets executed after the suite has ended |
|
0 commit comments