0
私は現在、フロントエンドアプリケーションの機能/動作テストを行うために "Intern.js"を使用しています(ボタンをクリックして、に)。JavaScript:既に定義されたタイプにメソッドをアタッチする方法
簡単なテストのようなものだろう:
bdd.describe('###### txtFirstName', function() {
bdd.it('must be a "text" type input', function() {
/** Begin the test */
let test =
/** Find the 'addUserModal' on the DOM and then find the 'txtFirstName' inside it */
helper.addUserModal.find.field.txtFirstName()
.getProperty('type')
.then(function(type) {
expect(type).to.equal('text');
})
.end()
/** End the test */
.end();
return test;
});
});
テストのこの部分のことを注意:
.getProperty('type')
.then(function(type) {
expect(type).to.equal('text');
})
.end()
がモーダル上のすべての入力を繰り返し、その代わりに、それを繰り返すことになりますすべてのテスト、私のような何かをやってみたかった:
/** Begin the test */
let test =
/** Find the 'addUserModal' on the DOM and then find the 'txtFirstName' inside it */
helper.addUserModal.find.field.txtFirstName()
.must.be.a.text.input()
/** End the test */
.end();
そして「must.be.a.text.input()」目を持っているでしょうe型アサーション
注目すべき重要なことは、それらの "Intern.js"メソッドがすべてPromiseを返すことです。
皆さんお気軽にお問い合わせください。
ありがとうございます!
"Intern.js" LIB:あなたはchai-as-promisedを使用しようとすることができ https://theintern.github.io/leadfoot/module-leadfoot_Command.html