Skip to content

Commit

Permalink
fix(e2e): 单层循环index问题
Browse files Browse the repository at this point in the history
re #80
  • Loading branch information
fanniehuang committed Apr 25, 2021
1 parent 4011b2d commit beb2054
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions packages/wxa-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 目前无法支持:
* catchtap、catchlongpress等阻止冒泡事件(自动化element.tap、element.longpress等方法无法阻止冒泡)
* 主动操作返回(因无法监听返回事件,所以录制过程中 *点击物理返回键*、*小程序titlebar返回键*、*ios手势返回*等返回操作,暂无法支持)
* 刷脸、文件上传
* 已知bug:
* 暂无
* 待优化&计划:
Expand All @@ -16,14 +17,17 @@
* 简化配置步骤,对测试更友好点
* 【真机】:支持真机
* 【服务器】:有个公共服务器解决用例执行的问题
* 支持物理返回操作
* 支持清理历史案例结果,可个性化配置仅保留X次
* 开发配套web服务,实现录制回放全过程不用命令行
* 各种未知bug

2020年3月11日
2021年4月23日
# 使用手册

### 安装
* 先安装项目依赖 `wnpm i`
* 项目目录下执行命令 `wnpm i @webank/wxa-cli2-apple`
* 项目目录下执行命令 `wnpm i @webank/wxa-cli2-apple -D`

### python 及依赖安装(可选,带参数--py-diff时需要安装)
* [Python官网](https://www.python.org/)下载Python安装包(python-3.X.X.exe)
Expand Down
2 changes: 1 addition & 1 deletion packages/wxa-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webank/wxa-cli2-apple",
"version": "1.0.57",
"version": "1.0.63",
"description": "cli for wxa development",
"main": "dist/wxa.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions packages/wxa-cli/src/tester/domWalker.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class XMLManager {
let {isIeration, indexVariable} = this.findSelfOrAncestorIterationDirective(element);

let keyElement = [pagePath, hash, element.attribs.id];
if (isIeration) keyElement.push(`-{{${indexVariable}}}`);
if (isIeration){
keyElement.push(`-{{${indexVariable}}}`);
}

let id = this.assembleUniqueId(keyElement);
element.attribs['data-_wxaTestUniqueId'] = id;
Expand Down Expand Up @@ -136,7 +138,7 @@ class XMLManager {
assembleUniqueId(keyElement) {
return keyElement.reduce((prev, key)=>{
if (key) {
key = key.replace(/[^\w]/g, '');
key = key.replace(/[^\w\{\}\-]/g, '');
key = key[0].toUpperCase() + key.slice(1);

return prev + key;
Expand Down
2 changes: 1 addition & 1 deletion packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestCaseTpl.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ for (let j = 0; j < testCaseNameArr.length; j++) {
for (let i = 0; i < record.length; i++) {
let recordItem = record[i];
let recordAction = recordItem.action;
let lastRecordAction = record[i - 1]?.action;
let lastRecordAction = record[i - 1] && record[i - 1].action;
while (true) {
page = await miniProgram.currentPage()
if (recordAction.event === 'switchTab') {
Expand Down

0 comments on commit beb2054

Please sign in to comment.