问题描述
使用Xcode iOS工具UI自动化tuneup.js javascript库 https://github.com/alexvollmer/tuneup_js .
Using the Xcode iOS Instruments UI Automation tuneup.js javascript library https://github.com/alexvollmer/tuneup_js .
在了解我所推出的乐器的当前工作目录时,我遇到了挑战.
I'm having challenges understanding the current working diretory of my launched instrument.
我无法建立tuneup/tuneup.js脚本的相对路径.相对路径的目的地当然是 "tuneup/tuneup.js".但是起点是什么?
I have not been able to make a relative path to the tuneup/tuneup.js script. The destination of the relative path is of course "tuneup/tuneup.js". But what is the starting point?
代码如下:
// This works:
#import "/Users/mikes/Documents/Full/Path/To/File/Tests/tuneup/tuneup.js"
// These do not work:
//#import "tuneup/tuneup.js"
//#import "Tests/tuneup/tuneup.js"
//
// See https://github.com/alexvollmer/tuneup_js
//
test("First Screen", function(target, app) {
var window = app.mainWindow();
window.logElementTree();
});
请参见 tuneup.js报告找不到"变数"用于test()方法以解决相关问题.
See tuneup.js reports "Can't find variable" for test() method for a related question.
-谢谢
-迈克
推荐答案
我敢打赌这不起作用的原因是因为您在Instruments文档中创建了一个嵌入式脚本.您无需选择工具侧栏中的添加>创建脚本",而是选择添加>导入"并从文件系统导入脚本文件.这会将Instruments文档链接到您的脚本文件,并且当您使用#import
关键字时,它将在相对于脚本文件所在的目录中查找.
I'm willing to bet that the reason this isn't working is because you created an embedded script in the Instruments document. Instead of choosing "Add > Create Script" in the sidebar of instruments, you need to choose "Add > Import" and import your script file from the file system. That will link the Instruments document to your script file and when you use the #import
keyword, it will look in the directory relative to where your script file resides.
嵌入式(而不是导入)脚本没有当前目录",这就是为什么您需要到tuneup.js
文件的绝对路径的原因.
Embedded (as opposed to imported) scripts do not have a "current directory" which is why you need to absolute path to the tuneup.js
file.
这篇关于找不到导入的tuneup.js文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!