tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

retry-method-warnings-manual.https.html (5003B)


      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"
     12    );
     13    assert_true(
     14      PaymentResponse.prototype.retry instanceof Function,
     15      "retry must be a function"
     16    );
     17  }, "PaymentResponse.prototype must have a retry() function (smoke test).");
     18 
     19  const defaultOptions = {
     20    requestPayerName: false,
     21    requestPayerEmail: false,
     22    requestPayerPhone: false,
     23    requestShipping: false,
     24  };
     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    });
     32  }
     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'}});"
     50    >
     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'}});"
     58    >
     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'}});"
     72    >
     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'}});"
     80    >
     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'}});"
     88    >
     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'}});"
     96    >
     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'}});"
    104    >
    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'}});"
    112    >
    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'}});"
    120    >
    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'}});"
    128    >
    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'}});"
    136    >
    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'}});"
    144    >
    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'}});"
    152    >
    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>