refactor: Extract out out root_dir and puppeteer_dir.

The puppeteer_dir will use used for passing in the path to save the
recording.
This commit is contained in:
Priyank Patel
2020-08-04 19:48:34 +00:00
committed by Tim Abbott
parent 3ab603e3a2
commit cb1020abd4

View File

@@ -7,6 +7,9 @@ const puppeteer = require("puppeteer");
const test_credentials = require("../../var/puppeteer/test_credentials.js").test_credentials;
const root_dir = path.resolve(__dirname, "../../");
const puppeteer_dir = path.join(root_dir, "var/puppeteer");
class CommonUtils {
constructor() {
this.browser = null;
@@ -86,8 +89,7 @@ class CommonUtils {
this.screenshot_id += 1;
}
const root_dir = path.resolve(__dirname, "../../");
const screenshot_path = path.join(root_dir, "var/puppeteer", `${name}.png`);
const screenshot_path = path.join(puppeteer_dir, `${name}.png`);
await page.screenshot({
path: screenshot_path,
});