Skip to content

Commit 19c1e8b

Browse files
authored
Merge branch 'develop' into 18874
2 parents caad968 + f394fcc commit 19c1e8b

File tree

59 files changed

+649
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+649
-541
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,6 @@ lefthook.yml
197197

198198
## metro server logs
199199
metro-server-logs.log
200+
201+
## debug build time logs
202+
logs/

scripts/run-android.sh

+14-39
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,9 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
3-
set -m # needed to access jobs
43

54
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
6-
7-
# We run Metro in background while calling adb.
8-
cleanupMetro() {
9-
pkill -f run-metro.sh
10-
rm -f metro-server-logs.log
11-
}
12-
13-
# Using function gives a neater jobspec name.
14-
runMetro() {
15-
nohup "${GIT_ROOT}/scripts/run-metro.sh" 2>&1 \
16-
| tee metro-server-logs.log
17-
}
18-
19-
waitForMetro() {
20-
set +e # Allow grep command to fail in the loop.
21-
TIMEOUT=5
22-
echo "Waiting for Metro server..." >&2
23-
while ! grep -q "Welcome to Metro" metro-server-logs.log; do
24-
echo -n "." >&2
25-
sleep 1
26-
if ((TIMEOUT == 0)); then
27-
echo -e "\nMetro server timed out, exiting" >&2
28-
set -e # Restore errexit for rest of script.
29-
return 1
30-
fi
31-
((TIMEOUT--))
32-
done
33-
set -e # Restore errexit for rest of script.
34-
}
5+
ADB_INSTALL_LOG_FILE="${GIT_ROOT}/logs/adb_install.log"
6+
ADB_SHELL_MONKEY_LOG_FILE="${GIT_ROOT}/logs/adb_shell_monkey.log"
357

368
# Generate android debug build.
379
export ANDROID_ABI_INCLUDE=$("${GIT_ROOT}/scripts/adb_devices_abis.sh")
@@ -40,14 +12,17 @@ export BUILD_TYPE=debug
4012
"${GIT_ROOT}/scripts/build-android.sh"
4113

4214
# Install the APK on running emulator or android device.
43-
adb install ./result/app-debug.apk
44-
45-
trap cleanupMetro EXIT ERR INT QUIT
46-
runMetro &
47-
waitForMetro
15+
installAndLaunchApp() {
16+
adb install ./result/app-debug.apk > "${ADB_INSTALL_LOG_FILE}" 2>&1
17+
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
18+
adb shell monkey -p im.status.ethereum.debug 1 > "${ADB_SHELL_MONKEY_LOG_FILE}" 2>&1
19+
}
4820

49-
# Start the installed app.
50-
adb shell monkey -p im.status.ethereum.debug 1
21+
showAdbLogs() {
22+
cat "${ADB_INSTALL_LOG_FILE}" >&2;
23+
cat "${ADB_SHELL_MONKEY_LOG_FILE}" >&2;
24+
}
5125

52-
# bring metro job to foreground
53-
fg 'runMetro'
26+
trap showAdbLogs EXIT ERR INT QUIT
27+
installAndLaunchApp &
28+
exec "${GIT_ROOT}/scripts/run-metro.sh" 2>&1

scripts/run-ios.sh

+13-36
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,20 @@ set -euo pipefail
33
set -m # needed to access jobs
44

55
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
6+
XCRUN_INSTALL_LOG_FILE="${GIT_ROOT}/logs/xcrun_install.log"
7+
XCRUN_LAUNCH_LOG_FILE="${GIT_ROOT}/logs/xcrun_launch.log"
68

7-
# We run Metro in background while calling adb.
8-
cleanupMetro() {
9-
pkill -f run-metro.sh
10-
rm -f metro-server-logs.log
11-
}
9+
# Install on the simulator
10+
installAndLaunchApp() {
11+
xcrun simctl install "$UUID" "$APP_PATH" > "${XCRUN_INSTALL_LOG_FILE}" 2>&1
12+
"${GIT_ROOT}/scripts/wait-for-metro-port.sh" 2>&1
13+
xcrun simctl launch "$UUID" im.status.ethereum.debug > "${XCRUN_LAUNCH_LOG_FILE}" 2>&1
1214

13-
# Using function gives a neater jobspec name.
14-
runMetro() {
15-
nohup "${GIT_ROOT}/scripts/run-metro.sh" 2>&1 \
16-
| tee metro-server-logs.log
1715
}
1816

19-
waitForMetro() {
20-
set +e # Allow grep command to fail in the loop.
21-
TIMEOUT=5
22-
echo "Waiting for Metro server..." >&2
23-
while ! grep -q "Welcome to Metro" metro-server-logs.log; do
24-
echo -n "." >&2
25-
sleep 1
26-
if ((TIMEOUT == 0)); then
27-
echo -e "\nMetro server timed out, exiting" >&2
28-
set -e # Restore errexit for rest of script.
29-
return 1
30-
fi
31-
((TIMEOUT--))
32-
done
33-
set -e # Restore errexit for rest of script.
17+
showXcrunLogs() {
18+
cat "${XCRUN_INSTALL_LOG_FILE}" >&2;
19+
cat "${XCRUN_LAUNCH_LOG_FILE}" >&2;
3420
}
3521

3622
# Check if the first argument is provided
@@ -65,15 +51,6 @@ xcodebuild -workspace "ios/StatusIm.xcworkspace" -configuration Debug -scheme St
6551

6652
APP_PATH="${BUILD_DIR}/Build/Products/Debug-iphonesimulator/StatusIm.app"
6753

68-
# Install on the simulator
69-
xcrun simctl install "$UUID" "$APP_PATH"
70-
71-
trap cleanupMetro EXIT ERR INT QUIT
72-
runMetro &
73-
waitForMetro
74-
75-
# launch the app when metro is ready
76-
xcrun simctl launch "$UUID" im.status.ethereum.debug
77-
78-
# bring metro job to foreground
79-
fg 'runMetro'
54+
trap showXcrunLogs EXIT ERR INT QUIT
55+
installAndLaunchApp &
56+
exec "${GIT_ROOT}/scripts/run-metro.sh" 2>&1

scripts/wait-for-metro-port.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
TIMEOUT=10 # Metro should not take this long to start.
5+
6+
while [ "${TIMEOUT}" -gt 0 ]; do
7+
if ! lsof -i:8081 &> /dev/null; then
8+
echo "."
9+
sleep 1
10+
((TIMEOUT--))
11+
else
12+
break
13+
fi
14+
done

src/quo/components/markdown/list/component_spec.cljs

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55

66
(h/describe "tests for markdown/list component"
77
(h/test "renders component with title"
8-
(h/render [list/view {:title "test title"}])
8+
(h/render-with-theme-provider [list/view {:title "test title"}])
99
(h/is-truthy (h/get-by-text "test title")))
1010

1111
(h/test "renders component with description"
12-
(h/render [list/view
13-
{:title "test title"
14-
:description "test description"}])
12+
(h/render-with-theme-provider [list/view
13+
{:title "test title"
14+
:description "test description"}])
1515
(h/is-truthy (h/get-by-text "test description")))
1616

1717
(h/test "renders component with title and description"
18-
(h/render [list/view
19-
{:title "test title"
20-
:description "test description"}])
18+
(h/render-with-theme-provider [list/view
19+
{:title "test title"
20+
:description "test description"}])
2121
(h/is-truthy (h/get-by-text "test title"))
2222
(h/is-truthy (h/get-by-text "test description")))
2323

@@ -29,11 +29,11 @@
2929
(h/is-truthy (h/get-by-label-text :step-counter)))
3030

3131
(h/test "renders decription with a context tag component and description after the tag"
32-
(h/render [list/view
33-
{:step-number 1
34-
:description "Lorem ipsum "
35-
:tag-name "dolor"
36-
:description-after-tag "text after tag"}])
32+
(h/render-with-theme-provider [list/view
33+
{:step-number 1
34+
:description "Lorem ipsum "
35+
:tag-name "dolor"
36+
:description-after-tag "text after tag"}])
3737
(h/is-truthy (h/get-by-text "Lorem ipsum"))
3838
(h/is-truthy (h/get-by-label-text :user-avatar))
3939
(h/is-truthy (h/get-by-text "dolor"))

src/quo/components/settings/settings_item/component_spec.cljs

+19-19
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@
1212

1313
(h/describe "Settings list tests"
1414
(h/test "Default render of Setting list component"
15-
(h/render [settings-item/view props])
15+
(h/render-with-theme-provider [settings-item/view props])
1616
(h/is-truthy (h/get-by-label-text :settings-item)))
1717

1818
(h/test "It renders a title"
19-
(h/render [settings-item/view props])
19+
(h/render-with-theme-provider [settings-item/view props])
2020
(h/is-truthy (h/get-by-text "Account")))
2121

2222
(h/test "its gets passed an on press event"
2323
(let [event (h/mock-fn)]
24-
(h/render [settings-item/view
25-
(merge props {:on-press event})])
24+
(h/render-with-theme-provider [settings-item/view
25+
(merge props {:on-press event})])
2626
(h/fire-event :press (h/get-by-text "Account"))
2727
(h/was-called event)))
2828

2929
(h/test "on change event gets fired for toggle"
3030
(let [on-change (h/mock-fn)]
31-
(h/render [settings-item/view
32-
(merge props
33-
{:action :selector
34-
:action-props {:on-change on-change}})])
31+
(h/render-with-theme-provider [settings-item/view
32+
(merge props
33+
{:action :selector
34+
:action-props {:on-change on-change}})])
3535
(h/fire-event :press (h/get-by-label-text :toggle-off))
3636
(h/was-called on-change)))
3737

3838
(h/test "It renders a label"
39-
(h/render [settings-item/view (merge props {:label :color})])
39+
(h/render-with-theme-provider [settings-item/view (merge props {:label :color})])
4040
(h/is-truthy (h/get-by-label-text :label-component)))
4141

4242
(h/test "It renders a status tag component"
43-
(h/render [settings-item/view
44-
(merge props
45-
{:tag :context
46-
:tag-props {:context "Test Tag"
47-
:icon :i/placeholder}})])
43+
(h/render-with-theme-provider [settings-item/view
44+
(merge props
45+
{:tag :context
46+
:tag-props {:context "Test Tag"
47+
:icon :i/placeholder}})])
4848
(h/is-truthy (h/get-by-text "Test Tag")))
4949

5050
(h/test "on press event gets fired for button"
5151
(let [event (h/mock-fn)]
52-
(h/render [settings-item/view
53-
(merge props
54-
{:action :button
55-
:action-props {:button-text "test button"
56-
:on-press event}})])
52+
(h/render-with-theme-provider [settings-item/view
53+
(merge props
54+
{:action :button
55+
:action-props {:button-text "test button"
56+
:on-press event}})])
5757
(h/fire-event :press (h/get-by-text "test button"))
5858
(h/was-called event))))

src/quo/components/switchers/group_messaging_card/component_spec.cljs

+20-20
Original file line numberDiff line numberDiff line change
@@ -83,35 +83,35 @@
8383
(h/is-truthy (h/get-by-label-text :gif)))
8484

8585
(h/test "Status: Read, Type: Audio, Avatar: true"
86-
(h/render [group-messaging-card/view
87-
{:avatar true
88-
:status :read
89-
:type :audio
90-
:title "Title"
91-
:content {:duration "00:32"}}])
86+
(h/render-with-theme-provider [group-messaging-card/view
87+
{:avatar true
88+
:status :read
89+
:type :audio
90+
:title "Title"
91+
:content {:duration "00:32"}}])
9292
(h/is-truthy (h/get-by-text (utils/subtitle :audio nil)))
9393
(h/is-truthy (h/get-by-text "00:32")))
9494

9595
(h/test "Status: Read, Type: Community, Avatar: true"
96-
(h/render [group-messaging-card/view
97-
{:avatar true
98-
:status :read
99-
:type :community
100-
:title "Title"
101-
:content {:community-avatar coinbase-community
102-
:community-name "Coinbase"}}])
96+
(h/render-with-theme-provider [group-messaging-card/view
97+
{:avatar true
98+
:status :read
99+
:type :community
100+
:title "Title"
101+
:content {:community-avatar coinbase-community
102+
:community-name "Coinbase"}}])
103103
(h/is-truthy (h/get-by-text (utils/subtitle :community nil)))
104104
(h/is-truthy (h/get-by-label-text :group-avatar))
105105
(h/is-truthy (h/get-by-text "Coinbase")))
106106

107107
(h/test "Status: Read, Type: Link, Avatar: true"
108-
(h/render [group-messaging-card/view
109-
{:avatar true
110-
:status :read
111-
:type :link
112-
:title "Title"
113-
:content {:icon :placeholder
114-
:text "Rolling St..."}}])
108+
(h/render-with-theme-provider [group-messaging-card/view
109+
{:avatar true
110+
:status :read
111+
:type :link
112+
:title "Title"
113+
:content {:icon :placeholder
114+
:text "Rolling St..."}}])
115115
(h/is-truthy (h/get-by-text (utils/subtitle :link nil)))
116116
(h/is-truthy (h/get-by-label-text :group-avatar))
117117
(h/is-truthy (h/get-by-text "Rolling St..."))))

0 commit comments

Comments
 (0)