Replaces the existing screenshot with the newly generated one.
(png: string)
| 41 | |
| 42 | /** Replaces the existing screenshot with the newly generated one. */ |
| 43 | storeScreenshot(png: string) { |
| 44 | try { |
| 45 | if (!fs.existsSync(OUTPUT_DIR)) { |
| 46 | fs.mkdirSync(OUTPUT_DIR, {recursive: true}); |
| 47 | } |
| 48 | fs.writeFileSync(this.fullPath, png, {encoding: 'base64'}); |
| 49 | } catch { |
| 50 | // In read-only test sandbox environments, writing to source tree is not permitted. |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export function screenshot(id: string, wd: webdriver.WebDriver): Promise<void> { |