Merge pull request #2283 from krille-chan/krille/maestro-integration-tests
build: Add maestro based integration tests
This commit is contained in:
commit
caa5847b66
15 changed files with 351 additions and 631 deletions
|
|
@ -3,6 +3,7 @@ import 'dart:ui';
|
|||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/semantics.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
|
@ -102,6 +103,9 @@ Future<void> startGui(List<Client> clients, SharedPreferences store) async {
|
|||
await firstClient?.accountDataLoading;
|
||||
|
||||
runApp(FluffyChatApp(clients: clients, pincode: pin, store: store));
|
||||
if (const String.fromEnvironment('WITH_SEMANTICS') == 'true') {
|
||||
SemanticsBinding.instance.ensureSemantics();
|
||||
}
|
||||
}
|
||||
|
||||
/// Watches the lifecycle changes to start the application when it
|
||||
|
|
|
|||
|
|
@ -204,31 +204,39 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||
),
|
||||
const SizedBox(height: 16),
|
||||
if (_supportsSecureStorage)
|
||||
CheckboxListTile.adaptive(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
value: _storeInSecureStorage,
|
||||
activeColor: theme.colorScheme.primary,
|
||||
onChanged: (b) {
|
||||
setState(() {
|
||||
_storeInSecureStorage = b;
|
||||
});
|
||||
},
|
||||
title: Text(_getSecureStorageLocalizedName()),
|
||||
subtitle: Text(
|
||||
L10n.of(context).storeInSecureStorageDescription,
|
||||
Semantics(
|
||||
identifier: 'store_in_secure_storage',
|
||||
child: CheckboxListTile.adaptive(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
),
|
||||
value: _storeInSecureStorage,
|
||||
activeColor: theme.colorScheme.primary,
|
||||
onChanged: (b) {
|
||||
setState(() {
|
||||
_storeInSecureStorage = b;
|
||||
});
|
||||
},
|
||||
title: Text(_getSecureStorageLocalizedName()),
|
||||
subtitle: Text(
|
||||
L10n.of(context).storeInSecureStorageDescription,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
CheckboxListTile.adaptive(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
value: _recoveryKeyCopied,
|
||||
activeColor: theme.colorScheme.primary,
|
||||
onChanged: (b) {
|
||||
FluffyShare.share(key!, context);
|
||||
setState(() => _recoveryKeyCopied = true);
|
||||
},
|
||||
title: Text(L10n.of(context).copyToClipboard),
|
||||
subtitle: Text(L10n.of(context).saveKeyManuallyDescription),
|
||||
Semantics(
|
||||
identifier: 'copy_to_clipboard',
|
||||
child: CheckboxListTile.adaptive(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
value: _recoveryKeyCopied,
|
||||
activeColor: theme.colorScheme.primary,
|
||||
onChanged: (b) {
|
||||
FluffyShare.share(key!, context);
|
||||
setState(() => _recoveryKeyCopied = true);
|
||||
},
|
||||
title: Text(L10n.of(context).copyToClipboard),
|
||||
subtitle: Text(L10n.of(context).saveKeyManuallyDescription),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton.icon(
|
||||
|
|
|
|||
|
|
@ -175,18 +175,23 @@ class ClientChooserButton extends StatelessWidget {
|
|||
clipBehavior: Clip.hardEdge,
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
color: Colors.transparent,
|
||||
child: PopupMenuButton<Object>(
|
||||
popUpAnimationStyle: FluffyThemes.isColumnMode(context)
|
||||
? AnimationStyle.noAnimation
|
||||
: null, // https://github.com/flutter/flutter/issues/167180
|
||||
onSelected: (o) => _clientSelected(o, context),
|
||||
itemBuilder: _bundleMenuItems,
|
||||
child: Center(
|
||||
child: Avatar(
|
||||
mxContent: snapshot.data?.avatarUrl,
|
||||
name:
|
||||
snapshot.data?.displayName ?? matrix.client.userID?.localpart,
|
||||
size: 32,
|
||||
child: Semantics(
|
||||
identifier: 'accounts_and_settings',
|
||||
child: PopupMenuButton<Object>(
|
||||
tooltip: 'Accounts and settings',
|
||||
popUpAnimationStyle: FluffyThemes.isColumnMode(context)
|
||||
? AnimationStyle.noAnimation
|
||||
: null, // https://github.com/flutter/flutter/issues/167180
|
||||
onSelected: (o) => _clientSelected(o, context),
|
||||
itemBuilder: _bundleMenuItems,
|
||||
child: Center(
|
||||
child: Avatar(
|
||||
mxContent: snapshot.data?.avatarUrl,
|
||||
name:
|
||||
snapshot.data?.displayName ??
|
||||
matrix.client.userID?.localpart,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class SettingsController extends State<Settings> {
|
|||
context: context,
|
||||
future: () => matrix.client.logout(),
|
||||
);
|
||||
context.go('/');
|
||||
}
|
||||
|
||||
Future<void> setAvatarAction() async {
|
||||
|
|
|
|||
|
|
@ -96,106 +96,112 @@ class SignInPage extends StatelessWidget {
|
|||
itemBuilder: (context, i) {
|
||||
final server = publicHomeservers[i];
|
||||
final website = server.website;
|
||||
return RadioListTile.adaptive(
|
||||
value: server,
|
||||
enabled:
|
||||
state.loginLoading.connectionState !=
|
||||
ConnectionState.waiting,
|
||||
radioScaleFactor:
|
||||
FluffyThemes.isColumnMode(context) ||
|
||||
{
|
||||
TargetPlatform.iOS,
|
||||
TargetPlatform.macOS,
|
||||
}.contains(theme.platform)
|
||||
? 2
|
||||
: 1,
|
||||
title: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(server.name ?? 'Unknown'),
|
||||
),
|
||||
if (website != null)
|
||||
SizedBox.square(
|
||||
dimension: 32,
|
||||
child: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.open_in_new_outlined,
|
||||
size: 16,
|
||||
return Semantics(
|
||||
identifier: 'homeserver_tile_$i',
|
||||
child: RadioListTile.adaptive(
|
||||
value: server,
|
||||
enabled:
|
||||
state.loginLoading.connectionState !=
|
||||
ConnectionState.waiting,
|
||||
radioScaleFactor:
|
||||
FluffyThemes.isColumnMode(context) ||
|
||||
{
|
||||
TargetPlatform.iOS,
|
||||
TargetPlatform.macOS,
|
||||
}.contains(theme.platform)
|
||||
? 2
|
||||
: 1,
|
||||
title: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(server.name ?? 'Unknown'),
|
||||
),
|
||||
if (website != null)
|
||||
SizedBox.square(
|
||||
dimension: 32,
|
||||
child: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.open_in_new_outlined,
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () =>
|
||||
launchUrlString(website),
|
||||
),
|
||||
onPressed: () =>
|
||||
launchUrlString(website),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Column(
|
||||
spacing: 4.0,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (server.features?.isNotEmpty == true)
|
||||
Wrap(
|
||||
spacing: 4.0,
|
||||
runSpacing: 4.0,
|
||||
children: [
|
||||
...?server.languages?.map(
|
||||
(language) => Material(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.borderRadius,
|
||||
),
|
||||
color: theme
|
||||
.colorScheme
|
||||
.tertiaryContainer,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 6.0,
|
||||
vertical: 3.0,
|
||||
],
|
||||
),
|
||||
subtitle: Column(
|
||||
spacing: 4.0,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (server.features?.isNotEmpty == true)
|
||||
Wrap(
|
||||
spacing: 4.0,
|
||||
runSpacing: 4.0,
|
||||
children: [
|
||||
...?server.languages?.map(
|
||||
(language) => Material(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
AppConfig.borderRadius,
|
||||
),
|
||||
color: theme
|
||||
.colorScheme
|
||||
.tertiaryContainer,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 6.0,
|
||||
vertical: 3.0,
|
||||
),
|
||||
child: Text(
|
||||
language,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: theme
|
||||
.colorScheme
|
||||
.onTertiaryContainer,
|
||||
),
|
||||
child: Text(
|
||||
language,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: theme
|
||||
.colorScheme
|
||||
.onTertiaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
...server.features!.map(
|
||||
(feature) => Material(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.borderRadius,
|
||||
),
|
||||
color: theme
|
||||
.colorScheme
|
||||
.secondaryContainer,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 6.0,
|
||||
vertical: 3.0,
|
||||
...server.features!.map(
|
||||
(feature) => Material(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
AppConfig.borderRadius,
|
||||
),
|
||||
color: theme
|
||||
.colorScheme
|
||||
.secondaryContainer,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 6.0,
|
||||
vertical: 3.0,
|
||||
),
|
||||
child: Text(
|
||||
feature,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: theme
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
),
|
||||
child: Text(
|
||||
feature,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: theme
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
Text(
|
||||
server.description ??
|
||||
'A matrix homeserver',
|
||||
),
|
||||
Text(
|
||||
server.description ?? 'A matrix homeserver',
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
@ -219,26 +225,29 @@ class SignInPage extends StatelessWidget {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SafeArea(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: theme.colorScheme.primary,
|
||||
foregroundColor: theme.colorScheme.onPrimary,
|
||||
child: Semantics(
|
||||
identifier: 'connect_to_homeserver_button',
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: theme.colorScheme.primary,
|
||||
foregroundColor: theme.colorScheme.onPrimary,
|
||||
),
|
||||
onPressed:
|
||||
state.loginLoading.connectionState ==
|
||||
ConnectionState.waiting
|
||||
? null
|
||||
: () => connectToHomeserverFlow(
|
||||
selectedHomserver,
|
||||
context,
|
||||
viewModel.setLoginLoading,
|
||||
signUp,
|
||||
),
|
||||
child:
|
||||
state.loginLoading.connectionState ==
|
||||
ConnectionState.waiting
|
||||
? const CircularProgressIndicator.adaptive()
|
||||
: Text(L10n.of(context).continueText),
|
||||
),
|
||||
onPressed:
|
||||
state.loginLoading.connectionState ==
|
||||
ConnectionState.waiting
|
||||
? null
|
||||
: () => connectToHomeserverFlow(
|
||||
selectedHomserver,
|
||||
context,
|
||||
viewModel.setLoginLoading,
|
||||
signUp,
|
||||
),
|
||||
child:
|
||||
state.loginLoading.connectionState ==
|
||||
ConnectionState.waiting
|
||||
? const CircularProgressIndicator.adaptive()
|
||||
: Text(L10n.of(context).continueText),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -39,14 +39,13 @@ class SignInViewModel extends ValueNotifier<SignInState> {
|
|||
)
|
||||
.toList() ??
|
||||
[];
|
||||
final splitted = filterText.split('.');
|
||||
if (splitted.length >= 2 && !splitted.any((part) => part.isEmpty)) {
|
||||
if (!filteredPublicHomeservers.any(
|
||||
(homeserver) => homeserver.name == filterText,
|
||||
)) {
|
||||
filteredPublicHomeservers.add(PublicHomeserverData(name: filterText));
|
||||
}
|
||||
if (Uri.tryParse(filterText) != null &&
|
||||
!filteredPublicHomeservers.any(
|
||||
(homeserver) => homeserver.name == filterText,
|
||||
)) {
|
||||
filteredPublicHomeservers.add(PublicHomeserverData(name: filterText));
|
||||
}
|
||||
|
||||
value = value.copyWith(
|
||||
filteredPublicHomeservers: filteredPublicHomeservers,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue