Skip to content

Commit ac4c25d

Browse files
authored
UI and Code Refactor (#238)
1 parent 8f4136f commit ac4c25d

File tree

136 files changed

+5932
-5695
lines changed

Some content is hidden

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

136 files changed

+5932
-5695
lines changed

.github/workflows/analyze.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Flutter Analyze
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.dart'
7+
- 'pubspec.yaml'
8+
- '.github/workflows/analyze.yaml'
9+
pull_request:
10+
paths:
11+
- '**.dart'
12+
- 'pubspec.yaml'
13+
- '.github/workflows/analyze.yaml'
14+
15+
jobs:
16+
analyze:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Flutter
24+
uses: subosito/flutter-action@v2
25+
with:
26+
channel: stable
27+
28+
- name: Install dependencies
29+
run: flutter pub get
30+
31+
- name: Run flutter analyze (fail only on errors)
32+
run: |
33+
flutter analyze > analyze.log || true
34+
cat analyze.log
35+
if grep -q "error •" analyze.log; then
36+
echo "Errors found"
37+
exit 1
38+
else
39+
echo "No errors (warnings/info ignored)"
40+
fi

.github/workflows/integration_tests.yaml

Lines changed: 80 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ run-name: ${{ github.actor }} is building and testing OpenHIIT
55
on:
66
workflow_dispatch:
77
pull_request:
8-
types:
9-
- opened
10-
- reopened
11-
- synchronize
12-
- ready_for_review
13-
branches:
14-
- 'main'
15-
- 'pre-release'
8+
types: [opened, reopened, synchronize, ready_for_review]
9+
branches: [main, pre-release]
1610
paths:
1711
- 'lib/**'
1812
- 'test_driver/**'
@@ -23,141 +17,118 @@ on:
2317
- 'ios/**'
2418

2519
jobs:
26-
27-
Simple:
20+
prepare-emulator:
2821
runs-on: ubuntu-latest
2922
env:
3023
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 180
3124
steps:
32-
- uses: actions/checkout@v3
33-
34-
- name: Set up JDK 17
35-
uses: actions/setup-java@v3
36-
with:
37-
java-version: '17'
38-
distribution: 'temurin'
39-
40-
- uses: subosito/flutter-action@v2
41-
with:
42-
channel: 'stable'
43-
44-
- name: Check Version
45-
run: flutter --version
46-
47-
- name: Flutter Doctor
48-
run: flutter doctor -v
49-
50-
- name: Enable KVM
51-
run: |
52-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
53-
sudo udevadm control --reload-rules
54-
sudo udevadm trigger --name-match=kvm
55-
5625
- name: Setup Android SDK
5726
uses: android-actions/setup-android@v3
5827

59-
60-
- name: run tests
61-
uses: reactivecircus/android-emulator-runner@v2
62-
with:
63-
api-level: 35
64-
arch: x86_64
65-
profile: pixel_6_pro
66-
script: |
67-
flutter build apk --target integration_test/simple_timer_test.dart --debug
68-
adb -s emulator-5554 install build/app/outputs/flutter-apk/app-debug.apk
69-
adb -s emulator-5554 root
70-
adb -s emulator-5554 shell appops set com.codepup.workout_timer SCHEDULE_EXACT_ALARM allow
71-
flutter drive -d emulator-5554 --driver=test_driver/integration_test.dart --use-application-binary=build/app/outputs/flutter-apk/app-debug.apk
72-
73-
Advanced:
74-
runs-on: ubuntu-latest
75-
steps:
76-
- uses: actions/checkout@v3
77-
78-
- name: Set up JDK 17
79-
uses: actions/setup-java@v3
80-
with:
81-
java-version: '17'
82-
distribution: 'temurin'
83-
84-
- uses: subosito/flutter-action@v2
85-
with:
86-
channel: 'stable'
87-
- name: Check Version
88-
run: flutter --version
89-
90-
- name: Flutter Doctor
91-
run: flutter doctor -v
92-
9328
- name: Enable KVM
9429
run: |
9530
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
9631
sudo udevadm control --reload-rules
9732
sudo udevadm trigger --name-match=kvm
9833
99-
- name: Setup Android SDK
100-
uses: android-actions/setup-android@v3
101-
102-
- name: run tests
34+
- name: Gradle cache
35+
uses: gradle/actions/setup-gradle@v3
36+
37+
- name: Cache AVD
38+
id: avd-cache
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.android/avd
42+
key: avd-35
43+
44+
- name: create AVD and generate snapshot for caching
45+
if: steps.avd-cache.outputs.cache-hit != 'true'
10346
uses: reactivecircus/android-emulator-runner@v2
10447
with:
105-
api-level: 34
48+
api-level: 35
10649
arch: x86_64
107-
profile: pixel_6_pro
108-
disable-animations: true
109-
ram-size: 3072
110-
emulator-options: "-no-window -gpu swiftshader_indirect"
111-
script: |
112-
flutter build apk --target integration_test/advanced_timer_test.dart --debug
113-
adb -s emulator-5554 wait-for-device
114-
adb -s emulator-5554 install build/app/outputs/flutter-apk/app-debug.apk
115-
adb -s emulator-5554 root
116-
adb -s emulator-5554 shell appops set com.codepup.workout_timer SCHEDULE_EXACT_ALARM allow
117-
flutter drive -d emulator-5554 --driver=test_driver/integration_test.dart --use-application-binary=build/app/outputs/flutter-apk/app-debug.apk
118-
119-
Display:
50+
ram: 4096
51+
force-avd-creation: false
52+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
53+
disable-animations: false
54+
script: echo "Generated AVD snapshot for caching."
55+
56+
run-tests:
57+
needs: prepare-emulator
12058
runs-on: ubuntu-latest
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
test_file:
63+
- simple_test.dart
64+
- advanced_test.dart
65+
- restart_rounds_test.dart
66+
- load_test.dart
67+
- interval_adjust_test.dart
68+
- edit_timer_test.dart
69+
- customize_test.dart
70+
- minutes_view_test.dart
12171
env:
12272
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 180
12373
steps:
124-
- uses: actions/checkout@v3
125-
126-
- name: Set up JDK 17
127-
uses: actions/setup-java@v3
128-
with:
129-
java-version: '17'
130-
distribution: 'temurin'
74+
- name: checkout
75+
uses: actions/checkout@v4
13176

13277
- uses: subosito/flutter-action@v2
13378
with:
134-
channel: 'stable'
79+
channel: stable
13580

136-
- name: Check Version
137-
run: flutter --version
81+
- name: Setup Android SDK
82+
uses: android-actions/setup-android@v3
13883

139-
- name: Flutter Doctor
140-
run: flutter doctor -v
84+
- name: Create test script
85+
run: |
86+
cat <<EOF > scripts/test.sh
87+
#!/bin/bash
88+
echo "Running test: ${{ matrix.test_file }}"
89+
flutter build apk --target integration_test/${{ matrix.test_file }} --debug
90+
bash scripts/wait_for_pm.sh
91+
adb -s emulator-5554 install build/app/outputs/flutter-apk/app-debug.apk
92+
adb -s emulator-5554 root
93+
adb -s emulator-5554 shell appops set com.codepup.workout_timer SCHEDULE_EXACT_ALARM allow
94+
flutter drive -d emulator-5554 --no-pub \
95+
--driver=integration_test/driver.dart \
96+
--use-application-binary=build/app/outputs/flutter-apk/app-debug.apk
97+
EOF
98+
99+
chmod +x scripts/test.sh
141100
142101
- name: Enable KVM
143102
run: |
144103
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
145104
sudo udevadm control --reload-rules
146105
sudo udevadm trigger --name-match=kvm
147106
148-
- name: Setup Android SDK
149-
uses: android-actions/setup-android@v3
107+
- name: Gradle cache
108+
uses: gradle/actions/setup-gradle@v3
109+
110+
- name: Fetch Cache AVD
111+
id: avd-cache
112+
uses: actions/cache@v4
113+
with:
114+
path: ~/.android/avd
115+
key: avd-35
150116

151-
152-
- name: run tests
117+
- name: Run integration tests
153118
uses: reactivecircus/android-emulator-runner@v2
154119
with:
155120
api-level: 35
156121
arch: x86_64
157-
profile: pixel_6_pro
158-
script: |
159-
flutter build apk --target integration_test/display_timer_test.dart --debug
160-
adb -s emulator-5554 install build/app/outputs/flutter-apk/app-debug.apk
161-
adb -s emulator-5554 root
162-
adb -s emulator-5554 shell appops set com.codepup.workout_timer SCHEDULE_EXACT_ALARM allow
163-
flutter drive -d emulator-5554 --driver=test_driver/integration_test.dart --use-application-binary=build/app/outputs/flutter-apk/app-debug.apk
122+
ram: 4096
123+
force-avd-creation: false
124+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
125+
disable-animations: true
126+
script: scripts/test.sh
127+
128+
- name: Upload screenshots
129+
if: always()
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: screenshots-${{ matrix.test_file }}
133+
path: screenshots/
134+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ app.*.map.json
4444
/android/app/profile
4545
/android/app/release
4646

47+
/screenshots/
48+
4749
**/.cxx

android/app/src/main/res/values-night/styles.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
1414
This Theme is only used starting with V2 of Flutter's Android embedding. -->
1515
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16-
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
1716
<item name="android:windowBackground">?android:colorBackground</item>
1817
</style>
1918
</resources>

android/app/src/main/res/values/styles.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
1414
This Theme is only used starting with V2 of Flutter's Android embedding. -->
1515
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
16-
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
1716
<item name="android:windowBackground">?android:colorBackground</item>
1817
</style>
1918
</resources>

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "8.5.2" apply false
21+
id "com.android.application" version "8.6.0" apply false
2222
id "org.jetbrains.kotlin.android" version "2.1.21" apply false
2323
}
2424

docs/tests/test-coverage.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ This document outlines current test coverage for core timer functionality, with
3838

3939
| File Name | Description |
4040
|------------------------------|----------------------------------------------------|
41-
| `test/simple_timer_test.dart` | Covers basic timer creation, i.e. minimum viable functionality |
42-
| `test/advanced_timer_test.dart` | Focuses on all possible settings and editing existing timers |
43-
| `test/display_timer_test.dart` | Focuses on the less funcitonal stuff, like UI and display related settings |
41+
| `integration_test/simple_test.dart` | Covers basic timer creation, i.e. minimum viable functionality. |
42+
| `integration_test/advanced_test.dart` | Runs a timer with all time settings changed. |
43+
| `integration_test/load_test.dart` | Tests initial app load with no timers saved. |
44+
| `integration_test/edit_timer_test.dart` | Ensures a basic timer can be edited and those edits are saved. |
45+
| `integration_test/interval_adjust_test.dart` | Tests that the active intervals fields can be set and edited. |
46+
| `integration_test/restart_rounds_test.dart` | Tests the restart and break time functionality. |
47+
| `integration_test/customize_test.dart` | Tests timer name and color input fields. Actual color change needs verified in QA. |
48+
| `integration_test/minutes_view_test.dart` | Tests timer can be set to minutes view. |

0 commit comments

Comments
 (0)