test_simple.html (1819B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Happypath Test</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script src="head.js"></script> 8 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 9 <script> 10 SimpleTest.waitForExplicitFinish(); 11 setupTest("simple").then( 12 function () { 13 SpecialPowers.wrap(document).notifyUserGestureActivation(); 14 return navigator.credentials.get({ 15 identity: { 16 mode: "active", 17 providers: [{ 18 configURL: "https://example.net/tests/dom/credentialmanagement/identity/tests/mochitest/server_manifest.sjs", 19 clientId: "mochitest", 20 nonce: "nonce" 21 }] 22 } 23 }); 24 } 25 ).then((cred) => { 26 ok(true, "successfully got a credential"); 27 is(cred.token, 28 "account_id=1234&client_id=mochitest&nonce=nonce&disclosure_text_shown=false&is_auto_selected=false", 29 "Correct token on the credential."); 30 is(cred.id, 31 "1234", 32 "Correct id on the credential"); 33 is(cred.type, 34 "identity", 35 "Correct type on the credential"); 36 is(cred.isAutoSelected, false, "Correct isAutoSelected credential"); 37 is(cred.configURL, "https://example.net/tests/dom/credentialmanagement/identity/tests/mochitest/server_manifest.sjs", "Correct configURL on the credential"); 38 }).catch(() => { 39 ok(false, "must not have an error"); 40 }).finally(() => { 41 SimpleTest.finish(); 42 }) 43 </script> 44 </head> 45 <body> 46 <p id="display"></p> 47 <div id="content" style="display: none">This is the main happypath test. We get a credential in a way that should work. This includes simplifying some logic like exactly one account and provider.</div> 48 <pre id="test"></pre> 49 </body> 50 </html>