add test tags

This commit is contained in:
Adam Velebil 2023-11-28 16:51:44 +01:00
parent d9b5eb7413
commit 8a56a2b71a
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
5 changed files with 54 additions and 11 deletions

17
dart_test.yaml Normal file
View File

@ -0,0 +1,17 @@
# define available tags
tags:
# Tests which we want to run on desktop
desktop:
# Tests which we want to run on Android
android:
# Tests consuming quiet a lot of time
slow:
# Minimal tests
# quick verification that the framework is working
minimal:
# OATH tests
oath:

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
@Tags(['desktop', 'android'])
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
@ -28,6 +30,10 @@ void main() {
var binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
group('Startup', () {
appTestKeyless('App starts', (WidgetTester tester) async {},
tags: 'minimal');
});
group('Settings', () {
appTestKeyless('Click through all Themes', (WidgetTester tester) async {
var settingDrawerButton = find.byKey(settingDrawerIcon).hitTestable();
@ -66,26 +72,42 @@ void main() {
appTestKeyless('TOS link', (WidgetTester tester) async {
await tester.tap(helpDrawerButton);
await tester.longWait();
await tester.tap(find.byKey(tosButton).hitTestable());
await tester.longWait();
if (isAndroid) {
expect(find.byKey(tosButton).hitTestable(), findsOneWidget);
} else {
await tester.tap(find.byKey(tosButton).hitTestable());
await tester.longWait();
}
});
appTestKeyless('Privacy link', (WidgetTester tester) async {
await tester.tap(helpDrawerButton);
await tester.longWait();
await tester.tap(find.byKey(privacyButton).hitTestable());
await tester.longWait();
if (isAndroid) {
expect(find.byKey(privacyButton).hitTestable(), findsOneWidget);
} else {
await tester.tap(find.byKey(privacyButton).hitTestable());
await tester.longWait();
}
});
appTestKeyless('Feedback link', (WidgetTester tester) async {
await tester.tap(helpDrawerButton);
await tester.longWait();
await tester.tap(find.byKey(feedbackButton).hitTestable());
await tester.longWait();
if (isAndroid) {
expect(find.byKey(feedbackButton).hitTestable(), findsOneWidget);
} else {
await tester.tap(find.byKey(feedbackButton).hitTestable());
await tester.longWait();
}
});
appTestKeyless('Help link', (WidgetTester tester) async {
await tester.tap(helpDrawerButton);
await tester.longWait();
await tester.tap(find.byKey(helpButton).hitTestable());
await tester.longWait();
if (isAndroid) {
expect(find.byKey(helpButton).hitTestable(), findsOneWidget);
} else {
await tester.tap(find.byKey(helpButton).hitTestable());
await tester.longWait();
}
});
});
group('Troubleshooting', () {

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
@Tags(['android', 'desktop', 'oath'])
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:yubico_authenticator/app/views/keys.dart';
@ -74,7 +76,7 @@ void main() {
// TODO: verify one more addAccount() is not possible
await tester.resetOATH();
await tester.shortWait();
});
}, tags: ['slow']);
// appTest('Create weird character-accounts and check byte count',
// (WidgetTester tester) async {});
group('TOTP account tests', () {

View File

@ -122,9 +122,10 @@ void appTestKeyless(
WidgetTesterCallback callback, {
bool? skip,
Map startUpParams = const {},
dynamic tags,
}) {
testWidgets(description, skip: skip, (WidgetTester tester) async {
await tester.startUp(startUpParams);
await callback(tester);
});
}, tags: tags);
}

View File

@ -247,9 +247,10 @@ void appTest(
WidgetTesterCallback callback, {
bool? skip,
Map startUpParams = const {},
dynamic tags,
}) {
testWidgets(description, skip: skip, (WidgetTester tester) async {
await tester.startUp(startUpParams);
await callback(tester);
});
}, tags: tags);
}