const path = require('path');
const automator = require('miniprogram-automator');
let e2eRc = require(path.resolve(process.cwd(), '.e2erc.js'));
let timer = null;
jest.setTimeout(30000000);
describe('minitest-2', () => {
let miniProgram;
beforeAll(async () => {
miniProgram = await automator.launch({
projectPath: e2eRc.projectPath,
});
}, 30000000);
afterAll(async () => {
clearInterval(timer);
await miniProgram.disconnect();
});
it('minitest-2', async () => {
// request 不能 mock 了
await miniProgram.mockWxMethod(
'request',
function(obj, platform) {
console.log('typeof Promise ----->', typeof Promise); // 模拟器无输出
return new Promise((resolve, reject) => {
this.origin({...obj, success (res) { resolve(res)} });
})
}
);
let page;
page = await miniProgram.currentPage();
await page.waitFor(10000);
});
});
工具上试下关闭启用独立域调试选项看能不能行
刚刚试了一下真机也会有同样的报错