Skip to content

Commit

Permalink
docs: update custom screenshot writer documentation (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Hoyoul Kang authored Dec 14, 2020
1 parent d3b70b4 commit 9cb4c72
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,24 @@ export default class ScreenGrabber {

```

DEPRECATION NOTICE: `CustomScreenshotGrabber` has been deprecated since gauge-ts v0.0.5, please use `CustomScreenshotGrabber` as mentioned below
DEPRECATION NOTICE: `CustomScreenshotGrabber` has been deprecated since gauge-ts v0.0.5, please use `CustomScreenshotWriter` as mentioned below

```javascript
import { CustomScreenWriter } from "gauge-ts";
import { join, basename } from "path";
import { writeFileSync } from "fs";
import { v4 } from 'uuid';
import { CustomScreenshotWriter } from 'gauge-ts';
import { join, basename } from 'path';

const { screenshot } = require('taiko');

export default class ScreenshotWriter {
@CustomScreenshotWriter()
public async foo(): string {
let bytes = new Uint8Array(); // use your driver to fetch the screenshot bytes
let fileName = join(process.env["gauge_screenshots_dir"], `${v4}.png`)
writeFileSync(fileName, bytes);
return basename(fileName);
}
@CustomScreenshotWriter()
public async foo(): Promise<string> {
const screenshotFilePath = join(
process.env['gauge_screenshots_dir'],
`screenshot-${process.hrtime.bigint()}.png`,
);
await screenshot({ path: screenshotFilePath });
return basename(screenshotFilePath);
}
}
```

Expand Down

0 comments on commit 9cb4c72

Please sign in to comment.