我正在尝试抓取一些文本,然后以开玩笑的方式进行比较。
我的代码:
expect(received).toBe(expected) // Object.is equality
返回:
预期:Forgot password
已收到:{}
describe("login to Synthrone tests", () => {
test("no existed user try", async () => {
browser = await puppeteer.launch(chromeOptions);
const page = await browser.newPage();
await page.goto("https://admin.manager.test-synthrone.com/");
const a = page.evaluate(() =>
document.querySelector(".additional-user-actions").textContent.trim()
);
expect(a).toBe("Forgot password");
});
});