Commit Graph

32 Commits

Author SHA1 Message Date
flexsurfer 602b27105b
FINAL BOSS! rename status-im2 to status-im (#18241) 2023-12-19 20:59:07 +01:00
flexsurfer f89fd8ca54
move status-im under legacy (#18237) 2023-12-19 18:41:30 +01:00
flexsurfer fe20fa4e99
move transport (#18062) 2023-12-05 09:35:17 +01:00
Icaro Motta b9353b1ccd
Fix: actually run integration tests (#17900)
Integration tests weren't running since https://github.com/status-im/status-mobile/pull/17762 was merged a week ago.

This commit also allows individual integration test namespaces to run if you change the :ns-regexp option in shadow-cljs. This is quite handy, since they are relatively slow.

Fixes https://github.com/status-im/status-mobile/issues/17895
2023-11-15 19:51:09 -03:00
David Martin cb005afff2
Split up integration tests (#17762) 2023-11-07 16:47:02 +05:30
Ulises Manuel 4a874ce48d
[#17023] Share qr code variants (#17736)
* Align docstring

* Create share-qr-code component

* Remove empty style file

* Implement common.share-qr-code including call to media server

* Add share-qr-code preview screen

* Use share-qr-code component in shell's share screen

* Add tests and some fixes
2023-10-31 12:35:28 -06:00
Omar Basem 07dd42a7d3
Wallet: Network Preferences drawer (#17710)
* Wallet: Network Preferences drawer
2023-10-25 14:55:17 +04:00
flexsurfer 4a8a23a4c4
rename to wallet-legacy (#17673) 2023-10-19 13:50:55 +02:00
flexsurfer 6f9bcd1bb1
rename quo2 (#17660) 2023-10-17 17:27:18 +02:00
Icaro Motta 7ae96e86f1
Enable ns sorting linter and clean+sort all namespaces (#17618) 2023-10-16 22:03:18 +00:00
Brian Sztamfater baa9dff237
feat: implement address input (#17191)
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-09-13 10:26:29 -03:00
Icaro Motta 6ea31695d6
Do not warn about subscriptions being used in non-reactive contexts (#17240)
Force re-frame to stop warning about subscriptions in non-reactive contexts
while executing subscription tests (i.e. unit tests using the macro
test-helpers.unit/deftest-sub).

The net result? No more hundreds of useless warnings in the output of make test.

    re-frame: Subscribe was called outside of a reactive context.
     See: https://day8.github.io/re-frame/FAQs/UseASubscriptionInAJsEvent/

The warning is actually useful in production code, but in a subscription test we
already know we're never inside a reactive context.
2023-09-12 11:58:06 -03:00
Icaro Motta 857c9c2f74
Unshadow remaining core & non-core vars (#17138)
Unshadows all remaining vars in status-mobile, including non
cljs.core/clojure.core ones. The only exceptions are cljs.core/type and
cljs.core/name (which happen quite often, so I'm not sure if it's worth
unshadowing them).
2023-09-01 11:54:53 +00:00
Mohamed Javid d143b1d0e9
[Quo2] Implement "Progress bar" component (#16905)
This commit implements the "Progress bar" component which is needed for wallet screen development.

Additionally, this commit adds a new test helper method "render-with-theme-provider" to test components in different themes.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-08-08 17:15:55 +05:30
Mohsen Ghafouri 3b8f66d2ec
[#16377] feat: add calendar component in quo2 preview (#16783) 2023-07-29 00:26:15 +05:30
Lungu Cristian d43b73b566
Slide button component (bounty) (#16259) 2023-06-15 14:25:52 +02:00
Icaro Motta 0dd3cb51fd
Improve option to mark all notifications read (#16044)
- [x] Use correct icon to mark notifications as read
- [x] Add support for the disabled state in action drawer actions
- [x] Update quo2 preview `drawers` > `action-drawers`
- [x] Rewrite the action drawer component spec to use our test helpers

Fixes https://github.com/status-im/status-mobile/issues/14983
2023-05-31 21:25:19 -03:00
Jamie Caprani 77ddd8688f
chore: add spec test for keycard component (#15920) 2023-05-19 04:45:47 -07:00
Ulises Manuel Cárdenas ee4bcf9116
Recovery phrase onboarding (#15831)
* Add missing tests for recovery phrase input
2023-05-09 21:55:09 -06:00
Brian Sztamfater e5913cc3ea
feat: audio component
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-05-04 10:48:05 -03:00
Icaro Motta d902fb10d1
New component - URL Preview List (#15620)
Implements the URL Preview List component.

Fixes https://github.com/status-im/status-mobile/issues/15617

Notes
=====

The quo component view implements the pattern recently described by @ulisesmac.
See his great explanation here:
https://github.com/status-im/status-mobile/issues/15552#issuecomment-1492590074.

Steps to test: Go to `Quo2.0 Preview` > `links` > `url-preview-list`
2023-04-13 10:52:27 -03:00
Icaro Motta bfc7a2d88b
Implement new URL Preview component (#15607)
Fix https://github.com/status-im/status-mobile/issues/15592

Notes:

- The red border around the icon has been reported in issue
  https://github.com/status-im/status-mobile/issues/15606
- The loading state doesn't have a spinning icon on purpose. This will be done
  separately.
2023-04-10 22:02:39 -03:00
Icaro Motta 7a4b12acf4
Make component test helpers usable from the REPL (#15468)
This commit makes the test-helpers.component namespace loadable in the REPL,
plus other changes that allow for a reasonably enjoyable RDD (REPL-Driven
Development) workflow.

Why? I want to be able to get instant feedback when I render a component with
the RN Testing Library (RNTL), and only once I'm satisfied with my findings is
when I proceed to write/update the tests. This nearly instant feedback loop is
only feasible using the ClojureScript REPL, and I'd rather not endure long
recompilation cycles.

Note that by REPL I mean connecting to the CLJS REPL of the Shadow-CLJS :mobile
target.

Essentially, this is what this commit does:

- [x] Allow the test-helpers.component namespace to be evaluated in the REPL.
      This is now possible because I changed all functions that assumed js/jest
      existed with a guard clause using the CLJS macro exists?. Without the
      guard clauses, evaluating the namespace explodes due to stuff like
      js/jest.useFakeTimers that fail in compile time (it's a syntax sugar
      macro).
- [x] Change the family of functions to get the translation by text to either
      translate using i18n/label or translate with the dummy prefix tx:,
      depending if the code is running inside the Jest runtime or not.
- [x] Wrap remaining RNTL query functions, except for the find-* ones, since
      they don't work at all outside the Jest runtime.
- [x] All wrapped functions support the original arguments supported by RNTL.
      Arguments are always converted with clj->js.
- [x] All wrapped functions can optionally take a node (ReactTestInstance) as
      their first argument, otherwise the global screen object will be used.
      This is very important! See the explanation on section Doesn't RNTL
      recommend using the screen object?
- [x] Update Shadow-CLJS preloads, so that (in development) you can fire off the
      REPL and always be ready to call component test helpers. This is critical!

What else would be possible? Just an idea, but now that we can easily render
components using the same machinery provided by RNTL in the tests, we can
roughly implement Storybook's Play function
https://storybook.js.org/docs/react/writing-stories/play-function

Lesson learned: In the REPL, you may need to call
(re-frame.core/clear-subscription-cache!), otherwise you will experience
subscriptions returning the same value if their arguments are the same. For
example, I faced this while playing with the namespace
status-im2.contexts.communities.menus.community-options.component-spec. There
are better ways to solve this particular problem in the context of tests if we
use the tooling provided by day8.re-frame.test.

Doesn't RNTL recommend using the screen object? Indeed, it is recommended to use
the screen object instead of destructuring the results of RNTL render. It's just
easier and less error prone, but this only works reliably within the Jest
runtime, since it automatically cleans up rendered state after each test. When
using the REPL this is no longer the case, and I faced some errors, like Unable
to find node on an unmounted component, where RNTL would refuse to re-render
components, even if I explicitly unmounted them or called cleanup.

The only reliable solution I found was to store the result of render (a node)
and pass it to every subsequent call. This is not a workaround, it's officially
supported, but it's a tad less convenient. You can also not pass the node
reference and it should work most of the time.

Practical examples

Workflow suggestion: write your local experiments in the same namespace as the
component spec and within the comment macro. This way, you can have the Jest
watcher running and a REPL connected to :mobile, and they won't step on each
other. For the test watcher, I usually change quo2-core-spec or
status-im2.core-spec to only require what I'm interested, otherwise Jest
consumes way too many resources.

```clojure
;; Namespace quo2.components.colors.color-picker.component-spec
(h/test "color picker color changed"
  (let [selected (reagent/atom nil)]
    (h/render [color-picker/view {:on-change #(reset! selected %)}])
    (h/fire-event :press (get (h/get-all-by-label-text :color-picker-item) 0))
    (-> (h/expect @selected)
        (.toStrictEqual :blue))))

(comment
  (def selected (atom nil))
  (def c (h/render [color-picker/view {:on-change #(reset! selected %)}]))

  (h/fire-event :press (get (h/get-all-by-label-text c :color-picker-item) 0))

  ;; Options are passed down converted to JS types.
  (h/debug c {:message "Rendering header"})

  @selected ; => :blue
)
```

```clojure
;; Namespace quo2.components.tags.--tests--.status-tags-component-spec
(h/test "renders status tag with pending type"
  (render-status-tag {:status {:type :pending}
                      :label  "Pending"
                      :size   :small})
  (-> (h/expect (h/get-all-by-label-text :status-tag-pending))
      (.toBeTruthy))
  (-> (h/expect (h/get-by-text "Pending"))
      (.toBeTruthy)))

(comment
  (def c (render-status-tag {:status {:type :pending}
                             :label  "Pending"
                             :size   :small}))

  (h/get-all-by-label-text c :status-tag-pending))
```

```clojure
;; Namespace status-im2.contexts.communities.menus.community-options.component-spec
(h/test "joined and muted community"
  (setup-subs {:communities/my-pending-request-to-join nil
               :communities/community                  {:joined       true
                                                        :muted        true
                                                        :token-gated? true}})
  (h/render [options/community-options-bottom-sheet {:id "test"}])
  (-> (h/expect (h/get-by-translation-text :unmute-community))
      (.toBeTruthy)))

(comment
  (setup-subs {:communities/my-pending-request-to-join nil
               :communities/community                  {:joined       true
                                                        :muted        true
                                                        :token-gated? true}})
  (def c (h/render [options/community-options-bottom-sheet {:id "test"}]))
  (some? (h/get-by-translation-text c :invite-people-from-contacts)) ; => true
)
```
2023-03-27 11:54:56 -03:00
Ulises Manuel Cárdenas 554f8aff09
Add input tests
Also fixes text align on non-multiline inputs
2023-03-21 12:28:02 -06:00
Ulises Manuel Cárdenas 8478ac74ab
Refactor user-avatar & add tests 2023-03-08 11:07:37 -06:00
Ajay Sivan aec1b5fafa
quo2 strength divider component (#15177) 2023-03-01 15:47:02 +00:00
Ajay Sivan d6c09d289c
quo2 color-picker component (#15105) 2023-02-22 12:05:40 +01:00
Ulises Manuel Cárdenas 8ff7a1630c
[#15019] small option card component (#15077)
* Create small-option-card component

* Add preview screen

* Add mock-fn to test helpers

* Add component tests

* Move namespaces

* Change new section name

* Refactor tests

* Change test-ids by accessibility labels
2023-02-14 16:06:13 -06:00
Brian Sztamfater bd3c724c66
feat: record audio complete flow
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-01-23 14:04:06 -03:00
Jamie Caprani 73c4be8dee
Communities Join Screens - Implement all permutations of Context Drawer options (#14700) 2023-01-13 09:35:41 +00:00
Icaro Motta 7cf17b5d34
Move unit test helper namespace to `src/test_helpers/` (#14716) 2023-01-05 11:58:37 -03:00
Icaro Motta 915b8ebd9a
New component Selector > Filter (#14650) 2022-12-28 12:21:15 -03:00