fedcm-loginhint.https.html (1644B)
1 <!DOCTYPE html> 2 <title>Federated Credential Management API login hint tests.</title> 3 <meta name="timeout" content="long"> 4 <link rel="help" href="https://fedidcg.github.io/FedCM"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <body> 10 11 <script type="module"> 12 import {fedcm_test, 13 request_options_with_login_hint, 14 select_manifest, 15 fedcm_get_dialog_type_promise, 16 fedcm_get_and_select_first_account} from './support/fedcm-helper.sub.js'; 17 18 fedcm_test(async t => { 19 let options = request_options_with_login_hint('manifest.py', 'nomatch'); 20 const cred = navigator.credentials.get(options); 21 // We expect a mismatch dialog. 22 const type = await fedcm_get_dialog_type_promise(t); 23 assert_equals(type, 'ConfirmIdpLogin'); 24 window.test_driver.cancel_fedcm_dialog(); 25 return promise_rejects_dom(t, "NetworkError", cred); 26 }, "No login hint matches an account."); 27 28 fedcm_test(async t => { 29 const options = request_options_with_login_hint('manifest.py', 'john_doe'); 30 const cred = await fedcm_get_and_select_first_account(t, options); 31 assert_equals(cred.token, 'token'); 32 }, "Login hint matches an account."); 33 34 fedcm_test(async t => { 35 let options = request_options_with_login_hint('manifest_with_two_accounts.json', 'john_doe'); 36 await select_manifest(t, options); 37 38 const cred = await fedcm_get_and_select_first_account(t, options); 39 assert_equals(cred.token, 'account_id=john_doe'); 40 }, "Login hint matches an account from two accounts."); 41 </script>