Merge commit '970b7cb16d2a25a9b3017d509f515186eae3c9d4' into pipelines/run-20261111-0040-cupertino-out-onboarding-b13c
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/pipelines_app.dart';
|
||||
import 'package:pipelines_app/application/server_endpoint.dart';
|
||||
@@ -14,7 +14,6 @@ void main() {
|
||||
Future<void> mount(
|
||||
WidgetTester tester, {
|
||||
bool web = true,
|
||||
bool cupertino = false,
|
||||
Future<String?> Function(Uri)? read,
|
||||
Future<void> Function()? refresh,
|
||||
UpdateInstaller? installer,
|
||||
@@ -31,7 +30,7 @@ void main() {
|
||||
web: true,
|
||||
),
|
||||
client: PipelinesClient(channelFactory: (_) => channel),
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
routeInformationProvider: provider,
|
||||
webPlatform: web,
|
||||
webPageUri: Uri.parse('https://app.test/chats?selected=1'),
|
||||
@@ -180,7 +179,6 @@ void main() {
|
||||
var refreshes = 0;
|
||||
await mount(
|
||||
tester,
|
||||
cupertino: true,
|
||||
read: (uri) async {
|
||||
expect(uri, Uri.parse('https://app.test/release.json'));
|
||||
return '{"schema":1,"platform":"web","buildId":"web-new"}';
|
||||
@@ -189,7 +187,7 @@ void main() {
|
||||
refreshes++;
|
||||
},
|
||||
);
|
||||
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(refreshes, 0);
|
||||
await tester.tap(find.text('Refresh'));
|
||||
await tester.pump();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/updates/app_updates.dart';
|
||||
import 'package:pipelines_app/features/updates/launch_update_dialog.dart';
|
||||
|
||||
void main() {
|
||||
@@ -34,4 +37,63 @@ void main() {
|
||||
expect(find.textContaining('Android'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('update failure uses a Material alert', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Builder(
|
||||
builder: (context) => TextButton(
|
||||
onPressed: () =>
|
||||
showLaunchUpdateFailure(context, 'boom', cupertino: false),
|
||||
child: const Text('Fail'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('Fail'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(find.text('Update failed'), findsOneWidget);
|
||||
expect(find.text('boom'), findsOneWidget);
|
||||
expect(find.text('OK'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('install progress uses a Material alert and progress bar', (
|
||||
tester,
|
||||
) async {
|
||||
final finished = Completer<void>();
|
||||
late BuildContext dialogContext;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
dialogContext = context;
|
||||
return const SizedBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
final install = installLaunchUpdate(
|
||||
dialogContext,
|
||||
AppUpdate(
|
||||
versionCode: 2,
|
||||
versionName: '2.0',
|
||||
apk: Uri.parse('https://example.test/app.apk'),
|
||||
),
|
||||
installer: (update, {onProgress}) async {
|
||||
onProgress?.call(0.5);
|
||||
await finished.future;
|
||||
},
|
||||
cupertino: false,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AlertDialog), findsOneWidget);
|
||||
expect(find.byType(LinearProgressIndicator), findsOneWidget);
|
||||
expect(find.text('App update'), findsOneWidget);
|
||||
expect(find.text('Downloading update… 50%'), findsOneWidget);
|
||||
finished.complete();
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AlertDialog), findsNothing);
|
||||
await install;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user