summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html')
-rw-r--r--testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html80
1 files changed, 80 insertions, 0 deletions
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 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href="https://w3c.github.io/payment-request/#user-aborts-the-payment-request-algorithm">
+<title>
+ User aborts the payment request algorithm.
+</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+
+const validAmount = Object.freeze({
+ currency: "USD",
+ value: "1.0",
+});
+const validTotal = Object.freeze({
+ label: "Total due",
+ amount: validAmount,
+});
+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 validDetails = Object.freeze({
+ total: validTotal,
+});
+
+test(() => {
+ try {
+ new PaymentRequest(validMethods, validDetails);
+ } catch (err) {
+ done();
+ throw err;
+ }
+}, "Can construct a payment request (smoke test).");
+
+async function runAbortTest(button) {
+ button.disabled = true;
+ const { textContent: testName } = button;
+ promise_test(async t => {
+ const request = new PaymentRequest(validMethods, validDetails);
+ // Await the user to abort
+ await promise_rejects_dom(t, "AbortError", request.show());
+ // [[state]] is now closed
+ await promise_rejects_dom(t, "InvalidStateError", request.show());
+ }, testName.trim());
+}
+</script>
+<h2>
+ User aborts the payment request algorithm.
+</h2>
+<p>
+ Click on each button in sequence from top to bottom without refreshing the page.
+ Each button will bring up the Payment Request UI window.
+</p>
+<p>
+ When presented with the payment sheet, abort the payment request
+ (e.g., by hitting the esc key or pressing a UA provided button).
+</p>
+<ol>
+ <li>
+ <button onclick="runAbortTest(this); done();">
+ If the user aborts, the UA must run the user aborts the payment request algorithm.
+ </button>
+ </li>
+</ol>
+<small>
+ If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
+ and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
+</small>