Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/dalek/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
var Q = require('q');
var uuid = require('./uuid');
var cheerio = require('cheerio');
var urlParser = require('url');

// int. global
var reporter = null;
Expand Down Expand Up @@ -170,10 +171,15 @@ Actions.prototype.mouseEvent = function (type, selector) {
* @return {Actions}
*/

Actions.prototype.setHttpAuth = function (username, password) {
var hash = uuid();
var cb = this._generateCallbackAssertion('setHttpAuth', 'setHttpAuth', username, password, hash);
this._addToActionQueue([username, password, hash], 'setHttpAuth', cb);
Actions.prototype.setHttpAuth = function (username, password, location) {
if(username !== '' || password !== ''){
var tmpUrl = urlParser.parse(location);
tmpUrl.auth = username + ':' + password;
location = urlParser.format(tmpUrl);
var hash = uuid();
var cb = this._generateCallbackAssertion('open', 'open', location, hash);
this._addToActionQueue([location, hash], 'open', cb);
}
return this;
};

Expand Down