我是新来的功能测试和实习生。任何人都可以帮助我进行需要认证的网页的功能测试,即会话后面的网页。我已经安装了selenium web驱动程序,并且能够测试登录页面和一些静态页面,没有任何问题。如何调试实习生的功能测试js
例如/myproj/login
是登录页面。我能够测试它。现在当我试图测试/myproj/home/index
时,浏览器重定向到登录页面。我想测试这个页面应该是什么步骤?一些代码片段会让事情变得清晰。
registerSuite({
name: 'demo',
'submit form': function() {
remote = this.remote;
return remote
.get(require.toUrl('https://localhost/login'))
.findById('username')
.click()
.type('test')
.end()
.findById('password')
.click()
.type('test123')
.end()
.findByName('submit')
.click()
.end()
.then(pollUntil('return document.getElementById("osp_homepage_metric_selection_bar");', 30000))
.findById('osp_show_help_popup_trigger_parent')
.getVisibleText()
.then(function(resultText){
assert.equal(resultText, '<i class=" icon-question-sign"></i>','Test Failed!!!');
});
},
'landing page': function() {
return remote
.setFindTimeout(Infinity)
.findById('show_help_popup_trigger_parent')
.getVisibleText()
.then(function (resultText) {
assert.equal(resultText, '<i class=" icon-question-sign"></i>','Test Failed!!!');
});
}
});
在此先感谢
马尼什
感谢您的回应,但我无法完成它。你能告诉我在哪里可以打印调试消息的输出吗?如果我做console.log它不输出任何东西到控制台。如果你可以指向一些链接,我可以看到调试实习生js,这将是很好的。 – 2014-10-07 06:59:51
要在命令链中执行console.log,必须使用'then'块,如'.then(function(){console.log(“something”);})'。至于调试实习生测试,在http://www.sitepen.com/blog/2014/05/23/how-can-i-debug-intern-tests/上有一篇非常详细的博文。 – jason0x43 2014-10-07 11:34:19