From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/payment-request/META.yml | 7 + .../methodDetails-attribute.https.html | 32 ++ .../methodName-attribute.https.html | 28 ++ .../constructor.http.html | 12 + .../constructor.https.html | 52 +++ .../updatewith-method.https.html | 62 +++ .../retry-shows-error-member-manual.https.html | 50 +++ .../retry-shows-payer-member-manual.https.html | 65 +++ .../constructor_convert_method_data.https.html | 73 ++++ .../delegate-request.https.sub.html | 81 ++++ .../tests/payment-request/historical.https.html | 45 ++ .../payment-request/idlharness.https.window.js | 31 ++ .../onpaymentmethodchange-attribute.https.html | 79 ++++ .../payment-request/payment-is-showing.https.html | 170 ++++++++ .../payment-request-abort-method.https.html | 91 ++++ ...ayment-request-canmakepayment-method.https.html | 120 ++++++ .../payment-request-constructor.https.sub.html | 477 +++++++++++++++++++++ ...equest-ctor-currency-code-checks.https.sub.html | 282 ++++++++++++ ...ayment-request-ctor-pmi-handling.https.sub.html | 149 +++++++ ...yment-request-disallowed-when-hidden.https.html | 48 +++ ...edinstrument-method-manual.tentative.https.html | 95 ++++ ...strument-method-protection.tentative.https.html | 68 +++ ...senrolledinstrument-method.tentative.https.html | 78 ++++ .../payment-request-id-attribute.https.html | 39 ++ .../payment-request-insecure.http.html | 13 + .../payment-request-not-exposed.https.worker.js | 7 + .../payment-request-show-method.https.html | 105 +++++ .../complete-method-manual.https.html | 101 +++++ .../payment-request/payment-response/helpers.js | 110 +++++ .../methodName-attribute-manual.https.html | 28 ++ ...onpayerdetailchange-attribute-manual.https.html | 73 ++++ .../onpayerdetailchange-attribute.https.html | 14 + .../payerEmail-attribute-manual.https.html | 48 +++ .../payerName-attribute-manual.https.html | 48 +++ .../payerPhone-attribute-manual.https.html | 48 +++ ...lschange-updateWith-immediate-manual.https.html | 68 +++ ...payerdetailschange-updateWith-manual.https.html | 56 +++ .../rejects_if_not_active-manual.https.html | 160 +++++++ .../requestId-attribute-manual.https.html | 34 ++ .../rejects_if_not_active.https.html | 142 ++++++ .../resources/delegate-request-subframe.sub.html | 38 ++ .../tests/payment-request/resources/page1.html | 1 + .../tests/payment-request/resources/page2.html | 1 + .../show-consume-activation.https.html | 52 +++ ...show-method-optional-promise-rejects.https.html | 215 ++++++++++ .../show-method-postmessage-iframe.html | 49 +++ .../show-method-postmessage-manual.https.html | 53 +++ .../user-abort-algorithm-manual.https.html | 80 ++++ 48 files changed, 3778 insertions(+) create mode 100644 testing/web-platform/tests/payment-request/META.yml create mode 100644 testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html create mode 100644 testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html create mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html create mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html create mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html create mode 100644 testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/constructor_convert_method_data.https.html create mode 100644 testing/web-platform/tests/payment-request/delegate-request.https.sub.html create mode 100644 testing/web-platform/tests/payment-request/historical.https.html create mode 100644 testing/web-platform/tests/payment-request/idlharness.https.window.js create mode 100644 testing/web-platform/tests/payment-request/onpaymentmethodchange-attribute.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-is-showing.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-abort-method.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-constructor.https.sub.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-disallowed-when-hidden.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-id-attribute.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-insecure.http.html create mode 100644 testing/web-platform/tests/payment-request/payment-request-not-exposed.https.worker.js create mode 100644 testing/web-platform/tests/payment-request/payment-request-show-method.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/helpers.js create mode 100644 testing/web-platform/tests/payment-request/payment-response/methodName-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/payerEmail-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/payerName-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/payerPhone-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/requestId-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/rejects_if_not_active.https.html create mode 100644 testing/web-platform/tests/payment-request/resources/delegate-request-subframe.sub.html create mode 100644 testing/web-platform/tests/payment-request/resources/page1.html create mode 100644 testing/web-platform/tests/payment-request/resources/page2.html create mode 100644 testing/web-platform/tests/payment-request/show-consume-activation.https.html create mode 100644 testing/web-platform/tests/payment-request/show-method-optional-promise-rejects.https.html create mode 100644 testing/web-platform/tests/payment-request/show-method-postmessage-iframe.html create mode 100644 testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html (limited to 'testing/web-platform/tests/payment-request') diff --git a/testing/web-platform/tests/payment-request/META.yml b/testing/web-platform/tests/payment-request/META.yml new file mode 100644 index 0000000000..1dbe3e5d7e --- /dev/null +++ b/testing/web-platform/tests/payment-request/META.yml @@ -0,0 +1,7 @@ +spec: https://w3c.github.io/payment-request/ +suggested_reviewers: + - marcoscaceres + - rsolomakhin + - zouhir + - romandev + - aestes diff --git a/testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html b/testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html new file mode 100644 index 0000000000..feaaef66ad --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html @@ -0,0 +1,32 @@ + + +Test for PaymentMethodChangeEvent.methodDetails attribute + + + + diff --git a/testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html b/testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html new file mode 100644 index 0000000000..176638c785 --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html @@ -0,0 +1,28 @@ + + +Test for PaymentMethodChangeEvent.methodName attribute + + + + diff --git a/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html new file mode 100644 index 0000000000..db7765f7bf --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html @@ -0,0 +1,12 @@ + + + +Test for PaymentRequestUpdateEvent Constructor (insecure) + + + + diff --git a/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html new file mode 100644 index 0000000000..3de0469e9c --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html @@ -0,0 +1,52 @@ + + + +Test for PaymentRequestUpdateEvent Constructor + + + + diff --git a/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html new file mode 100644 index 0000000000..9a60fe7a4c --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html @@ -0,0 +1,62 @@ + + + +Test for PaymentRequestUpdateEvent's updateWith() method + + + + diff --git a/testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html b/testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html new file mode 100644 index 0000000000..9135520cd7 --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html @@ -0,0 +1,50 @@ + + + + + PaymentValidationErrors' `error` member + + + + + +

+ Manual Test for PaymentValidationErrors's `error` member - Please run in order! +

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When presented with the payment sheet, use any card and select to "Pay". + You will be asked to retry the payment and an error should be shown somewhere + in the UI. The expected error string is described in each individual test. + If you see the error, hit "Pay" again. If you don't see the error, + abort the payment request by hitting "esc" - which means that particular test + has failed. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
+ + If you find a buggy test, please file a bug + and tag one of the owners. + diff --git a/testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html b/testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html new file mode 100644 index 0000000000..f8115e69ec --- /dev/null +++ b/testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html @@ -0,0 +1,65 @@ + + + + + PaymentValidationErrors' `payer` member + + + + + +

+ Manual Test for PaymentValidationErrors' `payer` member - Please run in order! +

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When presented with the payment sheet, use any card and select to "Pay". + You will be asked to retry the payment and an error should be shown somewhere + in the UI. The expected error string is described in each individual test. + If you see the error, hit "Pay" again. If you don't see the error, + abort the payment request by hitting "esc" - which means that particular test + has failed. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
+ + If you find a buggy test, please file a bug + and tag one of the owners. + diff --git a/testing/web-platform/tests/payment-request/constructor_convert_method_data.https.html b/testing/web-platform/tests/payment-request/constructor_convert_method_data.https.html new file mode 100644 index 0000000000..f4a9a721d0 --- /dev/null +++ b/testing/web-platform/tests/payment-request/constructor_convert_method_data.https.html @@ -0,0 +1,73 @@ + +Validates PaymentMethodData's data member during construction + + + + diff --git a/testing/web-platform/tests/payment-request/delegate-request.https.sub.html b/testing/web-platform/tests/payment-request/delegate-request.https.sub.html new file mode 100644 index 0000000000..988550036c --- /dev/null +++ b/testing/web-platform/tests/payment-request/delegate-request.https.sub.html @@ -0,0 +1,81 @@ + +Payment request delegation test + + + + + + +
+ Verifies that PaymentRequest.show() call from a cross-origin subframe without user activation + works if and only if the top frame has user activation and it delegates the capability to the + subframe. +
+ + + + diff --git a/testing/web-platform/tests/payment-request/historical.https.html b/testing/web-platform/tests/payment-request/historical.https.html new file mode 100644 index 0000000000..aa183a58cd --- /dev/null +++ b/testing/web-platform/tests/payment-request/historical.https.html @@ -0,0 +1,45 @@ + + +Historical Payment Request APIs + + + diff --git a/testing/web-platform/tests/payment-request/idlharness.https.window.js b/testing/web-platform/tests/payment-request/idlharness.https.window.js new file mode 100644 index 0000000000..53ae47e892 --- /dev/null +++ b/testing/web-platform/tests/payment-request/idlharness.https.window.js @@ -0,0 +1,31 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/payment-request/ + +idl_test( + ['payment-request'], + ['dom', 'html'], + idlArray => { + try { + const methods = [ + {supportedMethods: 'basic-card'}, + {supportedMethods: 'https://apple.com/apple-pay'}, + ]; + const amount = {currency: 'USD', value: '0'}; + const details = {total: {label: 'label', amount: amount} }; + window.paymentRequest = new PaymentRequest(methods, details); + } catch (e) { + // Surfaced below when paymentRequest is undefined. + } + + idlArray.add_objects({ + PaymentRequest: ['paymentRequest'], + PaymentMethodChangeEvent: ['new PaymentMethodChangeEvent("paymentmethodchange")'], + PaymentRequestUpdateEvent: ['new PaymentRequestUpdateEvent("paymentrequestupdate")'], + MerchantValidationEvent: ['new MerchantValidationEvent("merchantvalidation")'], + }); + } +); diff --git a/testing/web-platform/tests/payment-request/onpaymentmethodchange-attribute.https.html b/testing/web-platform/tests/payment-request/onpaymentmethodchange-attribute.https.html new file mode 100644 index 0000000000..f641bec4aa --- /dev/null +++ b/testing/web-platform/tests/payment-request/onpaymentmethodchange-attribute.https.html @@ -0,0 +1,79 @@ + + +Test for onpaymentmethodchange attribute + + + + diff --git a/testing/web-platform/tests/payment-request/payment-is-showing.https.html b/testing/web-platform/tests/payment-request/payment-is-showing.https.html new file mode 100644 index 0000000000..a30029458f --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-is-showing.https.html @@ -0,0 +1,170 @@ + +Test for PaymentRequest.show(optional promise) method + + + + + + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-abort-method.https.html b/testing/web-platform/tests/payment-request/payment-request-abort-method.https.html new file mode 100644 index 0000000000..32b87970b4 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-abort-method.https.html @@ -0,0 +1,91 @@ + + +Test for PaymentRequest.abort() method + + + + + + + + If you find a buggy test, please + file a bug and + tag one of the + suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html b/testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html new file mode 100644 index 0000000000..f02474de12 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html @@ -0,0 +1,120 @@ + + +Tests for PaymentRequest.canMakePayment() method + + + + + + + + + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-request-constructor.https.sub.html b/testing/web-platform/tests/payment-request/payment-request-constructor.https.sub.html new file mode 100644 index 0000000000..c1ecc22583 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-constructor.https.sub.html @@ -0,0 +1,477 @@ + + + +Test for PaymentRequest Constructor + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html b/testing/web-platform/tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html new file mode 100644 index 0000000000..c608608c7e --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html @@ -0,0 +1,282 @@ + + +Test currency code usage in PaymentRequest Constructor + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html b/testing/web-platform/tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html new file mode 100644 index 0000000000..d6a1be2394 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html @@ -0,0 +1,149 @@ + + + +Test for validity of payment method identifiers during construction + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-disallowed-when-hidden.https.html b/testing/web-platform/tests/payment-request/payment-request-disallowed-when-hidden.https.html new file mode 100644 index 0000000000..3a5eb01015 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-disallowed-when-hidden.https.html @@ -0,0 +1,48 @@ + + +Test for PaymentRequest.show() method - should fail when tab is not visible + + + + + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html new file mode 100644 index 0000000000..e6b164f7cc --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html @@ -0,0 +1,95 @@ + + +Manual tests for PaymentRequest.hasEnrolledInstrument() method + + + + + +

Manual tests for hasEnrolledInstrument() method

+

+ Follow the instructions from top to bottom. Click on each button in sequence + without refreshing the page. Some of the tests will bring up the Payment + Request UI and close them automatically. If a payment sheet stays open, the + test has failed. +

+
    +
  1. Follow browser-specific instructions to remove all cards from the test profile.
  2. +
  3. + +
  4. +
  5. Add a test Visa card to your test profile, e.g. 4012888888881881.
  6. +
  7. + +
  8. +
  9. + +
  10. +
  11. + +
  12. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html new file mode 100644 index 0000000000..4da11304a2 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html @@ -0,0 +1,68 @@ + + +Tests for PaymentRequest.hasEnrolledInstrument() method + + + + + + + + + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html new file mode 100644 index 0000000000..4f6b7e9239 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html @@ -0,0 +1,78 @@ + + +Tests for PaymentRequest.hasEnrolledInstrument() method + + + + + + + + + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-request-id-attribute.https.html b/testing/web-platform/tests/payment-request/payment-request-id-attribute.https.html new file mode 100644 index 0000000000..e5d0c7a66e --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-id-attribute.https.html @@ -0,0 +1,39 @@ + + + +Test for PaymentRequest id attribute + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-insecure.http.html b/testing/web-platform/tests/payment-request/payment-request-insecure.http.html new file mode 100644 index 0000000000..02122203d5 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-insecure.http.html @@ -0,0 +1,13 @@ + + + +Test for PaymentRequest Constructor (insecure) + + + + diff --git a/testing/web-platform/tests/payment-request/payment-request-not-exposed.https.worker.js b/testing/web-platform/tests/payment-request/payment-request-not-exposed.https.worker.js new file mode 100644 index 0000000000..e5576e6735 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-not-exposed.https.worker.js @@ -0,0 +1,7 @@ +importScripts("/resources/testharness.js"); + +test(() => { + assert_true(isSecureContext); + assert_false('PaymentRequest' in self); +}, "PaymentRequest constructor must not be exposed in worker global scope"); +done(); diff --git a/testing/web-platform/tests/payment-request/payment-request-show-method.https.html b/testing/web-platform/tests/payment-request/payment-request-show-method.https.html new file mode 100644 index 0000000000..d3385b5468 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-request-show-method.https.html @@ -0,0 +1,105 @@ + + +Test for PaymentRequest.show() method + + + + + + + + If you find a buggy test, please + file a bug and + tag one of the + suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html new file mode 100644 index 0000000000..f7facd7980 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html @@ -0,0 +1,101 @@ + + + + + PaymentResponse.prototype.complete() method + + + + + + +

+ Manual Tests for PaymentResponse.complete() - Please run in order! +

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When presented with the payment sheet, use any credit card select to "Pay". + Also confirm any prompts that come up. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
  11. + +
  12. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/helpers.js b/testing/web-platform/tests/payment-request/payment-response/helpers.js new file mode 100644 index 0000000000..1242ecb743 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/helpers.js @@ -0,0 +1,110 @@ +setup({ explicit_done: true, explicit_timeout: true }); + +const applePay = Object.freeze({ + supportedMethods: "https://apple.com/apple-pay", + data: { + version: 3, + merchantIdentifier: "merchant.com.example", + countryCode: "US", + merchantCapabilities: ["supports3DS"], + supportedNetworks: ["visa"], + } +}); + +const validMethod = Object.freeze({ + supportedMethods: "basic-card", +}); + +const validMethods = Object.freeze([validMethod, applePay]); + +const validAmount = Object.freeze({ + currency: "USD", + value: "1.00", +}); + +const validTotal = Object.freeze({ + label: "Valid total", + amount: validAmount, +}); +const validDetails = { + total: validTotal, +}; + +test(() => { + try { + new PaymentRequest(validMethods, validDetails); + } catch (err) { + done(); + throw err; + } +}, "Can construct a payment request (smoke test)."); + +/** + * Pops up a payment sheet, allowing options to be + * passed in if particular values are needed. + * + * @param PaymentOptions options + */ +async function getPaymentResponse(options, id) { + const { response } = await getPaymentRequestResponse(options, id); + return response; +} + +/** + * Creates a payment request and response pair. + * It also shows the payment sheet. + * + * @param {PaymentOptions?} options + * @param {String?} id + */ +async function getPaymentRequestResponse(options, id) { + const methods = [{ supportedMethods: "basic-card" }]; + const details = { + id, + total: { + label: "Total due", + amount: { currency: "USD", value: "1.0" }, + }, + }; + const request = new PaymentRequest(methods, details, options); + const response = await request.show(); + return { request, response }; +} + +/** + * Runs a manual test for payment + * + * @param {HTMLButtonElement} button The HTML button. + * @param {PaymentOptions?} options. + * @param {Object} expected What property values are expected to pass the test. + * @param {String?} id And id for the request/response pair. + */ +async function runManualTest(button, options, expected = {}, id = undefined) { + button.disabled = true; + const { request, response } = await getPaymentRequestResponse(options, id); + await response.complete(); + test(() => { + assert_idl_attribute( + response, + "requestId", + "Expected requestId to be an IDL attribute." + ); + assert_equals(response.requestId, request.id, `Expected ids to match`); + for (const [attribute, value] of Object.entries(expected)) { + assert_idl_attribute( + response, + attribute, + `Expected ${attribute} to be an IDL attribute.` + ); + assert_equals( + response[attribute], + value, + `Expected response ${attribute} attribute to be ${value}` + ); + } + assert_idl_attribute(response, "details"); + assert_equals(typeof response.details, "object", "Expected an object"); + // Testing that this does not throw: + response.toJSON(); + }, button.textContent.trim()); +} diff --git a/testing/web-platform/tests/payment-request/payment-response/methodName-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/methodName-attribute-manual.https.html new file mode 100644 index 0000000000..0a8ef6c77e --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/methodName-attribute-manual.https.html @@ -0,0 +1,28 @@ + + + + + PaymentResponse.prototype.methodName attribute + + + + +

methodName attribute

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ Use any credit card and any values. +

+
    +
  1. + +
  2. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html new file mode 100644 index 0000000000..5731952c0e --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html @@ -0,0 +1,73 @@ + + +PaymentResponse.prototype.onpayerdetailchange attribute + + + + +

Handling PaymentResponse.prototype.onpayerdetailchange events

+

+ Each button will bring up the Payment Request UI window. + When shown the payment sheet, use any details and hit pay. +

+

+ When asked to retry the payment: +

+
    +
  1. +

    + Change payer's name to "pass". +

    + +
  2. +
  3. +

    + Change payer's email to "pass@pass.pass". +

    + +
  4. +
  5. +

    + Change payer's phone to "+1-800-000-0000". +

    + +
  6. +
  7. + +
  8. +
+ + If you find a buggy test, please file a bug + and tag one of the owners. + diff --git a/testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html b/testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html new file mode 100644 index 0000000000..ed9e6e885b --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html @@ -0,0 +1,14 @@ + + +PaymentResponse.prototype.onpayerdetailschange attribute + + + diff --git a/testing/web-platform/tests/payment-request/payment-response/payerEmail-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/payerEmail-attribute-manual.https.html new file mode 100644 index 0000000000..28ce4c28a8 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/payerEmail-attribute-manual.https.html @@ -0,0 +1,48 @@ + + + + + PaymentResponse.prototype.payerEmail attribute + + + + +

payerEmail attribute

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When requested, please use "wpt@w3.org" as the email. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/payerName-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/payerName-attribute-manual.https.html new file mode 100644 index 0000000000..44d741ae45 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/payerName-attribute-manual.https.html @@ -0,0 +1,48 @@ + + + + + PaymentResponse.prototype.payerName attribute + + + + +

payerName attribute

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When requested, please use "web platform test" as the payer name. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/payerPhone-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/payerPhone-attribute-manual.https.html new file mode 100644 index 0000000000..85a44a819c --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/payerPhone-attribute-manual.https.html @@ -0,0 +1,48 @@ + + + + + PaymentResponse.prototype.payerPhone attribute + + + + +

payerPhone attribute

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When prompted, please use +12345678910 as the phone number. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html new file mode 100644 index 0000000000..7e35d78700 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html @@ -0,0 +1,68 @@ + + +Dispatching PaymentRequestUpdateEvent for "payerdetailschange" + + + + +

Handling PaymentResponse.prototype.onpayerdetailchange events

+

+ The test brings up the Payment Request UI window. + When shown the payment sheet, use any details and hit pay. +

+

+ When asked to retry the payment: +

+
    +
  1. +

    + Change payer's name to anything. +

    + +
  2. +
  3. + +
  4. +
+ + If you find a buggy test, please file a bug + and tag one of the owners. + diff --git a/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html new file mode 100644 index 0000000000..1a7342365d --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html @@ -0,0 +1,56 @@ + + +Dispatching PaymentRequestUpdateEvent for "payerdetailschange" + + + + +

Handling PaymentResponse.prototype.onpayerdetailchange events

+

+ The test brings up the Payment Request UI window. + When shown the payment sheet, use any details and hit pay. +

+

+ When asked to retry the payment: +

+
    +
  1. +

    + Change payer's name to anything. +

    + +
  2. +
  3. + +
  4. +
+ + If you find a buggy test, please file a bug + and tag one of the owners. + diff --git a/testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html new file mode 100644 index 0000000000..6f2e9e95d4 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html @@ -0,0 +1,160 @@ + + + +PaymentResponse retry() rejects if doc is not fully active + + + + + +
+

+ For each test, when the payment sheet is shown, select a payment method and hit "Pay". +

+

retry() and document active state

+

Manual Tests for PaymentResponse.retry() - Please run in order!

+
    +
  1. + +
  2. +
  3. + +
  4. +
+

complete() and document active state

+

Manual Tests for PaymentResponse.complete() - Please run in order!

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
+
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/payment-response/requestId-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/requestId-attribute-manual.https.html new file mode 100644 index 0000000000..ddb1e0d831 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/requestId-attribute-manual.https.html @@ -0,0 +1,34 @@ + + + + + PaymentResponse.prototype.requestId attribute + + + + +

requestId attribute

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When presented with the payment sheet, use any credit card select to "Pay". + Also confirm any prompts that come up. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + diff --git a/testing/web-platform/tests/payment-request/rejects_if_not_active.https.html b/testing/web-platform/tests/payment-request/rejects_if_not_active.https.html new file mode 100644 index 0000000000..32feccb265 --- /dev/null +++ b/testing/web-platform/tests/payment-request/rejects_if_not_active.https.html @@ -0,0 +1,142 @@ + + +PaymentRequest show() rejects if doc is not fully active + + + + + + + + diff --git a/testing/web-platform/tests/payment-request/resources/delegate-request-subframe.sub.html b/testing/web-platform/tests/payment-request/resources/delegate-request-subframe.sub.html new file mode 100644 index 0000000000..aeda1f00d4 --- /dev/null +++ b/testing/web-platform/tests/payment-request/resources/delegate-request-subframe.sub.html @@ -0,0 +1,38 @@ + +Payment request delegation test: subframe + + diff --git a/testing/web-platform/tests/payment-request/resources/page1.html b/testing/web-platform/tests/payment-request/resources/page1.html new file mode 100644 index 0000000000..7fc080d380 --- /dev/null +++ b/testing/web-platform/tests/payment-request/resources/page1.html @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/payment-request/resources/page2.html b/testing/web-platform/tests/payment-request/resources/page2.html new file mode 100644 index 0000000000..7fc080d380 --- /dev/null +++ b/testing/web-platform/tests/payment-request/resources/page2.html @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/payment-request/show-consume-activation.https.html b/testing/web-platform/tests/payment-request/show-consume-activation.https.html new file mode 100644 index 0000000000..6f629489e4 --- /dev/null +++ b/testing/web-platform/tests/payment-request/show-consume-activation.https.html @@ -0,0 +1,52 @@ + + + + + show() consumes user activation + + + + + + + + + + diff --git a/testing/web-platform/tests/payment-request/show-method-optional-promise-rejects.https.html b/testing/web-platform/tests/payment-request/show-method-optional-promise-rejects.https.html new file mode 100644 index 0000000000..4a41f28fc9 --- /dev/null +++ b/testing/web-platform/tests/payment-request/show-method-optional-promise-rejects.https.html @@ -0,0 +1,215 @@ + + +Test for PaymentRequest.show(optional detailsPromise) method + + + + + + diff --git a/testing/web-platform/tests/payment-request/show-method-postmessage-iframe.html b/testing/web-platform/tests/payment-request/show-method-postmessage-iframe.html new file mode 100644 index 0000000000..b50f18ecce --- /dev/null +++ b/testing/web-platform/tests/payment-request/show-method-postmessage-iframe.html @@ -0,0 +1,49 @@ +

This iframe calls shows() via postMessage()

+ diff --git a/testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html b/testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html new file mode 100644 index 0000000000..0751920e37 --- /dev/null +++ b/testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html @@ -0,0 +1,53 @@ + + +Test for PaymentRequest.show() method + + + + +

Test PaymentRequest.show() triggered by user activation using postMessage()

+

+ Tests that user activation works over postMessage(). +

+

+ Click on bottom below. Hit "Pay". +

+
    +
  1. + +
  2. +
+ +

+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + +

diff --git a/testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html b/testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html new file mode 100644 index 0000000000..078bf3d61a --- /dev/null +++ b/testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html @@ -0,0 +1,80 @@ + + + + + User aborts the payment request algorithm. + + + + +

+ User aborts the payment request algorithm. +

+

+ Click on each button in sequence from top to bottom without refreshing the page. + Each button will bring up the Payment Request UI window. +

+

+ When presented with the payment sheet, abort the payment request + (e.g., by hitting the esc key or pressing a UA provided button). +

+
    +
  1. + +
  2. +
+ + If you find a buggy test, please file a bug + and tag one of the suggested reviewers. + -- cgit v1.2.3