feat(train): Settings over the tabs from a cog on Home and Profile, the account near its foot (ADR 0030, D60)
As Learn's: a cog atop Home and Profile, with the count of accounts waiting for whoever operates the instance, opens Settings over the tabs, where an account sheet had held the account and the training's screens. Grouped in cards: the operator's card, the training (your body, Health Connect, the Polar Loop, music, those the device has), the account near the foot, About Halkyon Train last, and the version small at the very bottom. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
d4d749eb9f
commit
25191055ae
1 changed files with 322 additions and 150 deletions
|
|
@ -151,6 +151,7 @@ void main() {
|
|||
FakeInstanceOperatorGateway(),
|
||||
),
|
||||
fileSaver: MemoryFileSaver(),
|
||||
appVersion: (version: '0.1.0', build: 7),
|
||||
sourceCodeUrl: () async =>
|
||||
'https://code.halkyon.app/project-halkyon/halkyon',
|
||||
openPerson: (person) async {
|
||||
|
|
@ -248,10 +249,9 @@ void main() {
|
|||
matching: find.text(label),
|
||||
);
|
||||
|
||||
/// Opens the account sheet from Profile.
|
||||
Future<void> openAccount(WidgetTester tester) async {
|
||||
await goTab(tester, 'Profile');
|
||||
await tester.tap(find.byTooltip('Account'));
|
||||
/// Opens Settings from Home's cog.
|
||||
Future<void> openSettings(WidgetTester tester) async {
|
||||
await tester.tap(find.byTooltip('Settings'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
|
|
@ -379,6 +379,38 @@ void main() {
|
|||
expect(find.text('New route'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets("Home's and Profile's cog leads to Settings, as Learn's", (
|
||||
tester,
|
||||
) async {
|
||||
await start(tester, usedBefore: true);
|
||||
|
||||
for (final tab in ['Home', 'Profile']) {
|
||||
await goTab(tester, tab);
|
||||
expect(find.byTooltip('Account'), findsNothing);
|
||||
await openSettings(tester);
|
||||
expect(find.text('Settings'), findsOneWidget, reason: tab);
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('Settings groups the training first, then the account, About '
|
||||
'Halkyon Train last and the version small at the very foot', (
|
||||
tester,
|
||||
) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openSettings(tester);
|
||||
|
||||
final order = [
|
||||
'Your body',
|
||||
'Account',
|
||||
'Sign out',
|
||||
'About Halkyon Train',
|
||||
'Version 0.1.0 (build 7)',
|
||||
].map((text) => tester.getTopLeft(find.text(text)).dy).toList();
|
||||
expect(order, [...order]..sort());
|
||||
});
|
||||
|
||||
testWidgets("from medium windows on, a rail with Train's icon on top", (
|
||||
tester,
|
||||
) async {
|
||||
|
|
@ -419,7 +451,7 @@ void main() {
|
|||
testWidgets('the account says on which instance it is signed in; signing '
|
||||
'out deletes nothing and asks how to start', (tester) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
|
||||
expect(find.text('Signed in on train.example.org'), findsOneWidget);
|
||||
expect(find.text('Switch account'), findsOneWidget);
|
||||
|
|
@ -441,14 +473,14 @@ void main() {
|
|||
simpleLogin: FakeSimpleLoginGateway(gateway),
|
||||
);
|
||||
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
expect(find.widgetWithText(ListTile, 'Add SimpleLogin'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('deleting the account asks first; Cancel keeps it, Delete '
|
||||
'deletes it and asks how to start', (tester) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
|
||||
await tester.tap(find.text('Delete account'));
|
||||
await tester.pumpAndSettle();
|
||||
|
|
@ -466,10 +498,10 @@ void main() {
|
|||
expect(find.text('Start on train.example.org:'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a deletion the instance never got says so on the account '
|
||||
'sheet, the person still signed in', (tester) async {
|
||||
testWidgets('a deletion the instance never got says so in Settings, the '
|
||||
'person still signed in', (tester) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
gateway.deletionError = Exception('No connection');
|
||||
|
||||
await tester.tap(find.text('Delete account'));
|
||||
|
|
@ -478,16 +510,12 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(SheetScaffold),
|
||||
matching: find.widgetWithText(
|
||||
SnackBar,
|
||||
"Couldn't delete your account: the instance wasn't reached. "
|
||||
'Try again.',
|
||||
),
|
||||
find.widgetWithText(
|
||||
SnackBar,
|
||||
"Couldn't delete your account: the instance wasn't reached. "
|
||||
'Try again.',
|
||||
),
|
||||
findsOneWidget,
|
||||
reason: 'on the sheet, not behind its barrier',
|
||||
);
|
||||
expect(gateway.status, isA<SignedIn>());
|
||||
});
|
||||
|
|
@ -495,9 +523,9 @@ void main() {
|
|||
testWidgets('About names the source of what the instance runs, which both '
|
||||
'licences ask to offer', (tester) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
|
||||
await tester.tap(find.text('About'));
|
||||
await tester.tap(find.text('About Halkyon Train'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('The source of what this instance runs:'), findsOneWidget);
|
||||
|
|
@ -511,7 +539,7 @@ void main() {
|
|||
tester,
|
||||
) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
|
||||
expect(find.text('Health Connect'), findsNothing);
|
||||
});
|
||||
|
|
@ -537,7 +565,7 @@ void main() {
|
|||
|
||||
Future<void> openBody(WidgetTester tester) async {
|
||||
await start(tester, usedBefore: true, profile: profile);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
await tester.tap(find.text('Your body'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
|
@ -701,7 +729,7 @@ void main() {
|
|||
loop: loop,
|
||||
);
|
||||
await tester.runAsync(() async => loop.start());
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
await tester.tap(find.text('Polar Loop'));
|
||||
await frames(tester);
|
||||
}
|
||||
|
|
@ -715,7 +743,7 @@ void main() {
|
|||
|
||||
testWidgets('a phone that holds no Loop offers none', (tester) async {
|
||||
await start(tester, usedBefore: true);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
|
||||
expect(find.text('Polar Loop'), findsNothing);
|
||||
});
|
||||
|
|
@ -952,7 +980,7 @@ void main() {
|
|||
workouts,
|
||||
)..start(),
|
||||
);
|
||||
await openAccount(tester);
|
||||
await openSettings(tester);
|
||||
await tester.tap(find.text('Health Connect'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
|
@ -1092,8 +1120,8 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
// The account sheet, closed.
|
||||
await tester.tapAt(const Offset(200, 50));
|
||||
// Settings, left.
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
// Home, where the workouts are.
|
||||
await goTab(tester, 'Home');
|
||||
|
|
@ -1114,7 +1142,7 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tapAt(const Offset(200, 50));
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
// Home, where the workouts are.
|
||||
await goTab(tester, 'Home');
|
||||
|
|
@ -1148,7 +1176,7 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tapAt(const Offset(200, 50));
|
||||
await tester.pageBack();
|
||||
await tester.pumpAndSettle();
|
||||
// Home, where the workouts are.
|
||||
await goTab(tester, 'Home');
|
||||
|
|
|
|||
Loading…
Reference in a new issue