registerSuite({
name: 'login',
'login': function() {
return this.remote
.get(URL)
.findById('username')
.click()
.pressKeys(USER.ADMIN.USERNAME)
.end()
.findById('password')
.click()
.pressKeys(USER.ADMIN.PASSWORD)
.pressKeys('n')
.end()
.findByCssSelector('.login-welcome')
.getVisibleText()
.then(function(text) {
assert.strictEqual(text, USER.ADMIN.NAME, 'User should now be logged in');
});
}
});
00:19 | 0 | Send a sequence of key strokes to the active element. | password
COMMAND: POST keys
PARAMETERS: {"value":["password"]}
return this.remote
.get(URL)
.findById('username')
.click()
.pressKeys(USER.ADMIN.USERNAME)
.end()
.executeAsync(function (done) {
window._intern_done = done;
var script = document.createElement('script');
script.src = '/path/to/password_script.js';
document.head.appendChild(script);
})
.findByCssSelector('.login-welcome')
// continue testing
(function () {
// set the password
var passwordField = document.getElementById('password');
passwordField.value = 'secret password';
// clean up the _intern_done global we set in the executeAsync block
var done = window._intern_done;
delete window._intern_done;
// let Intern know we're done
done();
})();
name: 'login',
'login': function() {
return this.remote
.get(URL)
.findById('username')
.click()
.pressKeys(USER.ADMIN.USERNAME)
.end()
.findById('password')
.click()
.pressKeys(USER.ADMIN.PASSWORD)
.pressKeys('n')
.end()
.findByCssSelector('.login-welcome')
.getVisibleText()
.then(function(text) {
assert.strictEqual(text, USER.ADMIN.NAME, 'User should now be logged in');
});
}
});
00:19 | 0 | Send a sequence of key strokes to the active element. | password
COMMAND: POST keys
PARAMETERS: {"value":["password"]}
return this.remote
.get(URL)
.findById('username')
.click()
.pressKeys(USER.ADMIN.USERNAME)
.end()
.executeAsync(function (done) {
window._intern_done = done;
var script = document.createElement('script');
script.src = '/path/to/password_script.js';
document.head.appendChild(script);
})
.findByCssSelector('.login-welcome')
// continue testing
(function () {
// set the password
var passwordField = document.getElementById('password');
passwordField.value = 'secret password';
// clean up the _intern_done global we set in the executeAsync block
var done = window._intern_done;
delete window._intern_done;
// let Intern know we're done
done();
})();