Page MenuHomePhabricator

[Cashtab] Improve UX for sending cashtab msg
ClosedPublic

Authored by bytesofman on Apr 1 2024, 19:55.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC7d26c559628f: [Cashtab] Improve UX for sending cashtab msg
Summary

T2207

Stop using the confusing below-send collapse for a cashtab msg. Instead, use a simple switch to show/hide the form.

Put cashtab msg into formdata state object instead of maintaining its own confusingly named state var (confusing bc now cashtabmsg is not the only type of opreturn msg we could expect to send)

Test Plan

npm test

This diff is live at https://cashtab-local-dev.netlify.app/

note: there is a pre-existing bug where the send button will not be disabled on multisend if there is valid input present in send to one

image.png (437×564 px, 31 KB)

image.png (633×550 px, 61 KB)

image.png (705×550 px, 58 KB)

image.png (705×550 px, 59 KB)

error and count if error msg is more than 1 line

image.png (330×290 px, 26 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cashtab-msg-switch
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28262
Build 56068: Build Diffcashtab-tests
Build 56067: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <SendXec /> Pass a valid address and an invalid bip21 query string ======
TestingLibraryElementError: Unable to find an element with the text: Message. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="ant-spin-nested-loading css-dev-only-do-not-override-1rqnfsa"
    >
      <div
        class="ant-spin-container"
      >
        <div
          class="sc-cHSUfg loJbgV"
        >
          <div
            class="Toastify"
          />
          <div
            class="sc-dRFtgE eHkAmR"
          >
            <div
              class="sc-hUfwpO jpGvqD"
            >
              <div
                class="sc-cugefK lnAMdM"
              >
                <div
                  class="sc-imABML dVimwd"
                >
                  <img
                    alt="cashtab"
                    class="sc-cjHlYL bxEzsg"
                    src="test-file-stub"
                  />
                </div>
                <div
                  class="sc-jqCOkK kwqwxz"
                  data-testid="wallet-info-ctn"
                >
                  <div
                    class="sc-hBbWxd clXSff"
                  >
                    <select
                      class="sc-dyGzUR kRHcyB"
                      id="wallets"
                      name="wallets"
                    >
                      <option
                        class="sc-drKuOJ buwMlV"
                        value="Transaction Fixtures"
                      >
                        Transaction Fixtures
                      </option>
                    </select>
                    <div
                      class="sc-eNQAEJ kAwVTN"
                    >
                      <svg
                        class="sc-htoDjs dHRdfz"
                        style="margin-top: 8px;"
                      />
                    </div>
                    <div
                      class="sc-krvtoX bEDjtS"
                    >
                      <div
                        class="sc-fYiAbW bFoPAu"
                      >
                        <input
                          checked=""
                          class="sc-eilVRo fppJlL"
                          data-testid="show-hide-balance"
                          id="show-hide-balance"
                          name="show-hide-balance"
                          type="checkbox"
                        />
                        <label
                          class="sc-fOKMvo eRGicA"
                          for="show-hide-balance"
                        >
                          <span
                            class="sc-dUjcNx cEbCSZ"
                            data-off=""
                            data-on=""
                          />
                          <span
                            class="sc-gHboQg jWoGWN"
                          />
                        </label>
                      </div>
                    </div>
                  </div>
                  <div
                    class="sc-gRnDUn wAgWh"
                    data-testid="balance-xec"
                  >
                    9,513.12
                     
                    XEC
                     
                  </div>
                  <div
                    class="sc-cmjSyW bcaQxm"
                    data-testid="balance-fiat"
                  >
                    $
                    0.29
                     
                    USD
                  </div>
                  <p
                    class="sc-sdtwF bzlgWq"
                    data-testid="ecash-price"
                  >
                    1 
                    XEC
                     = 
                    0.00003000
                     
                    USD
                  </p>
                </div>
              </div>
              <div
                class="sc-gkFcWv fXRnDF"
              >
                <div
                  class="sc-bHwgHz eEiMJV"
                >
                  <div
                    class="sc-krvtoX bEDjtS"
                  >
                    <div
                      class="sc-fYiAbW bFXHUD"
                    >
                      <input
                        class="sc-eilVRo fppJlL"
                        data-testid="Send to many"
                        disabled=""
                        id="Send to many"
                        name="Send to many"
                        type="checkbox"
                      />
                      <label
                        class="sc-fOKMvo hNzFVY"
                        disabled=""
                        for="Send to many"
                      >
                        <span
                          class="sc-dUjcNx dmvBDh"
                          data-off="Send to one"
                          data-on="Send to many"
                          disabled=""
                        />
                        <span
                          class="sc-gHboQg jBYSMA"
                        />
                      </label>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-kUaPvJ hhuAGh"
                >
                  <div
                    class="sc-gPWkxV hochYu"
                  >
                    <div
                      class="sc-hXRMBi eRLasT"
                    >
                      <div
                        class="sc-epnACN gXNpCk"
                      >
                        <input
                          class="sc-iQNlJl sc-cMhqgX jBukEj"
                          name="address"
                          placeholder="Address"
                          value="ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6?notaparam=500"
                        />
                        <button
                          class="sc-hrWEMg cytAe"
                          data-testid="scan-qr-code"
                        >
                          <svg />
                        </button>
                      </div>
                      <div
                        class="sc-cLQEGU iqXcta"
                      >
                        Unsupported param "notaparam"
                      </div>
                    </div>
                    <div
                      class="sc-itybZL dMNSDf"
                    >
                      <a
                        class="sc-jbKcbu hUBYVp"
                        data-testid="alias-address-preview"
                        href="https://explorer.e.cash/address/false"
                        rel="noreferrer"
                        target="_blank"
                      />
                    </div>
                    <label
                      class="sc-dNLxif cNnWB"
                    />
                    <div
                      class="sc-hXRMBi eRLasT"
                    >
                      <div
                        class="sc-epnACN jiHbHu"
                      >
                        <input
                          class="sc-iQNlJl sc-cMhqgX jBukEj"
                          name="amount"
                          placeholder="Amount"
                          step="0.01"
                          type="number"
                          value=""
                        />
                        <select
                          class="sc-cmthru dJRhBf"
                          data-testid="currency-select-dropdown"
                        >
                          <option
                            class="sc-hMFtBS kbnnLB"
                            data-testid="xec-option"
                            value="XEC"
                          >
                            XEC
                          </option>
                          <option
                            class="sc-hMFtBS kbnnLB"
                            data-testid="fiat-option"
                            value="USD"
                          >
                            USD
                          </option>
                        </select>
                        <button
                          class="sc-iuJeZd eyejFI"
                        >
                          max
                        </button>
                      </div>
                      <div
                        class="sc-cLQEGU iqXcta"
                      />
                    </div>
                  </div>
                  <div
                    class="sc-jVODtj cuWQvi"
                  >
                    <div
                      class="sc-hXRMBi eRLasT"
                    >
                      <textarea
                        class="sc-hZSUBg jOQORm"
                        name="multiAddressInput"
                        placeholder="One address & amount per line, separated by comma 
e.g. 
ecash:qpatql05s9jfavnu0tv6lkjjk25n6tmj9gkpyrlwu8,500 
ecash:qzvydd4n3lm3xv62cx078nu9rg0e3srmqq0knykfed,700"
                      />
                      <div
                        class="sc-bAeIUo ftvryZ"
                      >
                        <div
                          class="sc-iujRgT fPbQxK"
                        />
                      </div>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-fjmCvl ftgGgR"
                >
                  <div
                    class="sc-TFwJa gzYRmt"
                  >
                    <div
                      class="sc-krvtoX bEDjtS"
                    >
                      <div
                        class="sc-fYiAbW jJtfwN"
                      >
                        <input
                          class="sc-eilVRo fppJlL"
                          data-testid="cashtab-msg-switch"
                          disabled=""
                          id="cashtab-msg-switch"
                          name="cashtab-msg-switch"
                          type="checkbox"
                        />
                        <label
                          class="sc-fOKMvo hNzFVY"
                          disabled=""
                          for="cashtab-msg-switch"
                        >
                          <span
                            class="sc-dUjcNx dmvBDh"
                            data-off="  "
                            data-on="  "
                            disabled=""
                          />
                          <span
                            class="sc-gHboQg ezheid"
                          />
                        </label>
                      </div>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-eMigcr kXWyXT"
                >
                  <div
                    class="sc-fzsDOv VaPqk"
                  >
                    0 XEC
                  </div>
                  <div
                    class="sc-gGBfsJ kwjkAk"
                  >
                    =
                     
                    $  0.00 USD
                  </div>
                </div>
                <button
                  class="sc-kIPQKe sc-ibxdXY enXWZl"
                  data-testid="send-it"
                  disabled=""
                  style="margin-top: 12px;"
                >
                  Send
                </button>
              </div>
            </div>
            <div
              class="sc-cTjmhe bwPJKO"
            >
              <button
                class="sc-gbOuXE leyCUq"
              >
                <svg />
              </button>
              <button
                class="sc-gbOuXE fQQUZN"
                data-testid="nav-btn-send"
              >
                <svg
                  class="sc-ckVGcZ hdgytv"
                  style="margin-top: -9px;"
                />
              </button>
              <button
                class="sc-gbOuXE leyCUq"
                data-testid="nav-btn-etokens"
              >
                <span
                  aria-label="appstore-add"
                  class="anticon anticon-appstore-add"
                  role="img"
                  style="font-size: 24px;"
                >
                  <svg
                    aria-hidden="true"
                    data-icon="appstore-add"
                    fill="currentColor"
                    focusable="false"
                    height="1em"
                    viewBox="64 64 896 896"
                    width="1em"
                  >
                    <defs />
                    <path
                      d="M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"
                    />
                  </svg>
                </span>
              </button>
              <button
                class="sc-gbOuXE leyCUq"
                data-testid="nav-btn-receive"
              >
                <svg />
              </button>
              <div
                class="sc-fnwBNb cUeIq"
                data-testid="hamburger"
              >
                <span
                  class="sc-iNhVCk jGoCDB"
                />
                <div
                  class="sc-eAKXzc dUxowl"
                  data-testid="hamburger-menu"
                >
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-airdrop"
                  >
                     
                    <p>
                      Airdrop
                    </p>
                    <svg
                      height="33px"
                      width="30px"
                    />
                  </button>
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-swap"
                  >
                     
                    <p>
                      Swap
                    </p>
                    <span
                      aria-label="swap"
                      class="anticon anticon-swap"
                      role="img"
                      style="font-size: 24px;"
                    >
                      <svg
                        aria-hidden="true"
                        data-icon="swap"
                        fill="currentColor"
                        focusable="false"
                        height="1em"
                        viewBox="64 64 896 896"
                        width="1em"
                      >
                        <path
                          d="M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"
                        />
                      </svg>
                    </span>
                  </button>
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-signverifymsg"
                  >
                    <p>
                      Sign & Verify
                    </p>
                    <svg
                      class="sc-fjdhpX cDBHeW"
                    />
                  </button>
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-configure"
                  >
                    <p>
                      Settings
                    </p>
                    <svg
                      height="33px"
                      width="30px"
                    />
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByText (/work/cashtab/src/components/Send/__tests__/SendXec.test.js:893:23)
====== CashTab Unit Tests: <SendXec /> Clicking "Send" will send a valid tx with op_return_raw after entry of a valid address and bip21 query string with valid amount and op_return_raw params to Send To field ======
TestingLibraryElementError: Unable to find an element with the text: Message. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="ant-spin-nested-loading css-dev-only-do-not-override-1rqnfsa"
    >
      <div
        class="ant-spin-container"
      >
        <div
          class="sc-cHSUfg loJbgV"
        >
          <div
            class="Toastify"
          >
            <div
              class="Toastify__toast-container Toastify__toast-container--top-right sc-iYUSvU fpeDsm"
            >
              <div
                class="Toastify__toast Toastify__toast-theme--light Toastify__toast--default Toastify__toast--close-on-click Toastify--animate Toastify__bounce-enter--top-right"
                data-in="true"
                id="1"
              >
                <div
                  class="Toastify__toast-body"
                  role="alert"
                >
                  <div
                    class="Toastify__toast-icon Toastify--animate-icon Toastify__zoom-enter"
                  >
                    <div
                      class="ant-image css-dev-only-do-not-override-1rqnfsa"
                      style="width: 24px; height: 24px;"
                    >
                      <img
                        class="ant-image-img css-dev-only-do-not-override-1rqnfsa"
                        height="24px"
                        src="test-file-stub"
                        style="height: 24px;"
                        width="24px"
                      />
                    </div>
                  </div>
                  <div>
                    <a
                      class="sc-krDsej bDQWZX"
                      href="https://explorer.e.cash/tx/79e6afc28d4149c51c4e2a32c05c57fb59c1c164fde1afc655590ce99ed70cb8"
                      rel="noopener noreferrer"
                      target="_blank"
                    >
                      eCash sent
                    </a>
                  </div>
                </div>
                <button
                  aria-label="close"
                  class="Toastify__close-button Toastify__close-button--light"
                  type="button"
                >
                  <svg
                    aria-hidden="true"
                    viewBox="0 0 14 16"
                  >
                    <path
                      d="M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"
                      fill-rule="evenodd"
                    />
                  </svg>
                </button>
                <div
                  class="Toastify__progress-bar--wrp"
                  data-hidden="false"
                >
                  <div
                    class="Toastify__progress-bar--bg Toastify__progress-bar-theme--light Toastify__progress-bar--default"
                  />
                  <div
                    aria-hidden="false"
                    aria-label="notification timer"
                    class="Toastify__progress-bar Toastify__progress-bar--animated Toastify__progress-bar-theme--light Toastify__progress-bar--default"
                    role="progressbar"
                    style="animation-duration: 5000ms; animation-play-state: paused;"
                  />
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-dRFtgE eHkAmR"
          >
            <div
              class="sc-hUfwpO jpGvqD"
            >
              <div
                class="sc-cugefK lnAMdM"
              >
                <div
                  class="sc-imABML dVimwd"
                >
                  <img
                    alt="cashtab"
                    class="sc-cjHlYL bxEzsg"
                    src="test-file-stub"
                  />
                </div>
                <div
                  class="sc-jqCOkK kwqwxz"
                  data-testid="wallet-info-ctn"
                >
                  <div
                    class="sc-hBbWxd clXSff"
                  >
                    <select
                      class="sc-dyGzUR kRHcyB"
                      id="wallets"
                      name="wallets"
                    >
                      <option
                        class="sc-drKuOJ buwMlV"
                        value="Transaction Fixtures"
                      >
                        Transaction Fixtures
                      </option>
                    </select>
                    <div
                      class="sc-eNQAEJ kAwVTN"
                    >
                      <svg
                        class="sc-htoDjs dHRdfz"
                        style="margin-top: 8px;"
                      />
                    </div>
                    <div
                      class="sc-krvtoX bEDjtS"
                    >
                      <div
                        class="sc-fYiAbW bFoPAu"
                      >
                        <input
                          checked=""
                          class="sc-eilVRo fppJlL"
                    ...
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByText (/work/cashtab/src/components/Send/__tests__/SendXec.test.js:1202:23)
====== CashTab Unit Tests: <SendXec /> We can calculate max send amount with and without a cashtab msg, and send a max sat tx with a cashtab msg ======
TestingLibraryElementError: Unable to find an element with the text: Message. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="ant-spin-nested-loading css-dev-only-do-not-override-1rqnfsa"
    >
      <div
        class="ant-spin-container"
      >
        <div
          class="sc-cHSUfg loJbgV"
        >
          <div
            class="Toastify"
          />
          <div
            class="sc-dRFtgE eHkAmR"
          >
            <div
              class="sc-hUfwpO jpGvqD"
            >
              <div
                class="sc-cugefK lnAMdM"
              >
                <div
                  class="sc-imABML dVimwd"
                >
                  <img
                    alt="cashtab"
                    class="sc-cjHlYL bxEzsg"
                    src="test-file-stub"
                  />
                </div>
                <div
                  class="sc-jqCOkK kwqwxz"
                  data-testid="wallet-info-ctn"
                >
                  <div
                    class="sc-hBbWxd clXSff"
                  >
                    <select
                      class="sc-dyGzUR kRHcyB"
                      id="wallets"
                      name="wallets"
                    >
                      <option
                        class="sc-drKuOJ buwMlV"
                        value="Transaction Fixtures"
                      >
                        Transaction Fixtures
                      </option>
                    </select>
                    <div
                      class="sc-eNQAEJ kAwVTN"
                    >
                      <svg
                        class="sc-htoDjs dHRdfz"
                        style="margin-top: 8px;"
                      />
                    </div>
                    <div
                      class="sc-krvtoX bEDjtS"
                    >
                      <div
                        class="sc-fYiAbW bFoPAu"
                      >
                        <input
                          checked=""
                          class="sc-eilVRo fppJlL"
                          data-testid="show-hide-balance"
                          id="show-hide-balance"
                          name="show-hide-balance"
                          type="checkbox"
                        />
                        <label
                          class="sc-fOKMvo eRGicA"
                          for="show-hide-balance"
                        >
                          <span
                            class="sc-dUjcNx cEbCSZ"
                            data-off=""
                            data-on=""
                          />
                          <span
                            class="sc-gHboQg jWoGWN"
                          />
                        </label>
                      </div>
                    </div>
                  </div>
                  <div
                    class="sc-gRnDUn wAgWh"
                    data-testid="balance-xec"
                  >
                    9,513.12
                     
                    XEC
                     
                  </div>
                  <div
                    class="sc-cmjSyW bcaQxm"
                    data-testid="balance-fiat"
                  >
                    $
                    0.29
                     
                    USD
                  </div>
                  <p
                    class="sc-sdtwF bzlgWq"
                    data-testid="ecash-price"
                  >
                    1 
                    XEC
                     = 
                    0.00003000
                     
                    USD
                  </p>
                </div>
              </div>
              <div
                class="sc-gkFcWv fXRnDF"
              >
                <div
                  class="sc-bHwgHz eEiMJV"
                >
                  <div
                    class="sc-krvtoX bEDjtS"
                  >
                    <div
                      class="sc-fYiAbW bFXHUD"
                    >
                      <input
                        class="sc-eilVRo fppJlL"
                        data-testid="Send to many"
                        id="Send to many"
                        name="Send to many"
                        type="checkbox"
                      />
                      <label
                        class="sc-fOKMvo eRGicA"
                        for="Send to many"
                      >
                        <span
                          class="sc-dUjcNx diwSdx"
                          data-off="Send to one"
                          data-on="Send to many"
                        />
                        <span
                          class="sc-gHboQg jBYSMA"
                        />
                      </label>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-kUaPvJ hhuAGh"
                >
                  <div
                    class="sc-gPWkxV hochYu"
                  >
                    <div
                      class="sc-hXRMBi eRLasT"
                    >
                      <div
                        class="sc-epnACN jiHbHu"
                      >
                        <input
                          class="sc-iQNlJl sc-cMhqgX jBukEj"
                          name="address"
                          placeholder="Address"
                          value="ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6"
                        />
                        <button
                          class="sc-hrWEMg cytAe"
                          data-testid="scan-qr-code"
                        >
                          <svg />
                        </button>
                      </div>
                      <div
                        class="sc-cLQEGU iqXcta"
                      />
                    </div>
                    <div
                      class="sc-itybZL dMNSDf"
                    >
                      <a
                        class="sc-jbKcbu hUBYVp"
                        data-testid="alias-address-preview"
                        href="https://explorer.e.cash/address/false"
                        rel="noreferrer"
                        target="_blank"
                      />
                    </div>
                    <label
                      class="sc-dNLxif cNnWB"
                    />
                    <div
                      class="sc-hXRMBi eRLasT"
                    >
                      <div
                        class="sc-epnACN jiHbHu"
                      >
                        <input
                          class="sc-iQNlJl sc-cMhqgX jBukEj"
                          name="amount"
                          placeholder="Amount"
                          step="0.01"
                          type="number"
                          value="9509.26"
                        />
                        <select
                          class="sc-cmthru dJRhBf"
                          data-testid="currency-select-dropdown"
                        >
                          <option
                            class="sc-hMFtBS kbnnLB"
                            data-testid="xec-option"
                            value="XEC"
                          >
                            XEC
                          </option>
                          <option
                            class="sc-hMFtBS kbnnLB"
                            data-testid="fiat-option"
                            value="USD"
                          >
                            USD
                          </option>
                        </select>
                        <button
                          class="sc-iuJeZd eyejFI"
                        >
                          max
                        </button>
                      </div>
                      <div
                        class="sc-cLQEGU iqXcta"
                      />
                    </div>
                  </div>
                  <div
                    class="sc-jVODtj cuWQvi"
                  >
                    <div
                      class="sc-hXRMBi eRLasT"
                    >
                      <textarea
                        class="sc-hZSUBg jOQORm"
                        name="multiAddressInput"
                        placeholder="One address & amount per line, separated by comma 
e.g. 
ecash:qpatql05s9jfavnu0tv6lkjjk25n6tmj9gkpyrlwu8,500 
ecash:qzvydd4n3lm3xv62cx078nu9rg0e3srmqq0knykfed,700"
                      />
                      <div
                        class="sc-bAeIUo ftvryZ"
                      >
                        <div
                          class="sc-iujRgT fPbQxK"
                        />
                      </div>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-fjmCvl ftgGgR"
                >
                  <div
                    class="sc-TFwJa gzYRmt"
                  >
                    <div
                      class="sc-krvtoX bEDjtS"
                    >
                      <div
                        class="sc-fYiAbW jJtfwN"
                      >
                        <input
                          class="sc-eilVRo fppJlL"
                          data-testid="cashtab-msg-switch"
                          id="cashtab-msg-switch"
                          name="cashtab-msg-switch"
                          type="checkbox"
                        />
                        <label
                          class="sc-fOKMvo eRGicA"
                          for="cashtab-msg-switch"
                        >
                          <span
                            class="sc-dUjcNx diwSdx"
                            data-off="  "
                            data-on="  "
                          />
                          <span
                            class="sc-gHboQg ezheid"
                          />
                        </label>
                      </div>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-eMigcr kXWyXT"
                >
                  <div
                    class="sc-fzsDOv VaPqk"
                  >
                    9,509.26 XEC
                  </div>
                  <div
                    class="sc-gGBfsJ kwjkAk"
                  >
                    =
                     
                    $  0.29 USD
                  </div>
                </div>
                <button
                  class="sc-kIPQKe sc-ibxdXY kNtcVG"
                  data-testid="send-it"
                  style="margin-top: 12px;"
                >
                  Send
                </button>
              </div>
            </div>
            <div
              class="sc-cTjmhe bwPJKO"
            >
              <button
                class="sc-gbOuXE leyCUq"
              >
                <svg />
              </button>
              <button
                class="sc-gbOuXE fQQUZN"
                data-testid="nav-btn-send"
              >
                <svg
                  class="sc-ckVGcZ hdgytv"
                  style="margin-top: -9px;"
                />
              </button>
              <button
                class="sc-gbOuXE leyCUq"
                data-testid="nav-btn-etokens"
              >
                <span
                  aria-label="appstore-add"
                  class="anticon anticon-appstore-add"
                  role="img"
                  style="font-size: 24px;"
                >
                  <svg
                    aria-hidden="true"
                    data-icon="appstore-add"
                    fill="currentColor"
                    focusable="false"
                    height="1em"
                    viewBox="64 64 896 896"
                    width="1em"
                  >
                    <defs />
                    <path
                      d="M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"
                    />
                  </svg>
                </span>
              </button>
              <button
                class="sc-gbOuXE leyCUq"
                data-testid="nav-btn-receive"
              >
                <svg />
              </button>
              <div
                class="sc-fnwBNb cUeIq"
                data-testid="hamburger"
              >
                <span
                  class="sc-iNhVCk jGoCDB"
                />
                <div
                  class="sc-eAKXzc dUxowl"
                  data-testid="hamburger-menu"
                >
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-airdrop"
                  >
                     
                    <p>
                      Airdrop
                    </p>
                    <svg
                      height="33px"
                      width="30px"
                    />
                  </button>
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-swap"
                  >
                     
                    <p>
                      Swap
                    </p>
                    <span
                      aria-label="swap"
                      class="anticon anticon-swap"
                      role="img"
                      style="font-size: 24px;"
                    >
                      <svg
                        aria-hidden="true"
                        data-icon="swap"
                        fill="currentColor"
                        focusable="false"
                        height="1em"
                        viewBox="64 64 896 896"
                        width="1em"
                      >
                        <path
                          d="M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"
                        />
                      </svg>
                    </span>
                  </button>
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-signverifymsg"
                  >
                    <p>
                      Sign & Verify
                    </p>
                    <svg
                      class="sc-fjdhpX cDBHeW"
                    />
                  </button>
                  <button
                    class="sc-bfYoXt hytFOf"
                    data-testid="nav-btn-configure"
                  >
                    <p>
                      Settings
                    </p>
                    <svg
                      height="33px"
                      width="30px"
                    />
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByText (/work/cashtab/src/components/Send/__tests__/SendXec.test.js:1241:33)
====== CashTab Unit Tests: <SendXec /> If the user has minFeeSends set to true but no longer has the right token amount, the feature is disabled ======
TestingLibraryElementError: Unable to find an element with the text: Message. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="ant-spin-nested-loading css-dev-only-do-not-override-1rqnfsa"
    >
      <div
        class="ant-spin-container"
      >
        <div
          class="sc-cHSUfg loJbgV"
        >
          <div
            class="Toastify"
          >
            <div
              class="Toastify__toast-container Toastify__toast-container--top-right sc-iYUSvU fpeDsm"
            >
              <div
                class="Toastify__toast Toastify__toast-theme--light Toastify__toast--default Toastify__toast--close-on-click Toastify--animate Toastify__bounce-enter--top-right"
                data-in="true"
                id="2"
              >
                <div
                  class="Toastify__toast-body"
                  role="alert"
                >
                  <div
                    class="Toastify__toast-icon Toastify--animate-icon Toastify__zoom-enter"
                  >
                    <div
                      class="ant-image css-dev-only-do-not-override-1rqnfsa"
                      style="width: 24px; height: 24px;"
                    >
                      <img
                        class="ant-image-img css-dev-only-do-not-override-1rqnfsa"
                        height="24px"
                        src="test-file-stub"
                        style="height: 24px;"
                        width="24px"
                      />
                    </div>
                  </div>
                  <div>
                    <a
                      class="sc-krDsej bDQWZX"
                      href="https://explorer.e.cash/tx/79e6afc28d4149c51c4e2a32c05c57fb59c1c164fde1afc655590ce99ed70cb8"
                      rel="noopener noreferrer"
                      target="_blank"
                    >
                      eCash sent
                    </a>
                  </div>
                </div>
                <button
                  aria-label="close"
                  class="Toastify__close-button Toastify__close-button--light"
                  type="button"
                >
                  <svg
                    aria-hidden="true"
                    viewBox="0 0 14 16"
                  >
                    <path
                      d="M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"
                      fill-rule="evenodd"
                    />
                  </svg>
                </button>
                <div
                  class="Toastify__progress-bar--wrp"
                  data-hidden="false"
                >
                  <div
                    class="Toastify__progress-bar--bg Toastify__progress-bar-theme--light Toastify__progress-bar--default"
                  />
                  <div
                    aria-hidden="false"
                    aria-label="notification timer"
                    class="Toastify__progress-bar Toastify__progress-bar--animated Toastify__progress-bar-theme--light Toastify__progress-bar--default"
                    role="progressbar"
                    style="animation-duration: 5000ms; animation-play-state: paused;"
                  />
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-dRFtgE eHkAmR"
          >
            <div
              class="sc-hUfwpO jpGvqD"
            >
              <div
                class="sc-cugefK lnAMdM"
              >
                <div
                  class="sc-imABML dVimwd"
                >
                  <img
                    alt="cashtab"
                    class="sc-cjHlYL bxEzsg"
                    src="test-file-stub"
                  />
                </div>
                <div
                  class="sc-jqCOkK kwqwxz"
                  data-testid="wallet-info-ctn"
                >
                  <div
                    class="sc-hBbWxd clXSff"
                  >
                    <select
                      class="sc-dyGzUR kRHcyB"
                      id="wallets"
                      name="wallets"
                    >
                      <option
                        class="sc-drKuOJ buwMlV"
                        value="Transaction Fixtures"
                      >
                        Transaction Fixtures
                      </option>
                    </select>
                    <div
                      class="sc-eNQAEJ kAwVTN"
                    >
                      <svg
                        class="sc-htoDjs dHRdfz"
                        style="margin-top: 8px;"
                      />
                    </div>
                    <div
                      class="sc-krvtoX bEDjtS"
                    >
                      <div
                        class="sc-fYiAbW bFoPAu"
                      >
                        <input
                          checked=""
                          class="sc-eilVRo fppJlL"
                    ...
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByText (/work/cashtab/src/components/Send/__tests__/SendXec.test.js:1416:23)

Each failure log is accessible here:
CashTab Unit Tests: <SendXec /> Pass a valid address and an invalid bip21 query string
CashTab Unit Tests: <SendXec /> Clicking "Send" will send a valid tx with op_return_raw after entry of a valid address and bip21 query string with valid amount and op_return_raw params to Send To field
CashTab Unit Tests: <SendXec /> We can calculate max send amount with and without a cashtab msg, and send a max sat tx with a cashtab msg
CashTab Unit Tests: <SendXec /> If the user has minFeeSends set to true but no longer has the right token amount, the feature is disabled

remove unimplemented formdata for opreturnraw, better variable names

better flex align for error and count

bytesofman edited the test plan for this revision. (Show Details)
bytesofman edited the test plan for this revision. (Show Details)
bytesofman published this revision for review.Apr 1 2024, 20:34
bytesofman added inline comments.
cashtab/src/components/Common/Inputs.js
211 ↗(On Diff #46702)

Add option to show a character count for TextArea

212 ↗(On Diff #46702)

because cashtab msg count is actually bytes and not string length, we need to pass a custom state field here

cashtab/src/components/Send/SendXec.js
172 ↗(On Diff #46702)

this is called opReturnMsg because it predates the cashtab msg spec. Also used to be the only type of op return we could send here.

Now that we have opreturn raw, needs a better name. Since it is formdata, add it to formdata.

215 ↗(On Diff #46702)

stop hardcoding this in two places. keep it in one place so changes in both.

emack requested changes to this revision.Apr 2 2024, 01:53
emack added a subscriber: emack.

Is the following expected behavior?

  1. fill in valid address, amount and message
  2. close the message toggle indicating the user has changed their mind about sending this with a message
  3. click send and observe on the explorer that the message was sent anyway

Also it's now allowing messages with a bunch of empty spaces to be sent, whereas previously I recall we trimmed it and if it didn't have anything of substance in there we ignored the message.

cashtab/src/components/Send/SendXec.js
896 ↗(On Diff #46704)

I had to squint to figure out this was a mailbox, and that was already knowing the context of this diff. I'd say it's not very intuitive for most users.

image.png (79×101 px, 1 KB)

I'd suggest a standard mail icon that's more universal to represent messages
image.png (142×195 px, 4 KB)

This revision now requires changes to proceed.Apr 2 2024, 01:53

Is the following expected behavior?

  1. fill in valid address, amount and message
  2. close the message toggle indicating the user has changed their mind about sending this with a message
  3. click send and observe on the explorer that the message was sent anyway

Good catch. Updated and added a test to fix this. I want to keep the cashtab msg form data, since the user may have typed a long-ish msg and not want it to disappear if they play with the switch (tempting). If the switch is off, we do not send the msg. But if they turn the switch back on, their msg is still there.

Also it's now allowing messages with a bunch of empty spaces to be sent, whereas previously I recall we trimmed it and if it didn't have anything of substance in there we ignored the message.

I don't allow an empty msg, but other than that -- any user input will be utf8'd and broadcast. This is confirmed in an existing integration test. We did used to .trim() everything, this was changed when I implemented spec and spec'd functions for Cashtab Msg.

change emoji and add label to cashtab msg switch, disable cashtab msg if switch is off

bytesofman added inline comments.
cashtab/src/components/Send/SendXec.js
896 ↗(On Diff #46704)

Changed to the letter emoji and added a label to make it less ambiguous.

I'd like to stick with emojis where possible on the switches, as any icon is a bit of a styling situation. Also imo emojis are becoming something of a lingua franca of the internet in a way that is not really true for icons anymore (bar a handful of icons that have "stuck", e.g. the copy paste icon).

emack requested changes to this revision.Apr 2 2024, 07:42

Now if you enter in an invalid message (i.e. over length limit), then close the message toggle, the Send button is disabled even though theoretically it should be sending the tx without the message.

This revision now requires changes to proceed.Apr 2 2024, 07:42
bytesofman marked an inline comment as done.

update disable validation to use more specific cashtab msg variables

Now if you enter in an invalid message (i.e. over length limit), then close the message toggle, the Send button is disabled even though theoretically it should be sending the tx without the message.

good catch. Updated the function to check this case with better variable names.

Failed tests logs:

====== CashTab Unit Tests: <SendXec /> We can send an XEC tx to multiple users ======
Error: expect(element).not.toHaveStyle()

Compared values have no visual difference.
    at Object.toHaveStyle (/work/cashtab/src/components/Send/__tests__/SendXec.test.js:1547:66)

Each failure log is accessible here:
CashTab Unit Tests: <SendXec /> We can send an XEC tx to multiple users

Failed tests logs:

====== CashTab Unit Tests: <SendXec /> We can send an XEC tx to multiple users ======
Error: expect(element).not.toHaveStyle()

Compared values have no visual difference.
    at Object.toHaveStyle (/work/cashtab/src/components/Send/__tests__/SendXec.test.js:1547:66)

Each failure log is accessible here:
CashTab Unit Tests: <SendXec /> We can send an XEC tx to multiple users

Correct implementation of updated function in SendXec screen

This revision is now accepted and ready to land.Apr 2 2024, 23:06