fedcm-error-basic.https.html (2956B)
1 <!DOCTYPE html> 2 <title>Federated Credential Management API Error API 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 10 <script type="module"> 11 import {request_options_with_mediation_required, 12 fedcm_test, 13 manifest_origin, 14 select_manifest, 15 fedcm_get_and_select_first_account, 16 fedcm_error_dialog_dismiss, 17 fedcm_error_dialog_click_button} from './support/fedcm-helper.sub.js'; 18 19 const url_prefix = manifest_origin + '/fedcm/support/'; 20 21 fedcm_test(async t => { 22 let test_options = 23 request_options_with_mediation_required("manifest_id_assertion_endpoint_returns_error_format.json"); 24 await select_manifest(t, test_options); 25 26 try { 27 const cred = fedcm_get_and_select_first_account(t, test_options); 28 fedcm_error_dialog_dismiss(t); 29 await cred; 30 assert_unreached("An IdentityCredentialError exception should be thrown."); 31 } catch (e) { 32 assert_true(e instanceof DOMException); 33 assert_equals(e.name, "IdentityCredentialError"); 34 assert_equals(e.error, "unauthorized_client"); 35 assert_equals(e.url, url_prefix + "error.html"); 36 } 37 }, 'Test that the promise is rejected with proper error details when dialog is dismissed'); 38 39 fedcm_test(async t => { 40 let test_options = 41 request_options_with_mediation_required("manifest_id_assertion_endpoint_returns_error_format.json"); 42 await select_manifest(t, test_options); 43 44 try { 45 const cred = fedcm_get_and_select_first_account(t, test_options); 46 fedcm_error_dialog_click_button(t, "ErrorGotIt"); 47 await cred; 48 assert_unreached("An IdentityCredentialError exception should be thrown."); 49 } catch (e) { 50 assert_true(e instanceof DOMException); 51 assert_equals(e.name, "IdentityCredentialError"); 52 assert_equals(e.error, "unauthorized_client"); 53 assert_equals(e.url, url_prefix + "error.html"); 54 } 55 }, 'Test that the promise is rejected with proper error details when got it is clicked'); 56 57 fedcm_test(async t => { 58 let test_options = 59 request_options_with_mediation_required("manifest_id_assertion_endpoint_returns_error_format.json"); 60 await select_manifest(t, test_options); 61 62 try { 63 const cred = fedcm_get_and_select_first_account(t, test_options); 64 fedcm_error_dialog_click_button(t, "ErrorMoreDetails"); 65 await cred; 66 assert_unreached("An IdentityCredentialError exception should be thrown."); 67 } catch (e) { 68 assert_true(e instanceof DOMException); 69 assert_equals(e.name, "IdentityCredentialError"); 70 assert_equals(e.error, "unauthorized_client"); 71 assert_equals(e.url, url_prefix + "error.html"); 72 } 73 }, 'Test that the promise is rejected with proper error details when more details is clicked'); 74 75 </script>