diff --git a/packages/wxa-cli/src/tester/readMe.md b/packages/wxa-cli/src/tester/readMe.md index 35a8d181..66e2b3f8 100644 --- a/packages/wxa-cli/src/tester/readMe.md +++ b/packages/wxa-cli/src/tester/readMe.md @@ -44,11 +44,9 @@ ### 测试脚本回放 * `npm i -g jest` -* 项目下执行 `npm i miniprogram-automator· -* 项目根目录下添加`babel.config.js`文件 +* 项目下执行 `npm i miniprogram-automator` * 开发者工具修改调试基础库 2.7.3以上(src/project.config.json需同步修改libVersion) -* 项目根目录下添加文件babel.config.js - +* 项目根目录下添加文件`babel.config.js` ``` const path = require('path'); const existsSync = require('fs').existsSync; @@ -81,3 +79,4 @@ module.exports = { }] } ``` +* 项目根目录下执行`jest __wxa_e2e_test__` diff --git a/packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestSuite.js b/packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestSuite.js index 1aa49ef3..9e901a4a 100644 --- a/packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestSuite.js +++ b/packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestSuite.js @@ -32,7 +32,8 @@ const shouldRecord = function(type, ...args) { return false; } // 当前页面的操作才记录 - if (getCurrentPages()[0].__wxWebviewId__ !== this.__wxWebviewId__){ + let currentPages = getCurrentPages(); + if (currentPages[currentPages.length - 1].__wxWebviewId__ !== this.__wxWebviewId__){ return false; } if (e.target.dataset.e2ebtn === 'true') {