summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html')
-rw-r--r--testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html158
1 files changed, 158 insertions, 0 deletions
diff --git a/testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html
new file mode 100644
index 0000000000..b68bf18309
--- /dev/null
+++ b/testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html
@@ -0,0 +1,158 @@
+<!DOCTYPE html> <meta charset="utf-8" />
+<title>Warn when errorFields don't match request[[options]]</title>
+<link rel="help" href="https://github.com/w3c/payment-request/pull/807" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="helpers.js"></script>
+<script>
+ test(() => {
+ assert_true(
+ "retry" in PaymentResponse.prototype,
+ "retry must be in prototype"
+ );
+ assert_true(
+ PaymentResponse.prototype.retry instanceof Function,
+ "retry must be a function"
+ );
+ }, "PaymentResponse.prototype must have a retry() function (smoke test).");
+
+ const defaultOptions = {
+ requestPayerName: false,
+ requestPayerEmail: false,
+ requestPayerPhone: false,
+ requestShipping: false,
+ };
+ function testShowWarning(button, errorFields) {
+ button.disabled = true;
+ promise_test(async () => {
+ const { response } = await getPaymentRequestResponse(defaultOptions);
+ await response.retry(errorFields);
+ await response.complete();
+ });
+ }
+</script>
+<h2>Manual Tests - Please run in order!</h2>
+<p>
+ Please open the developer console. Each of the tests below should generate a
+ warning in the developer console.
+</p>
+<p>When presented with the payment sheet, hit pay twice.</p>
+<ol>
+ <li>
+ <button onclick="testShowWarning(this, {payer: {name: 'Dont show this'}});">
+ Show warning if `requestPayerName` if false, and `errorFields.payer.name` is
+ present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {payer: {email: 'Dont show this'}});"
+ >
+ Show warning if `requestPayerEmail` if false, and `errorFields.payer.email`
+ is present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {payer: {phone: 'Dont show this'}});"
+ >
+ Show warning if `requestPayerPhone` if false, and `errorFields.payer.phone`
+ is present.
+ </button>
+ </li>
+ <li>
+ <button onclick="testShowWarning(this, {shippingAddress: {}});">
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {addressLine: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.addressLine` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {city: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.city` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {country: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.country` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {dependentLocality: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.dependentLocality` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {organization: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.organization` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {phone: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.phone` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {postalCode: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.postalCode` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {recipient: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.recipient` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {region: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.region` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {regionCode: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.regionCode` member present.
+ </button>
+ </li>
+ <li>
+ <button
+ onclick="testShowWarning(this, {shippingAddress: {sortingCode: 'Dont show this'}});"
+ >
+ Show warning if `requestShipping` if false, and
+ `errorFields.shippingAddress.sortingCode` member present.
+ </button>
+ </li>
+ <li><button onclick="done()">Done!</button></li>
+</ol>