Created
September 15, 2014 05:43
-
-
Save fwon/3a018d31790b2faccf8f to your computer and use it in GitHub Desktop.
casper filling and login test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casper.test.begin('test 163 mail login', 2, function(test) { | |
casper.start('http://mail.163.com/', function() { | |
this.capture('step1.png'); | |
test.assertExists('#loginBtn'); | |
this.fill('form', { | |
'username': 'xxx', | |
'password': 'xxx' | |
}, true); | |
this.click('#loginBtn'); | |
this.capture('step2.png'); | |
var timeout = 3000; | |
this.waitFor(function(){ | |
return this.getTitle().indexOf('网易邮箱') != -1; | |
}, function() { | |
this.echo('登录成功'); | |
this.capture('step3.png'); | |
}, function() { | |
this.capture('timeout.png'); | |
this.die('超时'); | |
}, timeout); | |
}).run(function() { | |
test.done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment