Bug 1510131 [wpt PR 14246] - Warn when errorFields don't match options, a=testonly
[gecko.git] / testing / web-platform / tests / payment-request / payment-response / retry-method-warnings-manual.https.html
blobb68bf18309702c481c76adef0cddee24cbd1b543
1 <!DOCTYPE html> <meta charset="utf-8" />
2 <title>Warn when errorFields don't match request[[options]]</title>
3 <link rel="help" href="https://github.com/w3c/payment-request/pull/807" />
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="helpers.js"></script>
7 <script>
8 test(() => {
9 assert_true(
10 "retry" in PaymentResponse.prototype,
11 "retry must be in prototype"
13 assert_true(
14 PaymentResponse.prototype.retry instanceof Function,
15 "retry must be a function"
17 }, "PaymentResponse.prototype must have a retry() function (smoke test).");
19 const defaultOptions = {
20 requestPayerName: false,
21 requestPayerEmail: false,
22 requestPayerPhone: false,
23 requestShipping: false,
25 function testShowWarning(button, errorFields) {
26 button.disabled = true;
27 promise_test(async () => {
28 const { response } = await getPaymentRequestResponse(defaultOptions);
29 await response.retry(errorFields);
30 await response.complete();
31 });
33 </script>
34 <h2>Manual Tests - Please run in order!</h2>
35 <p>
36 Please open the developer console. Each of the tests below should generate a
37 warning in the developer console.
38 </p>
39 <p>When presented with the payment sheet, hit pay twice.</p>
40 <ol>
41 <li>
42 <button onclick="testShowWarning(this, {payer: {name: 'Dont show this'}});">
43 Show warning if `requestPayerName` if false, and `errorFields.payer.name` is
44 present.
45 </button>
46 </li>
47 <li>
48 <button
49 onclick="testShowWarning(this, {payer: {email: 'Dont show this'}});"
51 Show warning if `requestPayerEmail` if false, and `errorFields.payer.email`
52 is present.
53 </button>
54 </li>
55 <li>
56 <button
57 onclick="testShowWarning(this, {payer: {phone: 'Dont show this'}});"
59 Show warning if `requestPayerPhone` if false, and `errorFields.payer.phone`
60 is present.
61 </button>
62 </li>
63 <li>
64 <button onclick="testShowWarning(this, {shippingAddress: {}});">
65 Show warning if `requestShipping` if false, and
66 `errorFields.shippingAddress` member present.
67 </button>
68 </li>
69 <li>
70 <button
71 onclick="testShowWarning(this, {shippingAddress: {addressLine: 'Dont show this'}});"
73 Show warning if `requestShipping` if false, and
74 `errorFields.shippingAddress.addressLine` member present.
75 </button>
76 </li>
77 <li>
78 <button
79 onclick="testShowWarning(this, {shippingAddress: {city: 'Dont show this'}});"
81 Show warning if `requestShipping` if false, and
82 `errorFields.shippingAddress.city` member present.
83 </button>
84 </li>
85 <li>
86 <button
87 onclick="testShowWarning(this, {shippingAddress: {country: 'Dont show this'}});"
89 Show warning if `requestShipping` if false, and
90 `errorFields.shippingAddress.country` member present.
91 </button>
92 </li>
93 <li>
94 <button
95 onclick="testShowWarning(this, {shippingAddress: {dependentLocality: 'Dont show this'}});"
97 Show warning if `requestShipping` if false, and
98 `errorFields.shippingAddress.dependentLocality` member present.
99 </button>
100 </li>
101 <li>
102 <button
103 onclick="testShowWarning(this, {shippingAddress: {organization: 'Dont show this'}});"
105 Show warning if `requestShipping` if false, and
106 `errorFields.shippingAddress.organization` member present.
107 </button>
108 </li>
109 <li>
110 <button
111 onclick="testShowWarning(this, {shippingAddress: {phone: 'Dont show this'}});"
113 Show warning if `requestShipping` if false, and
114 `errorFields.shippingAddress.phone` member present.
115 </button>
116 </li>
117 <li>
118 <button
119 onclick="testShowWarning(this, {shippingAddress: {postalCode: 'Dont show this'}});"
121 Show warning if `requestShipping` if false, and
122 `errorFields.shippingAddress.postalCode` member present.
123 </button>
124 </li>
125 <li>
126 <button
127 onclick="testShowWarning(this, {shippingAddress: {recipient: 'Dont show this'}});"
129 Show warning if `requestShipping` if false, and
130 `errorFields.shippingAddress.recipient` member present.
131 </button>
132 </li>
133 <li>
134 <button
135 onclick="testShowWarning(this, {shippingAddress: {region: 'Dont show this'}});"
137 Show warning if `requestShipping` if false, and
138 `errorFields.shippingAddress.region` member present.
139 </button>
140 </li>
141 <li>
142 <button
143 onclick="testShowWarning(this, {shippingAddress: {regionCode: 'Dont show this'}});"
145 Show warning if `requestShipping` if false, and
146 `errorFields.shippingAddress.regionCode` member present.
147 </button>
148 </li>
149 <li>
150 <button
151 onclick="testShowWarning(this, {shippingAddress: {sortingCode: 'Dont show this'}});"
153 Show warning if `requestShipping` if false, and
154 `errorFields.shippingAddress.sortingCode` member present.
155 </button>
156 </li>
157 <li><button onclick="done()">Done!</button></li>
158 </ol>