Nightwatch則可以使用node書寫端對端的測試用例,并在Selenium server服務端運行測試,同樣支持同步和異步。
this.demoTestGoogle = function (browser) { browser .url('http://www.google.com') .waitForElementVisible('body', 1000) .setValue('input[type=text]', 'nightwatch') .waitForElementVisible('button[name=btnG]', 1000) .click('button[name=btnG]') .pause(1000) .assert.containsText('#main', 'The Night Watch') .end(); }; |
原文轉自:http://jixianqianduan.com/frontend-javascript/2016/11/22/front-end-auto-test.html