Skip to content

Commit

Permalink
fix(e2e): fix e2e only record current page event
Browse files Browse the repository at this point in the history
re #80
  • Loading branch information
fanniehuang committed Oct 29, 2020
1 parent f2960f0 commit bd88790
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/wxa-cli/src/tester/readMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -81,3 +79,4 @@ module.exports = {
}]
}
```
* 项目根目录下执行`jest __wxa_e2e_test__`
3 changes: 2 additions & 1 deletion packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit bd88790

Please sign in to comment.