import tuneup.js file not found

别来无恙 提交于 2019-12-02 07:09:26

问题


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.

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?

Here's the code:

// 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();

});

See tuneup.js reports "Can't find variable" for test() method for a related question.

-Thanks

-Mike


回答1:


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.

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.



来源:https://stackoverflow.com/questions/15387150/import-tuneup-js-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!