Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7917017
widget tests
ZanderCowboy Oct 5, 2024
d996485
update Android folder of Multichoice
ZanderCowboy Oct 6, 2024
288613c
add isar-3.1.0-1 to packages_external
ZanderCowboy Oct 6, 2024
c0a9c4b
update pubspecs
ZanderCowboy Oct 6, 2024
c77a1e1
please review this commit
ZanderCowboy Dec 19, 2024
7738fa4
Merge branch 'develop' into setup-tests
ZanderCowboy Feb 20, 2025
c4ef1ef
remove all packages_external
ZanderCowboy Mar 6, 2025
671085d
complete a flutter upgrade and use community isar
ZanderCowboy Mar 6, 2025
cf975d2
Merge branch 'develop' into setup-tests-remove-external-packages
ZanderCowboy Mar 6, 2025
4be6c1b
clean up and linting issues
ZanderCowboy Mar 8, 2025
5596b5f
create and update docs; should still be finished
ZanderCowboy Mar 8, 2025
972c35d
revert changes to move to a new branch
ZanderCowboy Mar 8, 2025
b6d3cdd
Bump pubspec version to '0.3.0+152'
ZanderCowboy Mar 8, 2025
5c7931b
Merge branch 'develop' into setup-tests-remove-external-packages
ZanderCowboy Mar 12, 2025
574907a
Bump pubspec version to '0.3.0+153'
ZanderCowboy Mar 12, 2025
140abc1
Merge branch 'develop' into setup-tests-remove-external-packages
ZanderCowboy May 31, 2025
40908bb
Bump pubspec version to '0.3.0+159'
ZanderCowboy May 31, 2025
300400a
chore: import change
ZanderCowboy May 31, 2025
3a943f8
Bump pubspec version to '0.3.0+160'
ZanderCowboy May 31, 2025
96ee9bf
chore: update docs
ZanderCowboy May 31, 2025
6e7257b
chore: add tasks.json
ZanderCowboy May 31, 2025
a1afc4a
chore: PR comments
ZanderCowboy May 31, 2025
be37a4b
Bump pubspec version to '0.3.0+161'
ZanderCowboy May 31, 2025
d87fef1
fix sonarcloud workflow issue
ZanderCowboy May 31, 2025
783ca0a
chore: update melos and sonarcloud to use correct scripts
ZanderCowboy May 31, 2025
8ace6e6
sonarcloud issue
ZanderCowboy May 31, 2025
c0d7bca
Bump pubspec version to '0.3.0+162'
ZanderCowboy May 31, 2025
b12c096
sonarcloud issue
ZanderCowboy May 31, 2025
674c79d
Bump pubspec version to '0.3.0+163'
ZanderCowboy May 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_build-android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ jobs:
serviceCredentialsFileContent: ${{secrets.CREDENTIAL_FILE_CONTENT}}
groups: testers
file: ./apps/multichoice/build/app/outputs/flutter-apk/app-${{ inputs.environment_flag }}.apk
releaseNotesFile: ./apps/multichoice/CHANGELOG.txt
releaseNotesFile: ./CHANGELOG.md
debug: true
24 changes: 10 additions & 14 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,18 @@ jobs:
uses: ./.github/actions/setup-java-flutter

- name: Run tests and generate coverage
run: melos coverage:core

- name: Aggregate coverage report
run: melos coverage:all
- name: Debug coverage files
run: |
flutter pub global activate coverage
flutter pub global run coverage:format_coverage \
--lcov \
--in=packages/core/coverage \
--out=coverage/lcov.info \
--report-on=apps/multichoice/lib,packages/core/lib
ls -la apps/multichoice/coverage/
ls -la packages/core/coverage/

# if requied, change 'Aggregate coverage report' with 'Move coverage report'
# - name: Move coverage report
# run: |
# mkdir -p coverage
# cp packages/core/coverage/lcov.info coverage/lcov.info
- name: Merge coverage reports
run: |
mkdir -p coverage
cat apps/multichoice/coverage/lcov.info packages/core/coverage/lcov.info > coverage/lcov.info
cat coverage/lcov.info

- name: Analyze with SonarCloud
uses: SonarSource/sonarcloud-github-action@master
Expand Down
35 changes: 35 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Flutter Integration Test",
"type": "shell",
"command": "flutter",
"args": [
"drive",
"--target=apps/multichoice/test_driver/integration_test.dart"
],
"group": "test",
"problemMatcher": []
},
{
"label": "Uninstall App",
"type": "shell",
"command": "adb",
"args": [
"uninstall",
"co.za.zanderkotze.multichoice"
],
"problemMatcher": []
},
{
"label": "Uninstall and Run Integration Test",
"dependsOn": [
"Uninstall App",
"Flutter Integration Test"
],
"dependsOrder": "sequence",
"group": "test"
}
]
}
12 changes: 12 additions & 0 deletions .vscode/test_launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "multichoice (integration test)",
"request": "launch",
"type": "dart",
"program": "apps/multichoice/test_driver/integration_test.dart",
"preLaunchTask": "Flutter Integration Test"
}
]
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Set up integration tests

- Add integration tests
- Setup integration tests
- Add tasks.json file
- Update _build-android-app file to use this ROOT changelog
5 changes: 5 additions & 0 deletions apps/multichoice/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

Setting up Integration Testing:
- Create documentation (refer to `docs/setting-up-integration-tests.md`)
- start cmd /k "run_integration_test.bat %* && call shutdown_emulator.bat && exit"

---
Version 0.3.0+153:
- Setup and add widget tests
- Update melos scripts
Expand Down
81 changes: 81 additions & 0 deletions apps/multichoice/integration_test/app_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:multichoice/app/export.dart';
import 'package:multichoice/main.dart' as app;
import 'package:multichoice/presentation/shared/widgets/add_widgets/_base.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
final keys = WidgetKeys.instance;

testWidgets('Test counter increment', (WidgetTester tester) async {
app.main();
// Wait for the app to settle
await tester.pumpAndSettle(const Duration(seconds: 2));

// Verify a Permission Required dialog appears
expect(find.text('Permission Required'), findsOneWidget);
expect(find.text('Deny'), findsOneWidget);
expect(find.text('Open Settings'), findsOneWidget);
await tester.tap(find.text('Deny'));
await tester.pumpAndSettle();

// On Home Screen - Verify Add Tab Card
expect(find.byIcon(Icons.add_outlined), findsOneWidget);
expect(find.byType(AddTabCard), findsOneWidget);

// Open Settings Drawer - Test Layout Switch
expect(find.byIcon(Icons.settings_outlined), findsOneWidget);
await tester.tap(find.byIcon(Icons.settings_outlined));
await tester.pumpAndSettle();
expect(find.text('Horizontal/Vertical Layout'), findsOneWidget);
expect(find.byKey(keys.layoutSwitch), findsOneWidget);
await tester.tap(find.byKey(keys.layoutSwitch));
await tester.pumpAndSettle();
expect(find.byIcon(Icons.close_outlined), findsOneWidget);
await tester.tap(find.byIcon(Icons.close_outlined));
await tester.pumpAndSettle();

// On Home Screen - Add New Tab
expect(find.byIcon(Icons.add_outlined), findsOneWidget);
expect(find.byType(AddTabCard), findsOneWidget);
await tester.tap(find.byType(AddTabCard));
await tester.pumpAndSettle();

// Add New Tab Dialog
expect(find.text('Add New Tab'), findsOneWidget);
expect(find.text('Cancel'), findsOneWidget);
expect(find.text('Add'), findsOneWidget);

// Enter Tab Data
expect(find.byType(TextFormField), findsExactly(2));
await tester.enterText(find.byType(TextFormField).first, 'Tab 1');
await tester.enterText(find.byType(TextFormField).last, 'Tab 2');
await tester.pumpAndSettle();
expect(find.text('Tab 1'), findsOneWidget);
expect(find.text('Tab 2'), findsOneWidget);
await tester.tap(find.text('Add'));
await tester.pumpAndSettle();

expect(find.text('Tab 1'), findsOneWidget);

// Open Settings Drawer - Test Light/Dark Mode
await tester.tap(find.byIcon(Icons.settings_outlined));
await tester.pumpAndSettle();
expect(find.text('Light / Dark Mode'), findsOneWidget);
expect(find.byKey(keys.lightDarkModeSwitch), findsOneWidget);
await tester.tap(find.byKey(keys.lightDarkModeSwitch));
await tester.pumpAndSettle();
expect(find.text('Tab 1'), findsOneWidget);
expect(find.byType(AddTabCard), findsOneWidget);
final BuildContext context = tester.element(find.byType(AddTabCard));
final theme = Theme.of(context);
expect(theme.brightness, Brightness.dark);

// On Home Screen
await tester.tap(find.byIcon(Icons.search_outlined));
await tester.pumpAndSettle();
expect(find.textContaining('not been implemented'), findsOneWidget);
});
}
1 change: 1 addition & 0 deletions apps/multichoice/lib/app/engine/widget_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class WidgetKeys {

final deleteModalTitle = const Key('DeleteModalTitle');
final layoutSwitch = const Key('LayoutSwitch');
final lightDarkModeSwitch = const Key('LightDarkSwitch');
final addTabSizedBox = const Key('AddTabSizedBox');
}

Expand Down
14 changes: 6 additions & 8 deletions apps/multichoice/lib/presentation/drawer/home_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ class HomeDrawer extends StatelessWidget {
physics: const NeverScrollableScrollPhysics(),
children: [
const _LightDarkModeButton(),
ListTile(
SwitchListTile(
key: context.keys.layoutSwitch,
title: const Text('Horizontal/Vertical Layout'),
trailing: Switch(
key: context.keys.layoutSwitch,
value: context.watch<AppLayout>().appLayout,
onChanged: (value) {
context.read<AppLayout>().appLayout = value;
},
),
value: context.watch<AppLayout>().appLayout,
onChanged: (value) {
context.read<AppLayout>().appLayout = value;
},
),
ListTile(
title: const Text('Delete All Data'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class _LightDarkModeButton extends HookWidget {
final isDark = useState<bool>(isDarkMode);

return SwitchListTile(
key: context.keys.lightDarkModeSwitch,
title: const Text('Light / Dark Mode'),
value: isDark.value,
activeThumbImage: AssetImage(Assets.images.sleepMode.path),
Expand Down
4 changes: 3 additions & 1 deletion apps/multichoice/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: multichoice
description: "The application for the Multichoice repo"
publish_to: "none"

version: 0.3.0+158
version: 0.3.0+163

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down Expand Up @@ -36,6 +36,8 @@ dev_dependencies:
flutter_gen_runner: ^5.5.0+1
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
very_good_analysis: ^7.0.0

flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:multichoice/presentation/shared/widgets/add_widgets/_base.dart';

import '../../../../helpers/widget_wrapper.dart';
import '../../../../helpers/export.dart';

void main() {
testWidgets('AddEntryCard renders correctly and responds to tap',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ void main() {
final cardWidget = tester.widget<Card>(find.byType(Card));
expect(cardWidget.color, equals(testColor));

// debugDumpApp();
final sizedBox = tester.widget<SizedBox>(
// find.descendant(
// of: find.byType(Padding),
// matching: find.byType(SizedBox),
// matchRoot: true,
// ),
find.byKey(const Key('AddTabSizedBox')),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ void main() {
testWidgets('deleteModal displays correctly and handles actions',
(WidgetTester tester) async {
var confirmPressed = false;
// Will still possibly be used.
// ignore: unused_local_variable
const cancelPressed = false;

await tester.pumpWidget(
MaterialApp(
Expand Down
3 changes: 3 additions & 0 deletions apps/multichoice/test_driver/integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
Loading