diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/credential-management/fedcm-button-and-other-account/fedcm-use-other-account-button-flow.tentative.https.html | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/credential-management/fedcm-button-and-other-account/fedcm-use-other-account-button-flow.tentative.https.html')
-rw-r--r-- | testing/web-platform/tests/credential-management/fedcm-button-and-other-account/fedcm-use-other-account-button-flow.tentative.https.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/testing/web-platform/tests/credential-management/fedcm-button-and-other-account/fedcm-use-other-account-button-flow.tentative.https.html b/testing/web-platform/tests/credential-management/fedcm-button-and-other-account/fedcm-use-other-account-button-flow.tentative.https.html new file mode 100644 index 0000000000..996523af84 --- /dev/null +++ b/testing/web-platform/tests/credential-management/fedcm-button-and-other-account/fedcm-use-other-account-button-flow.tentative.https.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<title>Federated Credential Management API Use Another Account API tests.</title> +<link rel="help" href="https://fedidcg.github.io/FedCM"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<script type="module"> +import {request_options_with_mediation_required, + fedcm_test, + fedcm_get_dialog_type_promise, + manifest_origin, + open_and_wait_for_popup, + select_manifest} from '../support/fedcm-helper.sub.js'; + +const url_path = '/credential-management/support/fedcm/' +const url_prefix = manifest_origin + url_path; + +async function set_accounts_cookie(value) { + await open_and_wait_for_popup(manifest_origin, url_path + 'set_accounts_cookie.py?' + value); +} + +fedcm_test(async t => { + await set_accounts_cookie("1"); + + let test_options = + request_options_with_mediation_required("manifest_with_variable_accounts.json"); + test_options.identity.mode = "button"; + await select_manifest(t, test_options); + + // Trigger FedCM and wait for the initial dialog. + let cred_promise = null; + await test_driver.bless('initiate FedCM request', async function() { + cred_promise = navigator.credentials.get(test_options); + }); + + let type = await fedcm_get_dialog_type_promise(t); + assert_equals(type, "AccountChooser"); + + // Tell the account endpoint to now return 2 accounts and click use other account. + await set_accounts_cookie("2"); + await window.test_driver.click_fedcm_dialog_button("ConfirmIdpLoginContinue"); + + // Wait for the account chooser to appear again. + type = await fedcm_get_dialog_type_promise(t); + assert_equals(type, "AccountChooser"); + + await window.test_driver.select_fedcm_account(1); + const cred = await cred_promise; + assert_equals(cred.token, "account_id=jane_doe"); +}, 'Test that the "Use Other Account" button works correctly.'); + + +fedcm_test(async t => { + await set_accounts_cookie("1"); + + let test_options = + request_options_with_mediation_required("manifest_with_variable_accounts.json"); + test_options.identity.mode = "button"; + await select_manifest(t, test_options); + + // Trigger FedCM and wait for the initial dialog. + let cred_promise = null; + await test_driver.bless('initiate FedCM request', async function() { + cred_promise = navigator.credentials.get(test_options); + }); + + let type = await fedcm_get_dialog_type_promise(t); + assert_equals(type, "AccountChooser"); + + // Click use other account but without changing the account returned. + await window.test_driver.click_fedcm_dialog_button("ConfirmIdpLoginContinue"); + + // Wait for the account chooser to appear again. + type = await fedcm_get_dialog_type_promise(t); + assert_equals(type, "AccountChooser"); + + await window.test_driver.select_fedcm_account(0); + const cred = await cred_promise; + assert_equals(cred.token, "account_id=1234"); +}, 'Test that the "Use Other Account" button works correctly when accounts do not change.'); + +</script> |