Skip to content

Commit

Permalink
fix(e2e): 解决looksame比对bug
Browse files Browse the repository at this point in the history
re #80
  • Loading branch information
fanniehuang committed Apr 25, 2021
1 parent beb2054 commit 6b6f50e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
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.63",
"version": "1.0.65",
"description": "cli for wxa development",
"main": "dist/wxa.js",
"scripts": {
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 @@ -194,7 +194,7 @@ for (let j = 0; j < testCaseNameArr.length; j++) {

async function screenShot({screenshotDir, screenCount, diff, baseScreenshot}) {
let actualImagePath = path.join(screenshotDir, `${screenCount}.png`);
let expectPath = baseScreenshot;
let expectPath = path.join(baseScreenshot, `${screenCount}.png`)
await miniProgram.screenshot({path: actualImagePath});
if (diff) {
let same = await imageDiff(actualImagePath, expectPath, path.join(screenshotDir, `diff/${screenCount}.png`));
Expand Down
31 changes: 17 additions & 14 deletions packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,24 @@ const addRecord = function(type, ...args) {
let id = target.dataset[IDKEY];
// 先判断是否需要记录
if (shouldRecord.bind(this)(type, ...args)) {
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1];
id = findParent(this, id);
state.record.push({
action: {
...e,
page: joinURLQuery(currentPage.route, currentPage.options),
event: type,
id,
timeStamp: +new Date()
}
});
console.log('e2eRecord:', e, id)
}
// tab-bar的操作直接忽略,因为回放找不到
if (this.is.slice(0, 14) !== 'custom-tab-bar') {
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1];
id = findParent(this, id);
state.record.push({
action: {
...e,
page: joinURLQuery(currentPage.route, currentPage.options),
event: type,
id,
timeStamp: +new Date()
}
});
console.log('e2eRecord:', e, id)
}

}
// 调用eventMap中原方法
let eventFunc = getEventFunc(type, e.currentTarget.dataset[EVENTMAPKEY]);
if (!eventFunc) {
Expand Down

0 comments on commit 6b6f50e

Please sign in to comment.