Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat/access-contro…
Browse files Browse the repository at this point in the history
…l-android
  • Loading branch information
juliansteenbakker committed Feb 6, 2025
2 parents 372cffc + 56d75d5 commit ad37129
Show file tree
Hide file tree
Showing 7 changed files with 362 additions and 35 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: 📊 Code Coverage

on:
push:
branches: [master, develop]
pull_request:
on: [push, pull_request]

env:
PUB_ENVIRONMENT: bot.github
Expand Down
47 changes: 44 additions & 3 deletions .github/workflows/code-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
integration_tests_android:
name: 🤖 Android Tests
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [ 23, 35 ]
target: [ default ]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
Expand All @@ -35,9 +39,36 @@ jobs:
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- uses: reactivecircus/android-emulator-runner@v2
- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
api-level: 29
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run integration test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: flutter test integration_test
working-directory: flutter_secure_storage/example

Expand All @@ -59,5 +90,15 @@ jobs:
os: iOS
os_version: ">=18.1"
model: "iPhone 15"
- run: flutter pub get
working-directory: flutter_secure_storage/example
- name: Pod Install
working-directory: flutter_secure_storage/example
run: |
cd ios
pod install
cd ..
- run: flutter build ios --simulator --target=integration_test/app_test.dart
working-directory: flutter_secure_storage/example
- run: flutter test integration_test
working-directory: flutter_secure_storage/example
working-directory: flutter_secure_storage/example
5 changes: 1 addition & 4 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: 📝 Code Quality

on:
push:
branches: [master, develop]
pull_request:
on: [push, pull_request]

defaults:
run:
Expand Down
16 changes: 9 additions & 7 deletions flutter_secure_storage/example/integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ void main() {
});
}

Duration duration = const Duration(milliseconds: 300);

Future<HomePageObject> _setupHomePage(WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(home: HomePage()));
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);
final pageObject = HomePageObject(tester);
await pageObject.deleteAll();
return pageObject;
Expand Down Expand Up @@ -112,7 +114,7 @@ class HomePageObject {
final textField = find.byKey(const Key('value_field'));
expect(textField, findsOneWidget, reason: 'Value text field not found');
await tester.enterText(textField, newValue);
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);

await _tap(find.byKey(const Key('save')));
}
Expand Down Expand Up @@ -142,11 +144,11 @@ class HomePageObject {
final textField = find.byKey(const Key('key_field'));
expect(textField, findsOneWidget);
await tester.enterText(textField, keyWidget.data!);
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);

// Confirm the action
await tester.tap(find.text('OK'));
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);

// Verify the SnackBar message
final expectedText = 'Contains Key: $expectedResult';
Expand All @@ -168,11 +170,11 @@ class HomePageObject {
final textField = find.byKey(const Key('key_field'));
expect(textField, findsOneWidget);
await tester.enterText(textField, keyWidget.data!);
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);

// Confirm the action
await tester.tap(find.text('OK'));
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);

// Verify the SnackBar message
expect(find.text('value: $expectedValue'), findsOneWidget);
Expand Down Expand Up @@ -213,6 +215,6 @@ class HomePageObject {
reason: 'Widget not found for tapping: $finder',
);
await tester.tap(finder);
await tester.pumpAndSettle();
await tester.pumpAndSettle(duration);
}
}
7 changes: 0 additions & 7 deletions flutter_secure_storage/example/test/widget_test.dart

This file was deleted.

7 changes: 7 additions & 0 deletions flutter_secure_storage/lib/flutter_secure_storage.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
library;

import 'dart:collection';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_secure_storage/test/test_flutter_secure_storage_platform.dart';
Expand Down Expand Up @@ -74,6 +76,11 @@ class FlutterSecureStorage {
FlutterSecureStoragePlatform get _platform =>
FlutterSecureStoragePlatform.instance;

/// Returns all listeners for testing purposes
@visibleForTesting
Map<String, List<ValueChanged<String?>>> get getListeners =>
UnmodifiableMapView(_listeners);

/// Register [listener] for [key] with the value injected for the listener.
/// The [listener] will still be called when you delete the [key] with the
/// injected value as null. This listener will be added to the list of
Expand Down
Loading

0 comments on commit ad37129

Please sign in to comment.