35 lines
1.6 KiB
JavaScript
35 lines
1.6 KiB
JavaScript
|
|
import puppeteer from "puppeteer-core";
|
||
|
|
const browser = await puppeteer.launch({
|
||
|
|
executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
||
|
|
headless: "new",
|
||
|
|
args: ["--no-sandbox", "--disable-setuid-sandbox"],
|
||
|
|
defaultViewport: { width: 1280, height: 900 },
|
||
|
|
});
|
||
|
|
const page = await browser.newPage();
|
||
|
|
await page.goto("http://localhost:4004/login", { waitUntil: "networkidle0" });
|
||
|
|
await page.type('input[name="identity"]', "david@rjbulk.local");
|
||
|
|
await page.type('input[name="password"]', "ChangeMe123!");
|
||
|
|
await Promise.all([
|
||
|
|
page.click('button[type="submit"]'),
|
||
|
|
page.waitForNavigation({ waitUntil: "networkidle0" }),
|
||
|
|
]);
|
||
|
|
|
||
|
|
// 1. Customers - search "SJ Coetzee" - should show BOTH (the dupe)
|
||
|
|
await page.goto("http://localhost:4004/customers?q=sj", { waitUntil: "networkidle0" });
|
||
|
|
await page.screenshot({ path: "/tmp/rjbulk-screens/before-01-sj-dupes.png", fullPage: true });
|
||
|
|
|
||
|
|
// 2. Search "cancelled"
|
||
|
|
await page.goto("http://localhost:4004/customers?q=cancelled", { waitUntil: "networkidle0" });
|
||
|
|
await page.screenshot({ path: "/tmp/rjbulk-screens/before-02-cancelled.png", fullPage: true });
|
||
|
|
|
||
|
|
// 3. Suppliers page with search
|
||
|
|
await page.goto("http://localhost:4004/suppliers", { waitUntil: "networkidle0" });
|
||
|
|
await page.screenshot({ path: "/tmp/rjbulk-screens/before-03-suppliers.png", fullPage: true });
|
||
|
|
|
||
|
|
// 4. Suppliers search "fuel"
|
||
|
|
await page.goto("http://localhost:4004/suppliers?q=fuel", { waitUntil: "networkidle0" });
|
||
|
|
await page.screenshot({ path: "/tmp/rjbulk-screens/before-04-suppliers-search.png", fullPage: true });
|
||
|
|
|
||
|
|
await browser.close();
|
||
|
|
console.log("before-shots done");
|