tests: live production check for In Pictures + board band + nav
This commit is contained in:
parent
70a23bbd46
commit
97c5d7c438
52
tests/live-check2.mjs
Normal file
52
tests/live-check2.mjs
Normal file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env node
|
||||
// LIVE production check: https://bidaangmamamayan.com (fresh box, verified-only
|
||||
// feed). Confirms the three new things render on the real site:
|
||||
// 1. "In Pictures" band with credited photos (>=5)
|
||||
// 2. front-page "Thank you, Senator BAM" board band (distinct, with form)
|
||||
// 3. nav has the 7 desks + gold board button, NOT a "board" category
|
||||
import pw from "playwright";
|
||||
import { mkdirSync } from "fs";
|
||||
const OUT = "/root/projects/bidaangmamamayan/tests/shots";
|
||||
mkdirSync(OUT, { recursive: true });
|
||||
|
||||
const b = await pw.chromium.launch();
|
||||
const page = await b.newPage({ viewport: { width: 1350, height: 950 } });
|
||||
const errs = [];
|
||||
page.on("pageerror", (e) => errs.push("pageerror: " + e.message));
|
||||
|
||||
await page.goto("https://bidaangmamamayan.com/", { waitUntil: "domcontentloaded", timeout: 30000 });
|
||||
await page.waitForTimeout(3500);
|
||||
await page.screenshot({ path: OUT + "/live-front.png" });
|
||||
|
||||
// 1. In Pictures band
|
||||
const photos = await page.locator(".photos-band .photo").count();
|
||||
const photoCred = await page.locator(".photos-band").textContent().catch(() => "");
|
||||
// 2. board band on the front page
|
||||
const boardBand = await page.locator("#board-band").count();
|
||||
const boardForm = await page.locator("#board-band form").count();
|
||||
// 3. nav
|
||||
const navs = await page.locator(".navstrip a").allTextContents();
|
||||
|
||||
console.log(JSON.stringify({
|
||||
photos,
|
||||
photosHaveCredits: /Public domain/.test(photoCred || ""),
|
||||
photosHaveOfficialSource: /official/i.test(photoCred || ""),
|
||||
boardBandOnFront: boardBand,
|
||||
boardHasForm: boardForm,
|
||||
navButtons: navs,
|
||||
boardAsCategory: navs.some((n) => /thank you/i.test(n)), // board IS in nav but as gold button, not a desk
|
||||
pageErrors: errs,
|
||||
}, null, 2));
|
||||
|
||||
// scroll to board band + screenshot
|
||||
if (boardBand) await page.locator("#board-band").scrollIntoViewIfNeeded().catch(() => {});
|
||||
await page.waitForTimeout(400);
|
||||
await page.screenshot({ path: OUT + "/live-board-band.png" });
|
||||
|
||||
// scroll to photos + screenshot
|
||||
await page.locator(".photos-band").scrollIntoViewIfNeeded().catch(() => {});
|
||||
await page.waitForTimeout(600);
|
||||
await page.screenshot({ path: OUT + "/live-in-pictures.png" });
|
||||
|
||||
await b.close();
|
||||
console.log(errs.length ? "LIVE ERRORS: " + errs.join("; ") : "LIVE CLEAN");
|
||||
Loading…
x
Reference in New Issue
Block a user