AirtestProject / Poco

A cross-engine test automation framework based on UI inspection
http://airtest.netease.com/
Apache License 2.0
1.77k stars 318 forks source link

cocos2d-lua 我们公司的cocos版本是2.2.6,贵平台需要>=3.1版本,特来求助走投无路 #86

Open zhaoxianning opened 6 years ago

zhaoxianning commented 6 years ago

按照步骤接SDK后,运行报错 1、按照cocos官方文档接入SDK后提示: image

zhaoxianning commented 6 years ago

不知道改的对不对,反正就是换了个coco2的一个方法,不报错了,进去之后还是一直报错,现在拿不到UI树

   [C]: in function 'xpcall'
        [string "scripts/.\app/poco/poco_manager.lua"]:160: in function 'onRequest'
        [string "scripts/.\app/poco/poco_manager.lua"]:123: in function 'server_loop'
        [string "scripts/.\app/poco/poco_manager.lua"]:96: in function <[string "scripts/.\app/poco/poco_manager.lua"]:96>
closing Cocos Poco.
[rpc]closed
initializing Cocos poco.
[rpc]connected
[string "scripts/.\app/poco/Cocos2dxNode.lua"]:171: attempt to call method 'getDescription' (a nil value)
stack traceback:
        [string "scripts/.\app/poco/poco_manager.lua"]:174: in function 'getDescription'
        [string "scripts/.\app/poco/Cocos2dxNode.lua"]:171: in function <[string "scripts/.\app/poco/Cocos2dxNode.lua"]:80>
        (tail call): ?
        [string "scripts/.\app/poco/sdk/AbstractNode.lua"]:64: in function 'enumerateAttrs'
        [string "scripts/.\app/poco/sdk/AbstractDumper.lua"]:33: in function 'dumpHierarchyImpl'
        [string "scripts/.\app/poco/Cocos2dxFrozenDumper.lua"]:51: in function <[string "scripts/.\app/poco/Cocos2dxFrozenDumper.lua"]:50>
        (tail call): ?
        (tail call): ?
        [string "scripts/.\app/poco/poco_manager.lua"]:161: in function <[string "scripts/.\app/poco/poco_manager.lua"]:160>
        [C]: in function 'xpcall'
        [string "scripts/.\app/poco/poco_manager.lua"]:160: in function 'onRequest'
        [string "scripts/.\app/poco/poco_manager.lua"]:123: in function 'server_loop'
        [string "scripts/.\app/poco/poco_manager.lua"]:96: in function <[string "scripts/.\app/poco/poco_manager.lua"]:96>
adolli commented 6 years ago

在这个文件里app/poco/Cocos2dxNode.lua还有一个地方没改对,getChildren获取子节点列表时没获取对,你可以根据报错信息将所有cocos2dx 3.0以上的api都改成你们版本所用的,理论上没什么大的兼容性问题。

zhaoxianning commented 6 years ago

我们都改了API了,不报错了,还是不行啊

adolli commented 6 years ago

你现在游戏脚本里运行下面的代码调试下,看下打印出来的数据是否正常。

local json = require('dkjson')
local Dumper:dumpHierarchy= require('poco.Cocos2dxFrozenDumper')
local tree = Dumper:dumpHierarchy(true)
print(json.encode(tree))

然后检查是否有类似下面的log输出,没有的话就检查luasocket模块是否加载错或版本太旧。

[poco] server listens on tcp://*:%s

还可以将PocoManager.DEBUG = true来查看更多的调试信息。