-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#687): introduce separate screencasts script
- Loading branch information
Showing
7 changed files
with
106 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:app/app.dart'; | ||
import 'package:app/common/module.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
Future<void> loadApp(WidgetTester tester) async { | ||
// Part before runApp in lib/main.dart | ||
await initServices(); | ||
await updateGenotypeResults(); | ||
// Load the app | ||
await tester.pumpWidget( | ||
ChangeNotifierProvider( | ||
create: (context) => ActiveDrugs(), | ||
child: PharMeApp(), | ||
), | ||
); | ||
await tester.pumpAndSettle(); | ||
} | ||
|
||
Future<void> cleanupApp() async { | ||
// Part after runApp in lib/main.dart | ||
await cleanupServices(); | ||
} | ||
|
||
Future<void> wait(int seconds) async { | ||
await Future.delayed(Duration(seconds: seconds)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
read -p "Enter username: " username | ||
read -p "Enter password: " password | ||
|
||
flutter drive \ | ||
--driver=generate_screendocs/test_driver.dart \ | ||
--target=generate_screendocs/screenshot_sequence.dart \ | ||
--dart-define=TEST_USER="$username" \ | ||
--dart-define=TEST_PASSWORD="$password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Clicks though most parts of the app and outputs timestamp logs for cutting | ||
// smaller screencasts in generate_screencast.sh script | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import 'app_sequence_utils.dart'; | ||
|
||
void logTimeStamp(String description) { | ||
final timestamp = DateTime.now().millisecondsSinceEpoch; | ||
// ignore: avoid_print | ||
print('TIMESTAMP: $timestamp $description'); | ||
} | ||
|
||
void main() { | ||
group('click through the app and create screenshots', () { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
testWidgets('take screencast', (tester) async { | ||
// ignore: unused_local_variable | ||
const username = String.fromEnvironment('TEST_USER'); | ||
// ignore: unused_local_variable | ||
const password = String.fromEnvironment('TEST_PASSWORD'); | ||
|
||
await loadApp(tester); | ||
logTimeStamp('test_start'); | ||
|
||
// login | ||
await wait(5); | ||
logTimeStamp('login'); | ||
|
||
// login-redirect (not working; only taking screenshot of loading screen) | ||
// could try to use cubit function to directly sign in which will only | ||
// open the webview and close it again | ||
// await tester.tap(find.byType(FullWidthButton).first); | ||
// await Future.delayed(Duration(seconds: 3)); // wait for dialog | ||
// await takeScreenshot(tester, binding, 'login-redirect'); | ||
|
||
await cleanupApp(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.