Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #29986 from albertopq/1157128-uplift-v2.2
Browse files Browse the repository at this point in the history
Bug 1157128 - Fix display of auth inputs. r=kgrandon
  • Loading branch information
albertopq committed May 11, 2015
2 parents 528ef60 + 4bb3878 commit cc0014b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
8 changes: 5 additions & 3 deletions apps/system/js/app_authentication_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@
</gaia-header>
<span class="authentication-dialog-http-authentication-message">
</span>
<label data-l10n-id="username">
<label>
<span data-l10n-id="username"></span>
<input type="text" class="authentication-dialog-http-username-input" />
</label>
<label data-l10n-id="password">
<label>
<span data-l10n-id="password"></span>
<input type="password"
class="authentication-dialog-http-password-input" />
class="authentication-dialog-http-password-input" />
</label>
</section>`;
};
Expand Down
24 changes: 24 additions & 0 deletions apps/system/test/marionette/app_authentication_dialog_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,28 @@ marionette('App Authentication Dialog',
return !authDialog.displayed();
});
});

test('user can login', function() {
var url = server.url('sample.html');
server.protect(url);

// Open the first URL in a sheet.
rocketbar.homescreenFocus();
rocketbar.enterText(url + '\uE006');

var authDialog;
client.waitFor(function() {
authDialog = system.appAuthDialog;
return authDialog.displayed();
});

system.appAuthDialogUsername.sendKeys('username');
system.appAuthDialogPassword.sendKeys('password');

system.appAuthDialogLogin.tap();
client.waitFor(function() {
return !authDialog.displayed();
});
});

});
14 changes: 14 additions & 0 deletions apps/system/test/marionette/lib/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ System.Selector = Object.freeze({
'gaia-header',
appAuthDialogLogin: '.appWindow.active .authentication-dialog.visible ' +
'button.authentication-dialog-http-authentication-ok',
appAuthDialogUsername: '.appWindow.active .authentication-dialog.visible ' +
'.authentication-dialog-http-username-input',
appAuthDialogPassword: '.appWindow.active .authentication-dialog.visible ' +
'.authentication-dialog-http-password-input',
appContextMenuSaveLink:
'.appWindow.active .contextmenu [data-id="save-link"]',
appWindow: '.appWindow',
Expand Down Expand Up @@ -107,6 +111,16 @@ System.prototype = {
System.Selector.appAuthDialogLogin);
},

get appAuthDialogUsername() {
return this.client.helper.waitForElement(
System.Selector.appAuthDialogUsername);
},

get appAuthDialogPassword() {
return this.client.helper.waitForElement(
System.Selector.appAuthDialogPassword);
},

get appContextMenuSaveLink() {
return this.client.helper.waitForElement(
System.Selector.appContextMenuSaveLink);
Expand Down
4 changes: 3 additions & 1 deletion shared/test/integration/server_child.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ Server.prototype = {
}

// Handle protected URLs.
if (server.authUrls[fullUrl]) {
// Users can login with 'username' and 'password'
if (server.authUrls[fullUrl] &&
req.headers.authorization !== 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=') {
res.writeHead(401, {
'WWW-Authenticate': 'Basic realm="login required"'
});
Expand Down

0 comments on commit cc0014b

Please sign in to comment.