Skip to content

Commit 93ae19d

Browse files
authored
1 parent 599ee3b commit 93ae19d

File tree

7 files changed

+187
-32
lines changed

7 files changed

+187
-32
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
###
2+
### Hack to make it work with MIM attack from security ...
3+
###
4+
sed -i 's/https/http/g' Gemfile
5+
gem sources -r https://rubygems.org/
6+
yes | gem sources --add http://rubygems.org
7+
8+
###
9+
### Downloads gems for test & development
10+
###
11+
bundle config --delete without
12+
bundle install
13+
14+
###
15+
### Cleans stuff if need be
16+
###
17+
rm -f tmp/pids/server.pid
18+
19+
###
20+
### Initialises the DB
21+
###
22+
bundle exec rake db:setup
23+
24+
25+
###
26+
### Runs Simple
27+
###
28+
bundle exec rails s -p 3000 -b '0.0.0.0'
Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,83 @@
11
version: "3"
22

33
services:
4+
### psql -h postgres -p 5432 -U postgres
45
postgres:
56
image: postgres:14.3-alpine
67
environment:
78
- POSTGRES_USER=postgres
89
- POSTGRES_PASSWORD=password
9-
expose:
10-
- "5432"
10+
ports:
11+
- "5432:5432"
12+
13+
webdb:
14+
image: webdb/app
15+
ports:
16+
- "22071:22071"
17+
depends_on:
18+
server:
19+
condition: service_healthy
1120

1221
redis:
1322
image: redis:5-alpine
14-
expose:
15-
- "6379"
23+
ports:
24+
- "6379:6379"
25+
1626

1727
server:
18-
image: simpledotorg/server:latest
19-
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rake db:setup; bundle exec rails s -p 3000 -b '0.0.0.0'"
20-
expose:
21-
- "3000"
28+
image: simpledotorg/server
29+
#command: bash -c "rm -f tmp/pids/server.pid ; bundle install ; bundle exec rake db:setup ; bundle exec rails s -p 3000 -b '0.0.0.0'"
30+
command: bash -c "bash ./run_docker_server.sh"
31+
healthcheck:
32+
test: "curl -f http://localhost:3000/api/v3/ping"
33+
start_period: 10m
2234
ports:
23-
- "8420:3000"
35+
- "3000:3000"
2436
depends_on:
2537
- redis
2638
- postgres
39+
volumes:
40+
- ./scripts/run_docker_server.sh:/home/app/run_docker_server.sh
2741
environment:
2842
SIMPLE_SERVER_DATABASE_HOST: postgres
2943
SIMPLE_SERVER_DATABASE_USERNAME: postgres
3044
SIMPLE_SERVER_DATABASE_PASSWORD: password
45+
SIMPLE_SERVER_DATABASE_NAME: SIMPLE_POC
3146
SIMPLE_SERVER_HOST_PROTOCOL: https
3247
CALL_SESSION_REDIS_HOST: redis
3348
RAILS_CACHE_REDIS_URL: redis://
49+
RAILS_CACHE_REDIS_PASSWORD: NONE
50+
RAILS_ENV: test
3451
SIDEKIQ_REDIS_HOST: redis
52+
SIDEKIQ_CONCURRENCY: 5
53+
SIMPLE_SERVER_HOST: localhost
54+
SENDGRID_USERNAME: NONE
55+
SENDGRID_PASSWORD: NONE
56+
SENTRY_DSN: none.org
57+
SEED_GENERATED_ACTIVE_USER_ROLE: Seed User | Active
58+
SEED_GENERATED_ADMIN_PASSWORD: trying to fix hypertension
59+
SEED_GENERATED_INACTIVE_USER_ROLE: Seed User | Inactive
60+
SIMPLE_APP_SIGNATURE: <redacted>
61+
TWILIO_ACCOUNT_SID: <redacted>
62+
TWILIO_REMINDERS_ACCOUNT_SID: <redacted>
63+
SEED_TYPE: empty
64+
SENTRY_SECURITY_HEADER_ENDPOINT: http://none.org
65+
EXOTEL_TOKEN: <redacted>
66+
TWILIO_AUTH_TOKEN: <redacted>
67+
TWILIO_PHONE_NUMBER: <redacted>
68+
TWILIO_REMINDERS_ACCOUNT_AUTH_TOKEN: <redacted>
69+
TWILIO_REMINDERS_ACCOUNT_PHONE_NUMBER: <redacted>
70+
SIMPLE_SERVER_ENV: qa
71+
TEMPORARY_RETENTION_DURATION_SECONDS: 60
72+
ANALYTICS_DASHBOARD_CACHE_TTL: 3600
73+
CALL_SESSION_REDIS_POOL_SIZE: 12
74+
CALL_SESSION_REDIS_TIMEOUT_SEC: 1
75+
DEFAULT_COUNTRY: US
76+
DEFAULT_NUMBER_OF_RECORDS: 10
77+
EMAIL_SUBJECT_PREFIX: "[Simple DEVELOPMENT]"
78+
HELP_SCREEN_YOUTUBE_PASSPORT_URL: https://youtu.be/aktZ1yTdDOA
79+
HELP_SCREEN_YOUTUBE_TRAINING_URL: https://youtu.be/MC_45DoRw2g
80+
HELP_SCREEN_YOUTUBE_VIDEO_URL: https://youtu.be/nHsQ06tiLzw
81+
SENTRY_CURRENT_ENV: development
82+
USER_OTP_VALID_UNTIL_DELTA_IN_MINUTES: 10
83+
SECRET_KEY_BASE: 6e3a553d989615581dfdfcfcb0670b002e5d9d27c38a284a5020107e8ba516789117630f9c7e0ade1d0d7b0b68aeb50df88d8b15ea55dc423246db2984f6e5ef
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker compose -f ".github/docker/simple-server.compose.yml" up -d
2+
docker compose -f ".github/docker/simple-server.compose.yml" exec server bash -c "RAILS_ENV=test bundle exec rails runner 'Flipper.enable :auto_approve_users; Flipper.enable :fixed_otp; puts \"Features enabled!\"'"

.github/workflows/ci_checks.yml

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,95 @@ jobs:
7272
./gradlew --build-cache --no-daemon test -x :app:test;
7373
./gradlew --build-cache --no-daemon testQaDebugUnitTest;
7474
75-
7675

77-
# TODO: Add Android integration tests once [SC-13775] is resolved
76+
integration_tests:
77+
runs-on: [ ubuntu-latest ]
78+
env:
79+
AVD_API_LEVEL: 34
80+
AVD_ARCH: x86_64
81+
steps:
82+
- name: Enable KVM group perms
83+
run: |
84+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
85+
sudo udevadm control --reload-rules
86+
sudo udevadm trigger --name-match=kvm
87+
88+
89+
- name: Checkout Android source
90+
uses: actions/checkout@v4
91+
92+
- name: Start Simple Docker server
93+
run: .github/scripts/deploy_docker_server.sh
94+
95+
- name: Cache AVD
96+
uses: actions/cache@v4
97+
id: avd-cache
98+
with:
99+
path: |
100+
~/.android/avd/*
101+
~/.android/adb*
102+
key: ${{ runner.os }}-avd-${{ env.AVD_API_LEVEL }}-${{ env.AVD_ARCH }}
103+
104+
- name: create AVD and generate snapshot for caching
105+
if: steps.avd-cache.outputs.cache-hit != 'true'
106+
uses: reactivecircus/android-emulator-runner@v2
107+
with:
108+
api-level: ${{ env.AVD_API_LEVEL }}
109+
arch: ${{ env.AVD_ARCH }}
110+
force-avd-creation: false
111+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
112+
disable-animations: false
113+
disk-size: 8G
114+
script: echo "Generated AVD snapshot for caching."
115+
116+
- name: set up JDK
117+
uses: actions/setup-java@v4
118+
with:
119+
distribution: 'zulu'
120+
java-version: 17
121+
cache: 'gradle'
122+
123+
- name: Create build directory
124+
run: mkdir app/build
125+
126+
- name: Build QA Test Artifacts
127+
id: build-instrumented-tests
128+
run: |
129+
./gradlew --build-cache --no-daemon -PmanifestEndpoint=http://10.0.2.2:3000/api/ assembleQaDebug assembleQaDebugAndroidTest
130+
131+
- name: Android Tests
132+
id: run-instrumented-tests
133+
uses: reactivecircus/android-emulator-runner@v2
134+
with:
135+
api-level: ${{ env.AVD_API_LEVEL }}
136+
arch: ${{ env.AVD_ARCH }}
137+
force-avd-creation: false
138+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
139+
disable-animations: true
140+
disk-size: 8G
141+
script: |
142+
adb root
143+
mkdir -p app/build/outputs/test-artifacts
144+
adb install app/build/outputs/apk/qa/debug/app-qa-debug.apk
145+
adb install app/build/outputs/apk/androidTest/qa/debug/app-qa-debug-androidTest.apk
146+
adb shell am instrument -w -e filter org.simple.clinic.benchmark.SelectBenchmarkTests -e benchmark_app_performance false org.simple.clinic.qa.debug.test/org.simple.clinic.AndroidTestJUnitRunner >app/build/outputs/test-artifacts/logs.txt 2>app/build/outputs/test-artifacts/logs.txt
147+
cat app/build/outputs/test-artifacts/logs.txt
148+
adb pull /storage/emulated/0/Android/data/org.simple.clinic.qa.debug/ app/build/outputs/test-artifacts/ || true
149+
adb uninstall org.simple.clinic.qa.debug
150+
adb uninstall org.simple.clinic.qa.debug.test
151+
! grep -q "FAILURES\!\!\!" app/build/outputs/test-artifacts/logs.txt
152+
153+
- name: Upload failed test artifacts
154+
if: always() && steps.run-instrumented-tests.outcome != 'success'
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: failed-test-artifacts
158+
path: app/build/outputs/test-artifacts
159+
160+
- name: Stop Simple Docker server
161+
run: |
162+
docker compose -f ".github/docker/simple-server.compose.yml" down
163+
78164
79165
verify_room_schemas:
80166
runs-on: [ ubuntu-latest ]

app/src/androidTest/java/org/simple/clinic/settings/SettingsScreenTest.kt

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -233,26 +233,7 @@ class SettingsScreenTest {
233233
}
234234

235235
@Test
236-
fun whenLogoutFeatureIsNotEnabledThenDoNotShowLogoutButton() {
237-
val model = SettingsModel.default(
238-
isChangeLanguageFeatureEnabled = true,
239-
)
240-
composeRule.setContent {
241-
SettingsScreen(
242-
model = model,
243-
navigationIconClick = { /*no-op*/ },
244-
changeLanguageButtonClick = { /*no-op*/ },
245-
updateButtonClick = { /*no-op*/ },
246-
logoutButtonClick = { /*no-op*/ }
247-
)
248-
}
249-
250-
// then
251-
composeRule.onNodeWithTag("SETTINGS_LOGOUT_BUTTON").assertDoesNotExist()
252-
}
253-
254-
@Test
255-
fun whenLogoutFeatureIsEnabledThenShowLogoutButton() {
236+
fun logoutButtonShouldBeVisible() {
256237
val model = SettingsModel.default(
257238
isChangeLanguageFeatureEnabled = true,
258239
)

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@
5454
android:allowBackup="false"
5555
android:icon="@mipmap/ic_launcher"
5656
android:label="@string/app_name"
57+
android:networkSecurityConfig="@xml/network_config"
5758
android:supportsRtl="true"
5859
android:theme="@style/Theme.Simple"
5960
tools:ignore="AllowBackup,DataExtractionRules,GoogleAppIndexingWarning,LockedOrientationActivity"
60-
tools:replace="android:allowBackup">
61+
tools:replace="android:allowBackup"
62+
tools:targetApi="n">
6163

6264
<meta-data
6365
android:name="com.google.mlkit.vision.DEPENDENCIES"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<network-security-config>
3+
<domain-config cleartextTrafficPermitted="true">
4+
<domain includeSubdomains="true">10.0.2.2</domain>
5+
</domain-config>
6+
</network-security-config>
7+

0 commit comments

Comments
 (0)