build: Add maestro based integration tests

This commit is contained in:
Christian Kußowski 2025-10-24 15:43:41 +02:00 committed by krille-chan
commit 23f97df1f1
No known key found for this signature in database
15 changed files with 351 additions and 631 deletions

View file

@ -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),
),
),
),

View file

@ -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,
);