diff --git a/tools/screenshots/message-screenshot.js b/tools/screenshots/message-screenshot.js index 09fa9ed317..d42859eddf 100644 --- a/tools/screenshots/message-screenshot.js +++ b/tools/screenshots/message-screenshot.js @@ -12,11 +12,11 @@ const puppeteer = require("puppeteer"); const options = {}; program - .arguments(" { + .arguments(" ") + .action((messageId, imagePath, realmUrl) => { options.messageId = messageId; options.imagePath = imagePath; - options.realmUri = realmUri; + options.realmUrl = realmUrl; console.log(`Capturing screenshot for message ${messageId} to ${imagePath}`); }) .parse(process.argv); @@ -43,7 +43,7 @@ async function run() { const page = await browser.newPage(); // deviceScaleFactor:2 gives better quality screenshots (higher pixel density) await page.setViewport({width: 1280, height: 1024, deviceScaleFactor: 2}); - await page.goto(`${options.realmUri}/devlogin`); + await page.goto(`${options.realmUrl}/devlogin`); // wait for Iago devlogin button and click on it. await page.waitForSelector('[value="iago@zulip.com"]'); @@ -54,7 +54,7 @@ async function run() { ]); // Navigate to message and capture screenshot - await page.goto(`${options.realmUri}/#narrow/id/${options.messageId}`, { + await page.goto(`${options.realmUrl}/#narrow/id/${options.messageId}`, { waitUntil: "networkidle2", }); // eslint-disable-next-line no-undef diff --git a/tools/screenshots/thread-screenshot.js b/tools/screenshots/thread-screenshot.js index 74e12dce6b..84a56f3329 100644 --- a/tools/screenshots/thread-screenshot.js +++ b/tools/screenshots/thread-screenshot.js @@ -12,13 +12,13 @@ const puppeteer = require("puppeteer"); const options = {}; program - .arguments(" { + .arguments(" ") + .action((narrow_uri, narrow, unread_msg_id, imagePath, realmUrl) => { options.narrowUri = narrow_uri; options.narrow = narrow; options.messageId = unread_msg_id; options.imagePath = imagePath; - options.realmUri = realmUri; + options.realmUrl = realmUrl; console.log(`Capturing screenshot for ${narrow} to ${imagePath}`); }) .parse(process.argv); @@ -45,7 +45,7 @@ async function run() { const page = await browser.newPage(); // deviceScaleFactor:2 gives better quality screenshots (higher pixel density) await page.setViewport({width: 1280, height: 1024, deviceScaleFactor: 2}); - await page.goto(`${options.realmUri}/devlogin`); + await page.goto(`${options.realmUrl}/devlogin`); // wait for Iago devlogin button and click on it. await page.waitForSelector('[value="iago@zulip.com"]');