From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../payment-request/payment-response/helpers.js | 40 +++ .../retry-method-manual.https.html | 296 +++++++++++++++++++++ .../retry-method-warnings-manual.https.html | 158 +++++++++++ .../shippingAddress-attribute-manual.https.html | 101 +++++++ .../shippingOption-attribute-manual.https.html | 43 +++ 5 files changed, 638 insertions(+) create mode 100644 testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html create mode 100644 testing/web-platform/tests/payment-request/payment-response/shippingOption-attribute-manual.https.html (limited to 'testing/web-platform/tests/payment-request/payment-response') diff --git a/testing/web-platform/tests/payment-request/payment-response/helpers.js b/testing/web-platform/tests/payment-request/payment-response/helpers.js index 1242ecb743..3e4f5cfd36 100644 --- a/testing/web-platform/tests/payment-request/payment-response/helpers.js +++ b/testing/web-platform/tests/payment-request/payment-response/helpers.js @@ -65,8 +65,30 @@ async function getPaymentRequestResponse(options, id) { label: "Total due", amount: { currency: "USD", value: "1.0" }, }, + shippingOptions: [ + { + id: "fail1", + label: "Fail option 1", + amount: { currency: "USD", value: "5.00" }, + selected: false, + }, + { + id: "pass", + label: "Pass option", + amount: { currency: "USD", value: "5.00" }, + selected: true, + }, + { + id: "fail2", + label: "Fail option 2", + amount: { currency: "USD", value: "5.00" }, + selected: false, + }, + ], }; const request = new PaymentRequest(methods, details, options); + request.onshippingaddresschange = ev => ev.updateWith(details); + request.onshippingoptionchange = ev => ev.updateWith(details); const response = await request.show(); return { request, response }; } @@ -106,5 +128,23 @@ async function runManualTest(button, options, expected = {}, id = undefined) { assert_equals(typeof response.details, "object", "Expected an object"); // Testing that this does not throw: response.toJSON(); + if (options && options.requestShipping) { + assert_equals( + response.shippingOption, + "pass", + "request.shippingOption must be 'pass'" + ); + } else { + assert_equals( + request.shippingOption, + null, + "If requestShipping is falsy, request.shippingOption must be null" + ); + assert_equals( + response.shippingOption, + null, + "request.shippingOption must be null" + ); + } }, button.textContent.trim()); } diff --git a/testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html new file mode 100644 index 0000000000..a5aab49e38 --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html @@ -0,0 +1,296 @@ + + + + + PaymentResponse.prototype.retry() method + + + + + +

+ Manual Tests for PaymentResponse.retry() - 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" multiple times. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
  11. +

    + When shown the payment sheet, hit pay once, then abort retrying the payment. +

    + +
  12. +
  13. +

    + When shown the payment sheet, hit pay once. Check payment sheet for error fields. + Then hit escape or otherwise abort the payment. +

    + +
  14. +
  15. +

    + When shown the payment sheet, hit pay once. + Then, change the shipping option. + Select to pay again. +

    + +
  16. +
  17. +

    + When shown the payment sheet, hit pay once. Then retry once. +

    + +
  18. +
  19. + +
  20. +
+ + 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/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 @@ + +Warn when errorFields don't match request[[options]] + + + + + +

Manual Tests - Please run in order!

+

+ Please open the developer console. Each of the tests below should generate a + warning in the developer console. +

+

When presented with the payment sheet, hit pay twice.

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
  11. + +
  12. +
  13. + +
  14. +
  15. + +
  16. +
  17. + +
  18. +
  19. + +
  20. +
  21. + +
  22. +
  23. + +
  24. +
  25. + +
  26. +
  27. + +
  28. +
  29. + +
  30. +
  31. +
diff --git a/testing/web-platform/tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html new file mode 100644 index 0000000000..f9f0a6e4fa --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html @@ -0,0 +1,101 @@ + + + + + PaymentResponse.prototype.shippingAddress + + + + + +

shippingAddress 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 enter "web platform test" as recipient, at address "1 wpt street" in "Kabul, Afghanistan", zip/postal code 1001. +

+
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
+ + 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/shippingOption-attribute-manual.https.html b/testing/web-platform/tests/payment-request/payment-response/shippingOption-attribute-manual.https.html new file mode 100644 index 0000000000..687d3a52de --- /dev/null +++ b/testing/web-platform/tests/payment-request/payment-response/shippingOption-attribute-manual.https.html @@ -0,0 +1,43 @@ + + + + + PaymentResponse.prototype.complete() method + + + + +

shippingOption 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. +

+

+ For the last test, please select the only available shipping option and select "Pay". +

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