我只是不明白,为什么 testcafe 在我的例子中运行这个测试两次:
MainApp.ts:
const getUrl = ClientFunction(() => window.location.href);
class MainApp {
async login(url:string) {
await t.expect(getUrl()).eql(url);
}}
export default new MainApp();
测试.ts:
import MailosaurClient from "mailosaur";
import { Selector, t } from "testcafe";
import MainApp from "./MainApp";
const testUrl = `https://www.google.com/`;
fixture("fixture")
.page("https://www.google.com/")
.beforeEach(async (t) => {
console.log("test");
})
.disablePageCaching("fixture");
test("Test", async (t) => {
console.log("Starting test");
await MainApp.login(
testUrl
);
您的代码运行良好,无需运行两次,只需更新节点并安装 testcafe 即可
类型
npx testcafe <browser> <path>