Files
sousa-gecko/testing/web-platform/tests/web-based-payment-handler/payment-request-reject-operation-error-manual.https.html
T
Stephen McGruer 140f18c2ac Bug 2029837 [wpt PR 59002] - Payment Handler: Add test for OperationError propagation, a=testonly
Automatic update from web-platform-tests
Payment Handler: Add test for OperationError propagation (#59002)

This change adds a new manual test to verify that if a web-based payment
handler rejects the promise passed to respondWith with an OperationError,
the original PaymentRequest.show() call also rejects with an OperationError.

For other error types (like SyntaxError), show() should still reject with
an AbortError.

Spec: https://github.com/w3c/web-based-payment-handler/issues/428
--

wpt-commits: 5bc484399a7de139464d759716435537e368cc00
wpt-pr: 59002
2026-04-28 18:14:44 +00:00

34 lines
1.8 KiB
HTML

<!doctype html>
<meta charset="utf-8">
<title>Manual Tests for rejecting respondWith with errors</title>
<link rel="help" href="https://w3c.github.io/web-based-payment-handler/#the-paymentrequestevent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>This test verifies that if a payment app rejects the promise passed to <code>respondWith</code> with an <code>OperationError</code>, the original <code>PaymentRequest.show()</code> call also rejects with an <code>OperationError</code>. For other error types, it should still reject with an <code>AbortError</code>.</p>
<p>Please follow these instructions:</p>
<ol>
<li>For the first test (<b>OperationError</b>), click "Reject with OperationError".</li>
<li>For the second test (<b>SyntaxError</b>), click "Reject with SyntaxError".</li>
</ol>
<script>
const methodName = window.location.origin + '/web-based-payment-handler/'
+ 'payment-request-reject-errors-manifest.json';
promise_test(async t => {
const request = new PaymentRequest([{supportedMethods: methodName}], {
total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}},
});
// show() should reject with the SAME error if it's OperationError.
await promise_rejects_dom(t, 'OperationError', request.show());
}, 'If a payment app rejects with OperationError, show() rejects with OperationError');
promise_test(async t => {
const request = new PaymentRequest([{supportedMethods: methodName}], {
total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}},
});
// show() should reject with AbortError for other error types.
await promise_rejects_dom(t, 'AbortError', request.show());
}, 'If a payment app rejects with SyntaxError, show() rejects with AbortError');
</script>