2021-01-06 23:09:58 +00:00
|
|
|
// This is a basic Flutter integration test.
|
|
|
|
//
|
|
|
|
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
|
|
// utility that Flutter provides. For example, you can send tap and scroll
|
|
|
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
|
|
// tree, read text, and verify that the values of widget properties are correct.
|
|
|
|
|
2021-04-21 00:24:28 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
2021-01-06 23:09:58 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:integration_test/integration_test.dart';
|
|
|
|
|
2021-05-19 21:39:52 +00:00
|
|
|
import 'package:cwtch/main_test.dart' as app;
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-03-27 01:02:01 +00:00
|
|
|
void main() {
|
|
|
|
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
_testMain();
|
|
|
|
}
|
2021-01-06 23:09:58 +00:00
|
|
|
|
|
|
|
void _testMain() {
|
2021-04-21 00:24:28 +00:00
|
|
|
testWidgets('Blocked message rejection test', (WidgetTester tester) async {
|
|
|
|
final String testerProfile = "mr roboto";
|
|
|
|
final String blockedProfile = "rudey";
|
|
|
|
|
|
|
|
// start the app and render a few frames
|
2021-01-06 23:09:58 +00:00
|
|
|
app.main();
|
2021-04-21 00:24:28 +00:00
|
|
|
await tester.pump(); await tester.pump(); await tester.pump();
|
|
|
|
//await tester.pumpAndSettle();
|
|
|
|
|
|
|
|
for (var i = 0; i < 30; i++) {
|
|
|
|
print("$i pump");
|
|
|
|
await tester.pump();
|
|
|
|
}
|
|
|
|
|
|
|
|
// log in to a profile with a blocked contact
|
|
|
|
await tester.tap(find.text(testerProfile));
|
|
|
|
await tester.pump(); await tester.pump(); await tester.pump();
|
|
|
|
expect(find.byIcon(Icons.block), findsOneWidget);
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-04-21 00:24:28 +00:00
|
|
|
// use the debug control to inject a message from the contact
|
|
|
|
await tester.tap(find.byIcon(Icons.bug_report));
|
|
|
|
await tester.pump(); await tester.pump(); await tester.pump();
|
2021-01-06 23:09:58 +00:00
|
|
|
|
|
|
|
|
2021-04-21 00:24:28 +00:00
|
|
|
// screenshot test
|
|
|
|
print(Directory.current);
|
|
|
|
//Directory.current = "/home/erinn/AndroidStudioProjects/flwtch/integration_test";
|
|
|
|
await expectLater(find.byKey(Key('app')), matchesGoldenFile('blockedcontact.png'));
|
|
|
|
// any active message badges?
|
|
|
|
expect(find.text('1'), findsNothing);
|
2021-01-06 23:09:58 +00:00
|
|
|
});
|
|
|
|
}
|