Page MenuHomePhabricator

[Cashtab] Update alias.js with direct antd calls
Changes PlannedPublic

Authored by emack on Feb 16 2024, 12:37.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

Update all notification logic to call the antd API directly from callsite

Test Plan
  • register an available alias and ensure success notification
  • malform config/alias.js/aliasServerBaseUrl and ensure error notification upon navigating to alias.js

Diff Detail

Repository
rABC Bitcoin ABC
Branch
aliasNotif
Lint
Lint Skipped
Unit
No Test Coverage
Build Status
Buildable 27228
Build 54019: Build Diffcashtab-tests
Build 54018: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <App /> Adding a contact to an existing contactList by clicking on tx history adds it to localforage and wallet context ======
Error: Unable to perform pointer interaction as the element inherits `pointer-events: none`:

DIV  <-- This element declared `pointer-events: none`
 DIV
  DIV
   DIV
    DIV(testId=home-ctn)
     DIV(testId=tx-history-ctn)
      DIV
       DIV(testId=tx-collapse)
        DIV
         DIV
          DIV  <-- Asserted pointer events here

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div>
      <div
        class="ant-spin-nested-loading css-dev-only-do-not-override-1rqnfsa"
      >
        <div
          class="ant-spin-container"
        >
          <div
            class="sc-LKuAh jSXNAo"
          >
            <div
              class="sc-kZmsYB eHkWzo"
            >
              <div
                class="sc-RcBXQ gMCskf"
              >
                <div
                  class="sc-hzNEM iiFjIO"
                >
                  <div
                    class="sc-iSDuPN ccpgHi"
                  >
                    <img
                      alt="cashtab"
                      class="sc-fZwumE bcurWd"
                      src="test-file-stub"
                    />
                  </div>
                  <div
                    class="sc-elJkPf geNavj"
                    data-testid="wallet-info-ctn"
                  >
                    <div
                      class="sc-dEoRIm iVOOxs"
                    >
                      <div
                        class="sc-jtggT dNidya"
                      >
                        [Burned] useWallet Mock
                      </div>
                      <a
                        href="/configure"
                      >
                        <svg
                          class="sc-jTzLTM bTdWCF"
                        />
                      </a>
                      <div>
                         
                        <button
                          aria-checked="true"
                          class="ant-switch ant-switch-small css-dev-only-do-not-override-1rqnfsa ant-switch-checked"
                          role="switch"
                          type="button"
                        >
                          <div
                            class="ant-switch-handle"
                          />
                          <span
                            class="ant-switch-inner"
                          >
                            <span
                              class="ant-switch-inner-checked"
                            >
                              <svg
                                class="sc-cSHVUG bgwEHu"
                              />
                            </span>
                            <span
                              class="ant-switch-inner-unchecked"
                            >
                              <svg
                                class="sc-kAzzGY fUTkYj"
                              />
                            </span>
                          </span>
                        </button>
                      </div>
                    </div>
                    <div
                      class="sc-ebFjAB kxaSkj"
                      data-testid="balance-xec"
                    >
                      10,000.00
                       
                      XEC
                       
                    </div>
                    <div
                      class="sc-jKVCRD bKzIGa"
                      data-testid="balance-fiat"
                    >
                      $
                      0.30
                       
                      USD
                    </div>
                    <p
                      class="sc-kaNhvL kDOvrh"
                      data-testid="ecash-price"
                    >
                      1 
                      XEC
                       = 
                      0.00003000
                       
                      USD
                    </p>
                  </div>
                </div>
                <br />
                <div
                  class="sc-lhVmIH gJoLAm"
                  data-testid="home-ctn"
                >
                  <div
                    class="sc-kPVwWT WzIzL"
                    data-testid="tx-history-ctn"
                  >
                    <div>
                      <div
                        class="sc-fYxtnH grnFXT"
                        data-testid="tx-collapse"
                      >
                        <div
                          class="ant-collapse ant-collapse-icon-position-start ant-collapse-borderless css-dev-only-do-not-override-1rqnfsa"
                        >
                          <div
                            class="ant-collapse-item ant-collapse-no-arrow"
                          >
                            <div
                              aria-disabled="false"
                              aria-expanded="false"
                              class="ant-collapse-header"
                              role="button"
                              tabindex="0"
                            >
                              <span
                                class="ant-collapse-header-text"
                              >
                                <div
                                  class="sc-jnlKLf cCxHyz"
                                >
                                  <div
                                    class="sc-Rmtcm sc-fBuWsC hjEaKK...
    at Object.assertPointerEvents (/work/cashtab/node_modules/@testing-library/user-event/dist/cjs/utils/pointer/cssPointerEvents.js:47:15)
    at Object.enter (/work/cashtab/node_modules/@testing-library/user-event/dist/cjs/system/pointer/pointer.js:57:34)
    at PointerHost.move (/work/cashtab/node_modules/@testing-library/user-event/dist/cjs/system/pointer/index.js:50:79)
    at pointerAction (/work/cashtab/node_modules/@testing-library/user-event/dist/cjs/pointer/index.js:64:39)
    at Object.pointer (/work/cashtab/node_modules/@testing-library/user-event/dist/cjs/pointer/index.js:32:15)
    at Object.asyncWrapper (/work/cashtab/node_modules/@testing-library/react/dist/pure.js:88:22)
    at /work/cashtab/src/components/__tests__/AppIntegrations.test.js:335:13

Each failure log is accessible here:
CashTab Unit Tests: <App /> Adding a contact to an existing contactList by clicking on tx history adds it to localforage and wallet context

Removed draft int test and also patched an uncaught exception when malforming alias server url.

rebased to master and updated try/catch var usage

emack published this revision for review.Feb 16 2024, 14:04
emack edited the test plan for this revision. (Show Details)
emack added a reviewer: bytesofman.
bytesofman added inline comments.
cashtab/src/components/Alias/Alias.js
127 ↗(On Diff #45307)

we shouldn't be doing this (setIsValidAliasInput(false);)

instead, we should make sure the Register button is disabled, and a validation msg appears if aliasServerError is set

want to avoid manually settting 2 flags that do the same thing when we can just use the one.

161 ↗(On Diff #45307)

ditto

prob need to do this patch first

238 ↗(On Diff #45307)

ditto

This revision now requires changes to proceed.Feb 16 2024, 17:07
emack requested review of this revision.Feb 17 2024, 08:25
emack added inline comments.
cashtab/src/components/Alias/Alias.js
127 ↗(On Diff #45307)

They're two separate use cases though.
There could be server errors when the alias input is valid, and vice versa, or when there are both alias input and server errors occurring at the same time. If I only use the one state var then there's no way for the frontend to distinguish whether the user entered invalid alias or the alias-server is down.
i.e. isValidAliasInput is referenced by the <AliasInput> component which shouldn't be influenced by server errors.

cashtab/src/components/Alias/Alias.js
127 ↗(On Diff #45307)

in this case, we should not setIsValidAliasInput(false) on a price error -- the alias input may still be valid here. it's the price error that should prevent registration.

emack marked an inline comment as done.
emack edited the test plan for this revision. (Show Details)

Removed setIsValidAliasInput(false) on price error

Removed setIsValidAliasInput(false) on price error

-nothing in the test plan confirming how this is not a behavior change
-we are still using this practice in other errors

need a diff that stops doing this throughout this component first, then rebase this onto that

This revision now requires changes to proceed.Feb 18 2024, 14:28
emack planned changes to this revision.Mar 2 2024, 13:32