macacajs / NoSmoke

A cross platform UI crawler which scans view trees then generate and execute UI test cases.
https://macacajs.github.io/NoSmoke
MIT License
199 stars 58 forks source link

common/logger.js platform不为ios或android时,cmd会为空字符串,导致报错 #83

Open zxsky316 opened 5 years ago

zxsky316 commented 5 years ago

想用nosmoke做web-pc的遍历测试,发现会报错,最后定位到了common/logger.js中, 报错信息如下 TypeError: "file" argument must be a non-empty string at normalizeSpawnArguments (child_process.js:384:11) at exports.spawn (child_process.js:497:38) at Object.exports.execFile (child_process.js:213:15) at exports.exec (child_process.js:143:18) at Logger.filterDeviceLogs (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/common/logger.js:62:16) at EventEmitter.root.eventEmmiter.addListener (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/crawler/index.js:56:10) at emitOne (events.js:116:13) at EventEmitter.emit (events.js:211:7) at WDClient.onSessionCreated (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/wd-client.js:54:21) at that.send (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/wd-client.js:45:14) -----> Crawling Finished: <----- TypeError: "file" argument must be a non-empty string

注释掉index.js中的 logger.filterDeviceLogs(root.config); 可以正常运行nosmoke命令,配置文件中时对所有的 a标签进行点击操作,但是实际运行能打开页面,但是未发生点击操作,能帮忙个看下是什么问题吗?

macaca-bot commented 5 years ago

This is the translated issue:


When common/logger.js platform is not ios or android, cmd will be an empty string, resulting in an error.

I want to use nosmoke to do the web-pc traversal test. I found that I will report an error and finally locate it in common/logger.js. The error message is as follows TypeError: "file" argument must be a non-empty string     At normalizeSpawnArguments (child_process.js:384:11)     At exports.spawn (child_process.js:497:38)     At Object.exports.execFile (child_process.js:213:15)     At exports.exec (child_process.js:143:18)     At Logger.filterDeviceLogs (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/common/logger.js:62:16)     At EventEmitter.root.eventEmmiter.addListener (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/crawler/index.js:56:10)     At emitOne (events.js:116:13)     At EventEmitter.emit (events.js:211:7)     At WDClient.onSessionCreated (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/wd-client.js:54:21)     At that.send (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/wd-client.js:45:14) -----> Crawling Finished: <-----  TypeError: "file" argument must be a non-empty string

Comment out the logger.filterDeviceLogs(root.config) in index.js; The nosmoke command can be run normally. When all the a tags are clicked in the configuration file, the actual operation can open the page, but no click operation occurs. Can you help me to see what the problem is?

SamuelZhaoY commented 4 years ago

logger 的问题不影响pc-web 下的爬行实现, 应该是别的问题. 此处exception会修复

macaca-bot commented 4 years ago

This is the translated issue comment: @SamuelZhaoY


Logger problem does not affect the crawl achieved in pc-web, it should be another question. Here exception will be fixed