機能テストで Dojo モジュールを使用すると問題が発生します。定義されてwindow
いないエラーまたは定義されていないエラーが表示され続けdocument
ます。
私は現在、そのdijit/registry
ようなものを使用しようとしています(これまでのところ、そのモジュールをインポートするだけです)..
define([
'intern!object',
'intern/chai!assert',
'require',
'dijit/registry'
], function (registerSuite, assert, require, registry) {
registerSuite({
name: 'login',
'load and login': function () {
return this.remote.get(require.toUrl('http://application.co.uk/'))
.elementById('input1')
.click()
.type("username")
.end()
.elementById('input2')
.click()
.type("password")
.end()
.elementById('rememberMe')
.click()
.end()
.elementByName('Login.Submit')
.click()
.end()
.wait(5000)
.title()
.then(function (title) {
assert.strictEqual(title, 'Application title');
});
}
});
});
...そして、ノードから次のエラーが発生しています...
$ ./libs/intern/bin/intern-runner.js config=test/intern
Defaulting to "runner" reporter
Listening on 0.0.0.0:9000
c:/.../libs/dojo/_base/unload.js:6
var win = window;
^
ReferenceError: window is not defined
at c:/.../libs/dojo/_base/unload.js:6:11
at execModule (c:\...\libs\intern\node_modules\dojo\dojo.js:512:54)
at c:\...\libs\intern\node_modules\dojo\dojo.js:501:12
at Array.map (native)
at execModule (c:\...\libs\intern\node_modules\dojo\dojo.js:496:17)
at c:\...\libs\intern\node_modules\dojo\dojo.js:501:12
at Array.map (native)
at execModule (c:\...\libs\intern\node_modules\dojo\dojo.js:496:17)
at c:\...\libs\intern\node_modules\dojo\dojo.js:501:12
at Array.map (native)
同様の方法での使用に関するdojo/text!
以前の質問を読んだことがありますが、これは、Internのgeezerバージョンがこれを処理できることを示しているようです?
レジストリ モジュールがなくても、テストは正常に実行されます。
アップデート
C Snoverの応答に基づいて、コードは機能テストではなくWebブラウザーのコンテキスト内にある必要があるため、Webドライバーメソッドdijit/registry
の外部のようなものを活用することはできません。execute()