Mercurial > bugzilla-dashboard
changeset 109:8335b1abc295
added verifications to system tests
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Fri, 30 Apr 2010 05:10:10 -0700 |
parents | 3ad618d3370f |
children | 4567dc69cb3e |
files | js/black-box.js |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/js/black-box.js Fri Apr 30 04:52:17 2010 -0700 +++ b/js/black-box.js Fri Apr 30 05:10:10 2010 -0700 @@ -22,13 +22,24 @@ }, _$: function _$(sel) { var query = this.jQuery(sel); + if (query.length == 0) throw new Error("selector yields no results: " + sel); if (query.length > 1) throw new Error("selector yields " + query.length + " results instead of 1: " + sel); + return query; }, + verifyVisible: function verifyVisible(field) { + this.queue.push( + function() { + var query = this.jQuery(field + ":visible"); + + if (query.length == 0) + throw new Error("selector not visible: " + field); + }); + }, type: function type(field, value) { this.queue.push(function() { this._$(field).val(value); }); }, @@ -41,18 +52,22 @@ auto.type("#login .username", "john@doe.com"); auto.type("#login .password", "test"); auto.submit("#login form"); + auto.verifyVisible("#header .requires-login"); + auto.verifyVisible("#header .requires-auth-login"); } function testLoginWithNoPassword(auto) { auto.type("#login .username", "john@doe.com"); auto.type("#login .password", ""); - auto.submit("#login form"); + auto.submit("#login form"); + auto.verifyVisible("#header .requires-login"); } function testLoginWithIncorrectPassword(auto) { auto.type("#login .username", "john@doe.com"); auto.type("#login .password", "u"); auto.submit("#login form"); + auto.verifyVisible("#errors .bugzilla-api-error"); } function setDashboardLoaded(delegate, window) {