tools: Replace `realm_uri` with `realm_url`.

Replaces `realm_uri` with `realm_url` in "message-screenshot" and "thread-screenshot".

Adds a missing `>` in both files.
This commit is contained in:
Vector73 2024-06-03 14:22:19 +05:30 committed by Tim Abbott
parent 88df01bee5
commit 8d4c42d460
2 changed files with 9 additions and 9 deletions

View File

@ -12,11 +12,11 @@ const puppeteer = require("puppeteer");
const options = {}; const options = {};
program program
.arguments("<message_id> <image_path> <realm_uri") .arguments("<message_id> <image_path> <realm_url>")
.action((messageId, imagePath, realmUri) => { .action((messageId, imagePath, realmUrl) => {
options.messageId = messageId; options.messageId = messageId;
options.imagePath = imagePath; options.imagePath = imagePath;
options.realmUri = realmUri; options.realmUrl = realmUrl;
console.log(`Capturing screenshot for message ${messageId} to ${imagePath}`); console.log(`Capturing screenshot for message ${messageId} to ${imagePath}`);
}) })
.parse(process.argv); .parse(process.argv);
@ -43,7 +43,7 @@ async function run() {
const page = await browser.newPage(); const page = await browser.newPage();
// deviceScaleFactor:2 gives better quality screenshots (higher pixel density) // deviceScaleFactor:2 gives better quality screenshots (higher pixel density)
await page.setViewport({width: 1280, height: 1024, deviceScaleFactor: 2}); 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. // wait for Iago devlogin button and click on it.
await page.waitForSelector('[value="iago@zulip.com"]'); await page.waitForSelector('[value="iago@zulip.com"]');
@ -54,7 +54,7 @@ async function run() {
]); ]);
// Navigate to message and capture screenshot // 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", waitUntil: "networkidle2",
}); });
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef

View File

@ -12,13 +12,13 @@ const puppeteer = require("puppeteer");
const options = {}; const options = {};
program program
.arguments("<narrow_uri> <narrow> <unread_msg_id> <image_path> <realm_uri") .arguments("<narrow_uri> <narrow> <unread_msg_id> <image_path> <realm_url>")
.action((narrow_uri, narrow, unread_msg_id, imagePath, realmUri) => { .action((narrow_uri, narrow, unread_msg_id, imagePath, realmUrl) => {
options.narrowUri = narrow_uri; options.narrowUri = narrow_uri;
options.narrow = narrow; options.narrow = narrow;
options.messageId = unread_msg_id; options.messageId = unread_msg_id;
options.imagePath = imagePath; options.imagePath = imagePath;
options.realmUri = realmUri; options.realmUrl = realmUrl;
console.log(`Capturing screenshot for ${narrow} to ${imagePath}`); console.log(`Capturing screenshot for ${narrow} to ${imagePath}`);
}) })
.parse(process.argv); .parse(process.argv);
@ -45,7 +45,7 @@ async function run() {
const page = await browser.newPage(); const page = await browser.newPage();
// deviceScaleFactor:2 gives better quality screenshots (higher pixel density) // deviceScaleFactor:2 gives better quality screenshots (higher pixel density)
await page.setViewport({width: 1280, height: 1024, deviceScaleFactor: 2}); 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. // wait for Iago devlogin button and click on it.
await page.waitForSelector('[value="iago@zulip.com"]'); await page.waitForSelector('[value="iago@zulip.com"]');