Vueアプリケーションのe2eテストを書いています。私はこの投稿を待ちます:waitForTextと私はそれを試してみることにしました。ノードv9.11.1でナイトウォッチv0.9.21を使用しています。
私のテストは次のようになります。
beforeEach: function(browser) {
const devServer = browser.globals.devServerURL;
browser
.url(devServer)
.waitForElementVisible('#AuthenticationWrapper', 5000)
.setValue('input[type=text]', 'demo@demo.com')
.setValue('input[type=password]', 'demo')
.click('button')
.pause(4000)
.useXpath()
.waitForText('//*[@id="userMenu"]/div[1]/div/button/div', (text) => {
return text == 'DEMO USER';
});
},
しかし、テストを実行すると、次のエラーが表示されます。
TypeError: browser.url(...).waitForElementVisible(...).setValue(...).setValue(...).click(...).pause(...).useXpath(...).waitForText is not a function
どうすればこれを解決できますか?
回答 1 件
プロジェクトに「nightwatch-commands」ノードjsパッケージをインストールしていないようです。
以下のリンクhttps://www.npmjs.com/package/nightwatch-commandsに記載されている手順に従ってください