Hi:
I am creating a UI test and a simple Logon is not consistently working.
My data is in the following json file:
{
"userName": "TestUser",
"passWord": "Abc1234!",
"loginForm": "form#loginForm"
}
My logon code is in is own code file:
var loginConfig = require('./loginPage.json');
function Login() {
LoginWith(loginConfig.userName, loginConfig.passWord);
}
function LoginWith(userName, passWord) {
casper.thenOpen(loginConfig.baseUrl, function OnToDoHomePage() {
this.waitForSelector(loginConfig.loginForm);
});
casper.then(function EnterTestUserNameAndPassword() {
var ret = this.fill(loginConfig.loginForm, {
'UserName': userName,
'Password': passWord
}, true);
});
}
The following casper properly submits the form:
casper.test.begin('Testing ToDo Logon', function(test) {
casper.then(function LoginWithGood() {
The following casper does not submits the form:
casper.test.begin( 'Testing ToDo Logon Failure', function(test) {
casper.then( function LoginAsBadUser() {
LoginWith( 'TestUser', 'badpassword' );
I capture after the failure to submit the form an the user name and password are filled in the respective input filed, but the page appears to not submitted.
Phil