Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test basic login, contextual inscure password warning without saved logins</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="../../../satchel/test/satchel_common.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Login Manager test: contextual inscure password warning without saved logins
<script>
let chromeScript = runChecksAfterCommonInit();
</script>
<p id="display"></p>
<!-- we presumably can't hide the content for this test. -->
<div id="content">
<form id="form1" action="http://autocomplete:8888/formtest.js" onsubmit="return false;">
<input type="text" name="uname">
<input type="password" name="pword">
<button type="submit">Submit</button>
</form>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Login Manager: contextual insecure password warning without saved logins. **/
let uname = getFormElementByName(1, "uname");
let pword = getFormElementByName(1, "pword");
// Restore the form to the default state.
function restoreForm() {
uname.value = "";
pword.value = "";
uname.focus();
}
function spinEventLoop() {
return Promise.resolve();
}
add_setup(async () => {
listenForUnexpectedPopupShown();
});
add_task(async function test_form1_initial_empty() {
await SimpleTest.promiseFocus(window);
// Make sure initial form is empty.
checkLoginForm(uname, "", pword, "");
let popupState = await getPopupState();
is(popupState.open, false, "Check popup is initially closed");
});
add_task(async function test_form1_warning_entry() {
await SimpleTest.promiseFocus(window);
// Trigger autocomplete popup
restoreForm();
await popupBy();
let popupState = await getPopupState();
is(popupState.open, true, "Check popup is opened");
is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
let acEvents = await getTelemetryEvents({ process: "parent", filterProps: TelemetryFilterPropsAC, clear: true });
is(acEvents.length, 1, "One autocomplete event");
checkACTelemetryEvent(acEvents[0], uname, {
"hadPrevious": "0",
"insecureWarning": "1",
"loginsFooter": "1"
});
synthesizeKey("KEY_ArrowDown"); // select insecure warning
checkLoginForm(uname, "", pword, ""); // value shouldn't update just by selecting
synthesizeKey("KEY_Enter");
await spinEventLoop(); // let focus happen
checkLoginForm(uname, "", pword, "");
});
</script>
</pre>
</body>
</html>