Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: a11y_checks
- Manifest: toolkit/components/passwordmgr/test/browser/browser.toml
/**
* Test that the password capture doorhanger is keyboard-reachable as soon as it
* by the "noautofocus" attribute on the shared notification panel: when it is
* removed the panel joins the tab ring, when it is set to "true" the panel is
* unreachable with Tab.
*/
const FORM_URL =
"passwordmgr/test/browser/form_basic.html";
async function checkDoorhangerKeyboardReachable({ oldPassword, expectedType }) {
if (oldPassword) {
await Services.logins.addLoginAsync(
LoginTestUtils.testData.formLogin({
username: "username",
password: oldPassword,
})
);
}
const formProcessedPromise = listenForTestNotification("FormProcessed");
await BrowserTestUtils.withNewTab(
{ gBrowser, url: FORM_URL },
async function (browser) {
await SimpleTest.promiseFocus(browser.documentGlobal);
await formProcessedPromise;
await changeContentFormValues(browser, {
"#form-basic-username": "username",
"#form-basic-password": "newPassword",
});
let promiseShown = BrowserTestUtils.waitForEvent(
PopupNotifications.panel,
"popupshown"
);
let formSubmittedPromise = listenForTestNotification([
"FormProcessed",
"ShowDoorhanger",
]);
await SpecialPowers.spawn(browser, [], async function () {
this.content.document.getElementById("form-basic").submit();
});
await formSubmittedPromise;
let notif = await waitForDoorhanger(browser, expectedType);
await promiseShown;
ok(
!PopupNotifications.panel.hasAttribute("noautofocus"),
`${expectedType} doorhanger is keyboard focusable on initial submission`
);
await cleanupDoorhanger(notif);
}
);
await Services.logins.removeAllUserFacingLoginsAsync();
}
add_task(async function test_save_doorhanger_is_keyboard_reachable() {
await checkDoorhangerKeyboardReachable({ expectedType: "password-save" });
});
add_task(async function test_change_doorhanger_is_keyboard_reachable() {
await checkDoorhangerKeyboardReachable({
oldPassword: "password",
expectedType: "password-change",
});
});