2017-08-10 4 views
0

ember 2.13アプリをテストしています。私は、ページタイトルの値を取得したいが、テストスイートのページからタイトルをつかむことからdocument.titleとする。 シンプルなember-qunit機能を見落としているかもしれません。何かヒント?AUTからacceptance test - Ember 2からdocument.titleを取得します。

+0

qunitは、独自のindex.htmlページを使用して、あなたは 'document.title'を使用する場合、その中にタイトルが取得されます。テストする機能の中でタイトルを動的に変更するまでは、qunitに関連するindex.htmlの 'title'が呼び出されます。 – Sumit

+0

それは私がSumit 33に気付いたことです。それで、AUTのドキュメントタイトルをテストで取得する方法を探しているのはなぜですか。 – j4v1

答えて

0

恐ろしいかもしれませんが、http://tim-evans.github.io/ember-page-title/を使用できます。そして、彼らが行うようにそれをテストします。

// Testem appends progress to the title... 
// and there's no way to stop this at the moment 
function title() { 
    return findWithAssert('title', 'head').text().trim().replace(/^\(\d+\/\d+\)/, ''); 
} 

test('the default configuration works', async function (assert) { 
    assert.expect(1); 
    await visit('/posts'); 

    assert.equal(title(), 'My App | Posts'); 
}); 

https://github.com/tim-evans/ember-page-title/blob/master/tests/acceptance/posts-test.js#L17-L28

関連する問題