This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 生产上确认注册页真的开出来了(截图留证)。
|
||||
*
|
||||
* 只读:填一个邮箱、看页面长什么样,不点「获取验证码」——那会真的发信,
|
||||
* 而且生产没有 dev echo,码只能到收件人邮箱里。
|
||||
*/
|
||||
import { chromium } from "playwright-core";
|
||||
|
||||
const WEB = process.env.WEB ?? "http://192.168.8.188:8200";
|
||||
const OUT = "e2e/artifacts";
|
||||
|
||||
const browser = await chromium.launch({
|
||||
executablePath:
|
||||
process.env.CHROME ??
|
||||
`${process.env.LOCALAPPDATA}/ms-playwright/chromium-1223/chrome-win64/chrome.exe`,
|
||||
});
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 960 } });
|
||||
const errors = [];
|
||||
page.on("console", (m) => m.type() === "error" && errors.push(m.text()));
|
||||
page.on("pageerror", (e) => errors.push(String(e)));
|
||||
|
||||
await page.goto(`${WEB}/login`);
|
||||
await page.waitForSelector("#account");
|
||||
const hasLink = (await page.getByRole("link", { name: "用邮箱注册" }).count()) > 0;
|
||||
console.log(`登录页有注册入口:${hasLink}`);
|
||||
|
||||
await page.getByRole("link", { name: "用邮箱注册" }).click();
|
||||
await page.waitForURL("**/register");
|
||||
await page.waitForSelector("#email");
|
||||
await page.locator("#email").fill("someone@example.com");
|
||||
await page.screenshot({ path: `${OUT}/prod-register.png` });
|
||||
|
||||
console.log(`控制台报错:${errors.length}`);
|
||||
await browser.close();
|
||||
process.exit(hasLink && errors.length === 0 ? 0 : 1);
|
||||
Reference in New Issue
Block a user