Skip to content

Commit e5123ca

Browse files
authored
Merge pull request #35 from pinanks/DOT-2301
Add FPS config for capture command
2 parents 38d42ec + a18816c commit e5123ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib/screenshot.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const BROWSER_FIREFOX = 'firefox';
88
const BROWSER_EDGE = 'edge';
99
const EDGE_CHANNEL = 'msedge';
1010
const PW_WEBKIT = 'webkit';
11+
const MIN_RESOLUTION_HEIGHT = 320;
1112

1213
export async function captureScreenshots(ctx: Context, screenshots: WebStaticConfig): Promise<number> {
1314
// Clean up directory to store screenshots
@@ -53,8 +54,8 @@ export async function captureScreenshots(ctx: Context, screenshots: WebStaticCon
5354
let { width, height } = ctx.webConfig.viewports[k];
5455
let ssName = `${browserName}-${width}x${height}-${screenshotId}.png`
5556
let ssPath = `screenshots/${screenshotId}/${ssName}.png`
56-
await page.setViewportSize({ width, height})
57-
await page.screenshot({ path: ssPath });
57+
await page.setViewportSize({ width, height: height || MIN_RESOLUTION_HEIGHT })
58+
await page.screenshot({ path: ssPath, fullPage: height ? false: true });
5859

5960
let completed = (i == (totalBrowsers-1) && j == (totalScreenshots-1) && k == (totalViewports-1)) ? true : false;
6061
browserName = browserName === BROWSER_SAFARI ? PW_WEBKIT : browserName;

0 commit comments

Comments
 (0)