I am trying to write a nightwatch test script with conditions in the test script. My code so far
module.exports = {
tags: ['getting-started'],
set_url: function (browser) {
browser.url('http://www.google.com');
browser.pause(5000);
browser.assert.title('Google');
if (browser.expect.element('#main').to.be.present) {
browser.pause(5000);
browser.setValue('input[type=text]', ['Night Watcher', browser.Keys.ENTER]);
browser.pause(5000);
if(browser.assert.containsText('#main', 'The Night Watch')){
console.log('search has the right result'); // for example
}else{
console.log('No result found');
}
}
browser.end();
}
} But the browser.expect.element('#main').to.be.present
and browser.assert.containsText('#main', 'The Night Watch')
returns an object and is not actually the result I am interested with. But the browser.expect.element('#main').to.be.present
and browser.assert.containsText('#main', 'The Night Watch')
returns an object and is not actually the result I am interested with.
via Chum H
No comments:
Post a Comment