Page MenuHomePhabricator

[Cashtab] Do not load ONESHOT offers on manage screen for partials
ClosedPublic

Authored by bytesofman on Tue, Nov 12, 14:32.

Details

Summary

We get tokenIds from the activeOffersByPubKey method to help the user manage their active offers. But we can only load PARTIAL offers with the Orderbook component.

Filter activeOffersByPubKey to only manage partial offers from the partial screen. This prevents white screen failures when clicking manage from partial screen.

Test Plan

npm test, npm start, list nft and list token, go to agora screen, toggle switch, no white screen failure from minAcceptedTokens method not existing for oneshot offers

Diff Detail

Repository
rABC Bitcoin ABC
Branch
manage-offers-patch
Lint
Lint Errors
SeverityLocationCodeMessage
Errorcashtab/src/components/Agora/__tests__/index.test.js:396ESLINTjest/no-focused-tests
Unit
No Test Coverage
Build Status
Buildable 31092
Build 61685: Build Diffcashtab-tests
Build 61684: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <Agora /> We can fetch and use the blacklist from token server ======
TestingLibraryElementError: Unable to find an element with the text: Badger Universal Token (BUX). 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="sc-bhlBdH byZTTr"
    >
      <div
        class="Toastify"
      />
      <div
        class="sc-AnqlK gvbETP"
      >
        <div
          class="sc-keFjpB fLyXAj"
        >
          <div
            class="sc-chAAoq gOeUUT"
          >
            <img
              alt="cashtab"
              class="sc-dTLGrV coFBhh"
              src="test-file-stub"
            />
          </div>
          <div
            class="sc-gGCbJM QONGh"
          >
            <select
              class="sc-lcpuFF gOWThw"
              data-testid="wallet-select"
              id="wallets"
              name="wallets"
            >
              <option
                class="sc-bqjOQT cctRYD"
                value="Agora Partial Alpha"
              >
                Agora Partial Alpha
              </option>
              <option
                class="sc-bqjOQT cctRYD"
                value="Agora Partial Beta"
              >
                Agora Partial Beta
              </option>
            </select>
            <div
              class="sc-ciodno khxwxx"
            >
              <button
                aria-label="Copy ecash:qqpmsv8yh8wwx3lnf92rrc0e6yq97j6zqs8av8vx8h"
                class="sc-cQFLBn jGCEIx"
              >
                <svg
                  title="copy-paste"
                />
              </button>
              <div
                class="sc-gFaPwZ bhfoic"
              >
                <div
                  class="sc-fhYwyz kXwmEk"
                >
                  <input
                    checked=""
                    class="sc-bMvGRv dnGmSn"
                    id="show-hide-balance"
                    name="show-hide-balance"
                    title="show-hide-balance"
                    type="checkbox"
                  />
                  <label
                    class="sc-jzgbtB hsNhPD"
                    for="show-hide-balance"
                  >
                    <span
                      class="sc-gJWqzi dYGNll"
                      data-off=""
                      data-on=""
                    />
                    <span
                      class="sc-rBLzX gWpmmy"
                    />
                  </label>
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-fHSTwm gtagmW"
            title="Wallet Info"
          >
            <div
              class="sc-crNyjn czvvKH"
              title="Balance in XEC"
            >
              4,200.00
               
              XEC
               
            </div>
            <div
              class="sc-cpHetk dZbjxd"
              title="Balance in Local Currency"
            >
              $
              0.13
               
              USD
            </div>
            <p
              class="sc-nrwXf bnjimB"
              title="Price in Local Currency"
            >
              1 
              XEC
               = 
              0.00003000
               
              USD
            </p>
          </div>
          <div
            class="sc-hycgNl eVPFU"
          >
            <div
              class="sc-dEfkYy ephScI"
              title="Active Offers"
            >
              <div
                class="sc-etwtAo eenSFC"
              >
                <div
                  class="sc-gFaPwZ bhfoic"
                >
                  <div
                    class="sc-fhYwyz kZTqdd"
                  >
                    <input
                      class="sc-bMvGRv dnGmSn"
                      id="Toggle Active Offers"
                      name="Toggle Active Offers"
                      title="Toggle Active Offers"
                      type="checkbox"
                    />
                    <label
                      class="sc-jzgbtB hsNhPD"
                      for="Toggle Active Offers"
                    >
                      <span
                        class="sc-gJWqzi gEydeL"
                        data-off=""
                        data-on=""
                      />
                      <span
                        class="sc-rBLzX hAekJS"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-hqyNC ctrwFD"
                >
                  Toggle Buy / Manage Listings
                </div>
              </div>
              <div
                class="sc-cqPOvA gwuBes"
              >
                Manage your listings
              </div>
              <p>
                You do not have any listed tokens
              </p>
            </div>
          </div>
        </div>
        <div
          class="sc-jWojfa heNGtk"
        >
          <button
            class="sc-jvEmr hNyyAX"
          >
            <svg />
          </button>
          <button
            aria-label="Send Screen"
            class="sc-jvEmr hNyyAX"
            style="padding-bottom: 10px;"
          >
            <div
              class="sc-iwsKbI cuDgAv"
            >
              <svg
                title="tx-sent"
              />
            </div>
          </button>
          <button
            aria-label="Tokens"
            class="sc-jvEmr hNyyAX"
          >
            <svg
              title="Tokens"
            />
          </button>
          <button
            aria-label="Receive"
            class="sc-jvEmr hNyyAX"
          >
            <svg
              title="tx-received"
            />
          </button>
          <div
            class="sc-kVrTmx eDxOwS"
            title="Show Other Screens"
          >
            <span
              class="sc-ekkqgF kwBLNi"
            />
            <div
              class="sc-iBmynh iNnluN"
              title="Other Screens"
            >
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Wallet Backup
                </p>
                <svg
                  title="wallet"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Wallets
                </p>
                <svg
                  title="wallets"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Listed NFTs
                </p>
                <svg
                  title="NFT"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Agora
                </p>
                <svg
                  title="Meme Agora"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Contacts
                </p>
                <svg
                  title="Contact List"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Airdrop
                </p>
                <svg
                  title="tx-airdrop"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Rewards
                </p>
                <svg
                  title="Cashtab Rewards"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Swap
                </p>
                <svg
                  title="swap"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                <p>
                  Sign & Verify
                </p>
                <svg
                  class="sc-htpNat bPFBeM"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                <p>
                  Settings
                </p>
                <svg
                  title="settings"
                />
              </button>
            </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/Agora/__tests__/index.test.js:317:20)
====== CashTab Unit Tests: <Agora /> On token server API fail, we fall back to locally maintained blacklist. A blacklisted offer does not render in all offers, but will render in My offers ======
TestingLibraryElementError: Unable to find an element with the text: Badger Universal Token (BUX). 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="sc-bhlBdH byZTTr"
    >
      <div
        class="Toastify"
      />
      <div
        class="sc-AnqlK gvbETP"
      >
        <div
          class="sc-keFjpB fLyXAj"
        >
          <div
            class="sc-chAAoq gOeUUT"
          >
            <img
              alt="cashtab"
              class="sc-dTLGrV coFBhh"
              src="test-file-stub"
            />
          </div>
          <div
            class="sc-gGCbJM QONGh"
          >
            <select
              class="sc-lcpuFF gOWThw"
              data-testid="wallet-select"
              id="wallets"
              name="wallets"
            >
              <option
                class="sc-bqjOQT cctRYD"
                value="Agora Partial Alpha"
              >
                Agora Partial Alpha
              </option>
              <option
                class="sc-bqjOQT cctRYD"
                value="Agora Partial Beta"
              >
                Agora Partial Beta
              </option>
            </select>
            <div
              class="sc-ciodno khxwxx"
            >
              <button
                aria-label="Copy ecash:qqpmsv8yh8wwx3lnf92rrc0e6yq97j6zqs8av8vx8h"
                class="sc-cQFLBn jGCEIx"
              >
                <svg
                  title="copy-paste"
                />
              </button>
              <div
                class="sc-gFaPwZ bhfoic"
              >
                <div
                  class="sc-fhYwyz kXwmEk"
                >
                  <input
                    checked=""
                    class="sc-bMvGRv dnGmSn"
                    id="show-hide-balance"
                    name="show-hide-balance"
                    title="show-hide-balance"
                    type="checkbox"
                  />
                  <label
                    class="sc-jzgbtB hsNhPD"
                    for="show-hide-balance"
                  >
                    <span
                      class="sc-gJWqzi dYGNll"
                      data-off=""
                      data-on=""
                    />
                    <span
                      class="sc-rBLzX gWpmmy"
                    />
                  </label>
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-fHSTwm gtagmW"
            title="Wallet Info"
          >
            <div
              class="sc-crNyjn czvvKH"
              title="Balance in XEC"
            >
              4,200.00
               
              XEC
               
            </div>
            <div
              class="sc-cpHetk dZbjxd"
              title="Balance in Local Currency"
            >
              $
              0.13
               
              USD
            </div>
            <p
              class="sc-nrwXf bnjimB"
              title="Price in Local Currency"
            >
              1 
              XEC
               = 
              0.00003000
               
              USD
            </p>
          </div>
          <div
            class="sc-hycgNl eVPFU"
          >
            <div
              class="sc-dEfkYy ephScI"
              title="Active Offers"
            >
              <div
                class="sc-etwtAo eenSFC"
              >
                <div
                  class="sc-gFaPwZ bhfoic"
                >
                  <div
                    class="sc-fhYwyz kZTqdd"
                  >
                    <input
                      class="sc-bMvGRv dnGmSn"
                      id="Toggle Active Offers"
                      name="Toggle Active Offers"
                      title="Toggle Active Offers"
                      type="checkbox"
                    />
                    <label
                      class="sc-jzgbtB hsNhPD"
                      for="Toggle Active Offers"
                    >
                      <span
                        class="sc-gJWqzi gEydeL"
                        data-off=""
                        data-on=""
                      />
                      <span
                        class="sc-rBLzX hAekJS"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-hqyNC ctrwFD"
                >
                  Toggle Buy / Manage Listings
                </div>
              </div>
              <div
                class="sc-cqPOvA gwuBes"
              >
                Manage your listings
              </div>
              <p>
                You do not have any listed tokens
              </p>
            </div>
          </div>
        </div>
        <div
          class="sc-jWojfa heNGtk"
        >
          <button
            class="sc-jvEmr hNyyAX"
          >
            <svg />
          </button>
          <button
            aria-label="Send Screen"
            class="sc-jvEmr hNyyAX"
            style="padding-bottom: 10px;"
          >
            <div
              class="sc-iwsKbI cuDgAv"
            >
              <svg
                title="tx-sent"
              />
            </div>
          </button>
          <button
            aria-label="Tokens"
            class="sc-jvEmr hNyyAX"
          >
            <svg
              title="Tokens"
            />
          </button>
          <button
            aria-label="Receive"
            class="sc-jvEmr hNyyAX"
          >
            <svg
              title="tx-received"
            />
          </button>
          <div
            class="sc-kVrTmx eDxOwS"
            title="Show Other Screens"
          >
            <span
              class="sc-ekkqgF kwBLNi"
            />
            <div
              class="sc-iBmynh iNnluN"
              title="Other Screens"
            >
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Wallet Backup
                </p>
                <svg
                  title="wallet"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Wallets
                </p>
                <svg
                  title="wallets"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Listed NFTs
                </p>
                <svg
                  title="NFT"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Agora
                </p>
                <svg
                  title="Meme Agora"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Contacts
                </p>
                <svg
                  title="Contact List"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Airdrop
                </p>
                <svg
                  title="tx-airdrop"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Rewards
                </p>
                <svg
                  title="Cashtab Rewards"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Swap
                </p>
                <svg
                  title="swap"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                <p>
                  Sign & Verify
                </p>
                <svg
                  class="sc-htpNat bPFBeM"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                <p>
                  Settings
                </p>
                <svg
                  title="settings"
                />
              </button>
            </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/Agora/__tests__/index.test.js:388:20)
====== CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer ======
TestingLibraryElementError: Unable to find an element with the text: Cachet (CACHET). 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="sc-bhlBdH byZTTr"
    >
      <div
        class="Toastify"
      />
      <div
        class="sc-AnqlK gvbETP"
      >
        <div
          class="sc-keFjpB fLyXAj"
        >
          <div
            class="sc-chAAoq gOeUUT"
          >
            <img
              alt="cashtab"
              class="sc-dTLGrV coFBhh"
              src="test-file-stub"
            />
          </div>
          <div
            class="sc-gGCbJM QONGh"
          >
            <select
              class="sc-lcpuFF hEMuKM"
              data-testid="wallet-select"
              id="wallets"
              name="wallets"
            >
              <option
                class="sc-bqjOQT cctRYD"
                value="Agora Partial Beta"
              >
                Agora Partial Beta
              </option>
              <option
                class="sc-bqjOQT cctRYD"
                value="Agora Partial Alpha"
              >
                Agora Partial Alpha
              </option>
            </select>
            <div
              class="sc-ciodno khxwxx"
            >
              <button
                aria-label="Copy ecash:qreq3mm4avxaw782g4qvhktx4qcv0w2tkqj3j5jaad"
                class="sc-cQFLBn jGCEIx"
              >
                <svg
                  title="copy-paste"
                />
              </button>
              <div
                class="sc-gFaPwZ bhfoic"
              >
                <div
                  class="sc-fhYwyz kXwmEk"
                >
                  <input
                    checked=""
                    class="sc-bMvGRv dnGmSn"
                    id="show-hide-balance"
                    name="show-hide-balance"
                    title="show-hide-balance"
                    type="checkbox"
                  />
                  <label
                    class="sc-jzgbtB hsNhPD"
                    for="show-hide-balance"
                  >
                    <span
                      class="sc-gJWqzi dYGNll"
                      data-off=""
                      data-on=""
                    />
                    <span
                      class="sc-rBLzX gWpmmy"
                    />
                  </label>
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-fHSTwm gtagmW"
            title="Wallet Info"
          >
            <div
              class="sc-crNyjn czvvKH"
              title="Balance in XEC"
            >
              42.00
               
              XEC
               
            </div>
            <div
              class="sc-cpHetk dZbjxd"
              title="Balance in Local Currency"
            >
              $
              0.00
               
              USD
            </div>
            <p
              class="sc-nrwXf bnjimB"
              title="Price in Local Currency"
            >
              1 
              XEC
               = 
              0.00003000
               
              USD
            </p>
          </div>
          <div
            class="sc-hycgNl eVPFU"
          >
            <div
              class="sc-dEfkYy ephScI"
              title="Active Offers"
            >
              <div
                class="sc-etwtAo eenSFC"
              >
                <div
                  class="sc-gFaPwZ bhfoic"
                >
                  <div
                    class="sc-fhYwyz kZTqdd"
                  >
                    <input
                      class="sc-bMvGRv dnGmSn"
                      id="Toggle Active Offers"
                      name="Toggle Active Offers"
                      title="Toggle Active Offers"
                      type="checkbox"
                    />
                    <label
                      class="sc-jzgbtB hsNhPD"
                      for="Toggle Active Offers"
                    >
                      <span
                        class="sc-gJWqzi gEydeL"
                        data-off=""
                        data-on=""
                      />
                      <span
                        class="sc-rBLzX hAekJS"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-hqyNC ctrwFD"
                >
                  Toggle Buy / Manage Listings
                </div>
              </div>
              <div
                class="sc-cqPOvA gwuBes"
              >
                Manage your listings
              </div>
              <p>
                You do not have any listed tokens
              </p>
            </div>
          </div>
        </div>
        <div
          class="sc-jWojfa heNGtk"
        >
          <button
            class="sc-jvEmr hNyyAX"
          >
            <svg />
          </button>
          <button
            aria-label="Send Screen"
            class="sc-jvEmr hNyyAX"
            style="padding-bottom: 10px;"
          >
            <div
              class="sc-iwsKbI cuDgAv"
            >
              <svg
                title="tx-sent"
              />
            </div>
          </button>
          <button
            aria-label="Tokens"
            class="sc-jvEmr hNyyAX"
          >
            <svg
              title="Tokens"
            />
          </button>
          <button
            aria-label="Receive"
            class="sc-jvEmr hNyyAX"
          >
            <svg
              title="tx-received"
            />
          </button>
          <div
            class="sc-kVrTmx eDxOwS"
            title="Show Other Screens"
          >
            <span
              class="sc-ekkqgF kwBLNi"
            />
            <div
              class="sc-iBmynh iNnluN"
              title="Other Screens"
            >
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Wallet Backup
                </p>
                <svg
                  title="wallet"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Wallets
                </p>
                <svg
                  title="wallets"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Listed NFTs
                </p>
                <svg
                  title="NFT"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Agora
                </p>
                <svg
                  title="Meme Agora"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Contacts
                </p>
                <svg
                  title="Contact List"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Airdrop
                </p>
                <svg
                  title="tx-airdrop"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Rewards
                </p>
                <svg
                  title="Cashtab Rewards"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                 
                <p>
                  Swap
                </p>
                <svg
                  title="swap"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                <p>
                  Sign & Verify
                </p>
                <svg
                  class="sc-htpNat bPFBeM"
                />
              </button>
              <button
                class="sc-fKGOjr kSYpuI"
              >
                <p>
                  Settings
                </p>
                <svg
                  title="settings"
                />
              </button>
            </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/Agora/__tests__/index.test.js:549:23)

Each failure log is accessible here:
CashTab Unit Tests: <Agora /> We can fetch and use the blacklist from token server
CashTab Unit Tests: <Agora /> On token server API fail, we fall back to locally maintained blacklist. A blacklisted offer does not render in all offers, but will render in My offers
CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer

patch key access syntax error

This revision is now accepted and ready to land.Tue, Nov 12, 15:16