Skip to content

Commit

Permalink
Merge branch 'develop' into 19188
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil authored Mar 27, 2024
2 parents f04cf2e + 7de1f95 commit 50ac154
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 108 deletions.
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -375,25 +375,25 @@ test-contract: export SHADOW_NS_REGEXP := ^tests\.contract-test.*$$
test-contract: ##@test Run contract tests
test-contract: _test-clojure

android-test: jsbundle
android-test: export TARGET := android
android-test:
test-android: jsbundle
test-android: export TARGET := android
test-android: ##@test Android Gradle test
cd android && ./gradlew test

component-test-watch: export TARGET := clojure
component-test-watch: export COMPONENT_TEST := true
component-test-watch: export BABEL_ENV := test
component-test-watch: export JEST_USE_SILENT_REPORTER := false
component-test-watch: ##@ Watch tests and re-run no changes to cljs files
test-component-watch: export TARGET := clojure
test-component-watch: export COMPONENT_TEST := true
test-component-watch: export BABEL_ENV := test
test-component-watch: export JEST_USE_SILENT_REPORTER := false
test-component-watch: ##@ Watch tests and re-run no changes to cljs files
@scripts/check-metro-shadow-process.sh
rm -rf ./component-spec
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js --testEnvironment node ' -e cljs

component-test: export TARGET := clojure
component-test: export COMPONENT_TEST := true
component-test: export BABEL_ENV := test
component-test: export JEST_USE_SILENT_REPORTER := false
component-test: ##@test Run component tests once in NodeJS
test-component: export TARGET := clojure
test-component: export COMPONENT_TEST := true
test-component: export BABEL_ENV := test
test-component: export JEST_USE_SILENT_REPORTER := false
test-component: ##@test Run component tests once in NodeJS
@scripts/check-metro-shadow-process.sh
rm -rf ./component-spec
yarn shadow-cljs compile component-test && \
Expand Down
10 changes: 5 additions & 5 deletions ci/Jenkinsfile.android
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
Expand Down Expand Up @@ -34,10 +34,10 @@ pipeline {
}

environment {
LANG = "en_US.UTF-8"
LC_ALL = "en_US.UTF-8"
LANGUAGE = "en_US.UTF-8"
TARGET = "android${utils.isE2EBuild() ? "-e2e" : ""}"
LANG = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
PLATFORM = "android${utils.isE2EBuild() ? "-e2e" : ""}"
BUILD_ENV = 'prod'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
FASTLANE_DISABLE_COLORS = 1
Expand Down
2 changes: 1 addition & 1 deletion ci/Jenkinsfile.combined
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {
agent { label 'linux' }
Expand Down
2 changes: 1 addition & 1 deletion ci/Jenkinsfile.e2e-nightly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {
agent { label 'linux' }
Expand Down
10 changes: 5 additions & 5 deletions ci/Jenkinsfile.ios
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
Expand Down Expand Up @@ -34,10 +34,10 @@ pipeline {
}

environment {
LANG = "en_US.UTF-8"
LC_ALL = "en_US.UTF-8"
LANGUAGE = "en_US.UTF-8"
TARGET = 'ios'
LANG = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
PLATFORM = 'ios'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
FASTLANE_DISABLE_COLORS = 1
BUNDLE_PATH = "${HOME}/.bundle"
Expand Down
75 changes: 34 additions & 41 deletions ci/Jenkinsfile.tests
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
Expand Down Expand Up @@ -29,61 +29,47 @@ pipeline {
description: 'Specify build type. Values: pr / e2e / nightly / release',
defaultValue: 'pr',
)
booleanParam(
name: 'RUN_CONTRACT_TESTS',
description: 'Whether to run optional and slow contract tests.',
defaultValue: false,
)
}

environment {
LANG = "en_US.UTF-8"
LC_ALL = "en_US.UTF-8"
LANGUAGE = "en_US.UTF-8"
TARGET = 'tests'
LANG = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
PLATFORM = 'tests'
BUILD_ENV = 'prod'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
LOG_FILE = utils.pkgFilename(ext: 'log', arch: 'tests')
CLJ_LINTER_PRINT_WARNINGS = 'true'
}

stages {
stage('Checks') {
stage('Test') {
parallel {
stage('Lint') {
steps {
sh """#!/bin/bash
set -eo pipefail
make lint CLJ_LINTER_PRINT_WARNINGS=true 2>&1 | tee ${LOG_FILE}
"""
}
steps { make('lint') }
}
stage('Unit Tests') {
steps {
sh """#!/bin/bash
set -eo pipefail
make test-unit 2>&1 | tee -a ${LOG_FILE}
"""
}
stage('Unit') {
steps { make('test-unit') }
}
stage('Component') {
steps { make('test-component') }
}
}
}
stage('Contract Tests') {
steps {
sh """#!/bin/bash
set -eo pipefail
make test-contract 2>&1 | tee -a ${LOG_FILE}
"""
}
}
stage('Integration Tests') {
steps {
sh """#!/bin/bash
set -eo pipefail
make test-integration 2>&1 | tee -a ${LOG_FILE}
"""
}
}
stage('Component Tests') {
steps {
sh """#!/bin/bash
set -eo pipefail
make component-test 2>&1 | tee -a ${LOG_FILE}
"""
stage('Heavy Test') {
parallel {
stage('Contract') {
when { expression { params.RUN_CONTRACT_TESTS } }
steps { make('test-contract') }
}
stage('Integration') {
steps { make('test-integration') }
}
}
}
stage('Upload') {
Expand All @@ -100,3 +86,10 @@ pipeline {
always { sh 'make purge' }
}
}

def make(target) {
sh """#!/bin/bash
set -eo pipefail
make ${target} 2>&1 | tee -a ${LOG_FILE}
"""
}
2 changes: 1 addition & 1 deletion ci/tests/Jenkinsfile.e2e-nightly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {

Expand Down
2 changes: 1 addition & 1 deletion ci/tests/Jenkinsfile.e2e-prs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {

Expand Down
2 changes: 1 addition & 1 deletion ci/tests/Jenkinsfile.e2e-upgrade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {

Expand Down
10 changes: 5 additions & 5 deletions ci/tools/Jenkinsfile.fastlane-clean
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {
agent { label 'macos' }

environment {
LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
TARGET = 'ios'
LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
PLATFORM = 'ios'
FASTLANE_DISABLE_COLORS = 1
/* avoid writing to r/o /nix */
GEM_HOME = '~/.rubygems'
Expand Down
2 changes: 1 addition & 1 deletion ci/tools/Jenkinsfile.nix-cache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {
agent { label params.AGENT_LABEL }
Expand Down
10 changes: 5 additions & 5 deletions ci/tools/Jenkinsfile.playstore-meta
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {
agent { label 'linux' }

environment {
LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
TARGET = 'ios'
LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
LC_ALL = 'en_US.UTF-8'
PLATFORM = 'ios'
FASTLANE_DISABLE_COLORS = 1
/* avoid writing to r/o /nix */
GEM_HOME = '~/.rubygems'
Expand Down
2 changes: 1 addition & 1 deletion ci/tools/Jenkinsfile.xcode-clean
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.7'
library 'status-jenkins-lib@v1.8.11'

pipeline {
agent {
Expand Down
10 changes: 5 additions & 5 deletions doc/component-tests-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Both of these links are showing it for React-Testing-Library (not Native) howeve
## Running the tests
To run these tests there are two methods.

`make component-test`
`make test-component`
setups and runs the test suite once.

`make component-test-watch`
`make test-component-watch`
setups and runs the test suite and watches for code changes will then retrigger the test suite.

## Writing Tests
Expand All @@ -38,7 +38,7 @@ There is a file of utility functions defined in "src/test_helpers/component.cljs
## Configuration
Status Mobile has a bespoke tech stack, as such there is more complexities to configuring the tests.

### Shadow-CLJS
### Shadow-CLJS
the configuration for compiling our tests are defined in the "shadow-cljs.edn" file.
The three main parts of this are
`:target :npm-module`
Expand All @@ -47,9 +47,9 @@ Needed for the configuration we are using
a vector of entry points for the test files.
and the `ns-regexp` to specify what tests to find. Since we have multiple forms of tests we decided that "component-spec" is the least likely to detect the wrong file type.

It's worth knowing that our tests are compiled to JS and then run in the temporary folder `component-tests`.
It's worth knowing that our tests are compiled to JS and then run in the temporary folder `component-tests`.

### Jest
There is also further configuration for Jest in "test/jest". There is a jest config file which has some mostly standard configuration pieces, where the tests live, what environment variables are set etc. This is documented by Jest here: https://jestjs.io/docs/configuration

There is also a setup file which is used to set some global and default values. Additionally this file is used to mock some of the react native (among other) dependencies
There is also a setup file which is used to set some global and default values. Additionally this file is used to mock some of the react native (among other) dependencies.
4 changes: 2 additions & 2 deletions doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Here I'm showing a terminal-only experience using Tmux (left pane Emacs, right p
To run tests:

```
make component-test
make test-component
```

Also test watcher can be launched. It will re-run the entire test suite when any file is modified

```
make component-test-watch
make test-component-watch
```

Check [component tests doc](./component-tests-overview.md) for more.
Expand Down
6 changes: 3 additions & 3 deletions src/quo/components/gradient/gradient_cover/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
;; the `:or` destructuring won't work because it's only applied when the
;; `:customization-color` key is non-existent. While deleting an account the key exists
;; and has a `nil` value.
(when customization-color
(let [color-top (colors/resolve-color customization-color 50 20)
color-bottom (colors/resolve-color customization-color 50 0)]
(let [color-top (colors/resolve-color customization-color 50 20)
color-bottom (colors/resolve-color customization-color 50 0)]
(when (and color-top color-bottom)
[linear-gradient/linear-gradient
{:accessibility-label :gradient-cover
:colors [color-top color-bottom]
Expand Down
27 changes: 12 additions & 15 deletions src/quo/components/wallet/account_overview/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@
:or {customization-color :blue}}]
(let [time-frame-string (time-string time-frame time-frame-string)
up? (= metrics :positive)]
[rn/view
{:style style/account-overview-wrapper}
[rn/view {:style style/account-overview-wrapper}
(if (= :loading state)
[loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)]
[rn/view
Expand All @@ -113,19 +112,17 @@
:size :heading-1
:style style/current-value}
current-value]
[rn/view
{:style style/row-centered}
[:<>
(when (seq time-frame-string)
[text/text
{:weight :medium
:size :paragraph-2
:style (style/bottom-time-text (and (not= :custom time-frame)
(seq time-frame-to-string)))}
time-frame-string])
(when (and (= :custom time-frame)
(seq time-frame-to-string))
[custom-time-frame time-frame-to-string])]
[rn/view {:style style/row-centered}
(when (seq time-frame-string)
[text/text
{:weight :medium
:size :paragraph-2
:style (style/bottom-time-text (and (not= :custom time-frame)
(seq time-frame-to-string)))}
time-frame-string])
(when (and (= :custom time-frame)
(seq time-frame-to-string))
[custom-time-frame time-frame-to-string])
(when (and (seq percentage-change)
(seq currency-change))
[numeric-changes percentage-change currency-change customization-color theme up?])]])]))
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/contexts/shell/qr_reader/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
(load-and-show-profile scanned-text)

(eth-address? scanned-text)
(debounce/debounce-and-dispatch [:navigate-to :wallet-accounts scanned-text] 300)
(debounce/debounce-and-dispatch [:navigate-to :screen/wallet.accounts scanned-text] 300)

(eip681-address? scanned-text)
(do
Expand Down
Loading

0 comments on commit 50ac154

Please sign in to comment.