Add Puppeteer scripts for navigation testing and debugging
- Created nav-debug.cjs to log anchor tags and simulate clicks on the Voice navigation link, capturing click events and page navigation. - Added nav-test.cjs to test the Voice link click and log the URL at various intervals, capturing any page errors. - Introduced nav-test2.cjs to check the presence of specific elements on the /voice/ page and log any console errors. - Implemented nav-test4019.cjs to monitor network requests and responses related to the Voice navigation, verifying button presence and click functionality.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const puppeteer = require("puppeteer-core");
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: "/usr/bin/google-chrome",
|
||||
headless: true,
|
||||
args: ["--no-sandbox", "--disable-setuid-sandbox"],
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
const errs = [];
|
||||
page.on("pageerror", (e) => errs.push("PAGEERROR: " + e.message));
|
||||
await page.goto("http://localhost:3000/dashboard/", { waitUntil: "domcontentloaded", timeout: 30000 });
|
||||
await new Promise((r) => setTimeout(r, 2500));
|
||||
|
||||
const info = await page.evaluate(() => {
|
||||
const v = Array.from(document.querySelectorAll('a[aria-label]')).find((a) => a.getAttribute("aria-label") === "Voice");
|
||||
const r = v.getBoundingClientRect();
|
||||
return { cx: r.x + r.width / 2, cy: r.y + r.height / 2 };
|
||||
});
|
||||
await page.mouse.click(info.cx, info.cy);
|
||||
for (const t of [500, 1000, 2000, 3500]) {
|
||||
await new Promise((r) => setTimeout(r, t === 500 ? 500 : t - (t === 1000 ? 500 : t === 2000 ? 1000 : 2000)));
|
||||
console.log(`url @${t}ms:`, page.url());
|
||||
}
|
||||
console.log("ERRORS:", errs.slice(0, 10).join(" | ") || "none");
|
||||
await browser.close();
|
||||
})().catch((e) => { console.error("SCRIPT FAIL:", e); process.exit(1); });
|
||||
Reference in New Issue
Block a user