Skip to content

Commit

Permalink
feat(e2e): 修复nomock参数不生效的问题
Browse files Browse the repository at this point in the history
re #80
  • Loading branch information
fanniehuang committed Mar 31, 2021
1 parent d3ca9b3 commit 7c579c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/wxa-cli/src/tester/wxa-e2eTest/e2eTestCaseTpl.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let testCaseNameArr = JSON.parse('<%- testCaseNameArr %>')
let testDir = '<%= testDir %>';
let screenshotDirname = '<%- screenshotPath %>'
let screenshotDiff = <%- screenshotDiff %>;
let mockApi = <%- mockApi %>;
let base = <%- base %>;
let noMockApi = <%- noMockApi%>
let customExpect = <%- customExpect%>
const sleep = t => new Promise(resolve => setTimeout(resolve, t));

Expand Down Expand Up @@ -73,7 +73,7 @@ for (let j = 0; j < testCaseNameArr.length; j++) {
let apiMockMap = require(path.join(testDir, testName, `./api.json`));
// for (let i = 0; i < mockWxMethodConfig.length; i++) {
<% mockWxMethodConfig.forEach(function(mockItem){ %>
<% if(mockItem.name !== 'request' || !noMockApi) %>
<% if(mockItem.name !== 'request' || mockApi) {%>
await miniProgram.mockWxMethod(
'<%- mockItem.name %>',
function(config, apiMockMap) {
Expand All @@ -92,7 +92,7 @@ for (let j = 0; j < testCaseNameArr.length; j++) {
},
apiMockMap
)
<% }); %>
<% }}); %>

// 开始回放+截屏
page = await miniProgram.reLaunch(`/${record[0].action.page}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/wxa-cli/src/tester/wxa-e2eTest/runTestCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default async function(cmd, wxaConfigs) {
screenshotPath: screenshotPath.replace(' ', '_').replace(/:/g, '.'),
base: !!cmd.base,
screenshotDiff: screenshotDiff,
noMockApi: !!cmd.noMock,
mockApi: cmd.mock,
customExpect: !!cmd.customExpect,
mockWxMethodConfig
});
Expand Down

0 comments on commit 7c579c2

Please sign in to comment.