【问题标题】:Intern with Phantomjs GhostDriverPhantomjs GhostDriver 实习生
【发布时间】:2013-07-01 21:36:54
【问题描述】:

我正在尝试设置 Intern 在 Windows 7 机器上使用 PhantomJS 运行

现在我的设置如下:

演示测试root/unit/tests/phantom.js:

define([
    'intern!object',
    'intern/chai!assert'
], function(registerSuite, assert) {

registerSuite({
    name: 'PhantomTest',

    'dummy': function () {
        assert(true, "Works!");
    }

});

});

配置文件root/unit/intern.config.js

define({

proxyPort: 9000,

proxyUrl: 'http://localhost:9000/',

capabilities: {
    'selenium-version': '2.30.0'
},

environments: [
    {
      browserName: 'phantom'
    }
],
maxConcurrency: 3,

useSauceConnect: false,

webdriver: {
    host: 'localhost',
    port: 4444
},

// used here
loader: {
},

suites: [ 'unit/tests/phantom.js' ],


functionalSuites: [ /* 'myPackage/tests/functional' */ ],


excludeInstrumentation: /^tests\//
});

通过在浏览器中运行此测试和配置,它就可以工作了。

要使用 PhantomJS 运行 Intern,我执行:

phantomjs --webdriver=4444

还有:

cd root
node node_modules\intern\runner.js config=unit/intern.config

运行 Phantomjs 的控制台然后返回:

[INFO  - 2013-07-01T21:29:07.253Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 42ba5b50-e295-11e2-86f7-e331eb8b922d

而另一个输出以下消息而没有任何进一步的日志:

Defaulting to "runner" reporter
Listening on 0.0.0.0:9000
Initialised phantomjs 1.9.1 on windows-7-32bit

关于我缺少什么的任何提示?

【问题讨论】:

    标签: javascript phantomjs intern


    【解决方案1】:

    原因是https://github.com/ariya/phantomjs/issues/10522; phantomjs 正在使用一个非常旧的 JavaScriptCore 版本,它没有 Function.prototype.bind。此时最好的选择是切换到使用 geezer 版本的 Intern,它应该可以在这个旧环境中正常工作。

    【讨论】:

    • 感谢您的回复。我会尽快尝试你的解决方案
    • 我已经成功了。首先,我按照您的建议下载并安装了 geezer 分支,但没有任何改变。然后我玩了一下suites 路径,发现解析'unit/tests/phantom.js' 的起点是node_modules/intern 文件夹。将套件路径更改为“../../unit/tests/phantom.js”有效。使用 Firefox 和 chrome 的 Selenium 也会发生同样的事情,没有在 IE 上测试。
    • 您不应在 AMD 模块标识符的末尾包含“.js”;这使加载器认为您正在尝试加载纯 JS 文件,而不是 AMD 模块,它绕过了一些路径解析代码。但是,我会确保有人检查以确保 geezer 分支中没有错误。
    • 愚蠢的错误:(通过删除.js 'unit/tests/phantom' 路径有效。感谢您的支持并为给您带来的不便表示歉意。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-04
    • 2013-12-20
    相关资源
    最近更新 更多