mirror of
https://github.com/block/buzz.git
synced 2026-11-02 07:22:55 +00:00
Replaces the mobile welcome gradient with buzz.xyz’s green and 12 animated bees. The swarm keeps flying through rotation, respects Reduce Motion, and leaves controls tappable; the primary button label is now white. The ghost button has an opaque chartreuse fill so bees cannot show through its text. Validated in the iPhone simulator, with animation/rotation journeys, analysis, and the full mobile suite passing. Agent review found no blockers. https://github.com/user-attachments/assets/9aa1472c-c8e5-4e8b-a016-a8cba36805e1 --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
122 lines
4.6 KiB
Dart
122 lines
4.6 KiB
Dart
import 'package:buzz/features/pairing/pairing_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import '../../helpers/widget_helpers.dart';
|
|
|
|
void main() {
|
|
testWidgets(
|
|
'welcome flight moves, pauses accessibly, and leaves actions usable',
|
|
(tester) async {
|
|
tester.view.physicalSize = const Size(402, 874);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
final reducedMotion = ValueNotifier(false);
|
|
addTearDown(reducedMotion.dispose);
|
|
var communityLinks = 0;
|
|
await tester.pumpWidget(
|
|
WidgetHelpers.testable(
|
|
child: ValueListenableBuilder<bool>(
|
|
valueListenable: reducedMotion,
|
|
builder: (context, reduced, _) => MediaQuery(
|
|
data: MediaQuery.of(context).copyWith(disableAnimations: reduced),
|
|
child: PairingPage(
|
|
connectionLanding: true,
|
|
onCommunityLink: () => communityLinks++,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
Offset beePosition() {
|
|
final transform = tester
|
|
.widget<Transform>(find.byKey(const ValueKey('welcome-bee-0')))
|
|
.transform;
|
|
return Offset(transform.storage[12], transform.storage[13]);
|
|
}
|
|
|
|
final entrance = beePosition();
|
|
for (var frame = 0; frame < 120; frame++) {
|
|
await tester.pump(const Duration(milliseconds: 17));
|
|
}
|
|
expect(beePosition(), isNot(entrance));
|
|
final flying = beePosition();
|
|
await tester.pump(const Duration(milliseconds: 50));
|
|
expect(beePosition(), isNot(flying));
|
|
await tester.tap(find.text('Enter a community link').hitTestable());
|
|
expect(communityLinks, 1);
|
|
|
|
expect(find.byKey(const ValueKey('welcome-bee-11')), findsOneWidget);
|
|
Size flightSize() =>
|
|
tester.getSize(find.byKey(const Key('welcome-bee-flight-area')));
|
|
final portraitSize = flightSize();
|
|
final portrait = beePosition();
|
|
tester.view.physicalSize = const Size(874, 402);
|
|
await tester.pump();
|
|
expect(
|
|
beePosition().dx,
|
|
closeTo(portrait.dx / portraitSize.width * flightSize().width, 0.001),
|
|
);
|
|
expect(
|
|
beePosition().dy,
|
|
closeTo(portrait.dy / portraitSize.height * flightSize().height, 0.001),
|
|
);
|
|
expect(find.byKey(const ValueKey('welcome-bee-11')), findsOneWidget);
|
|
final landscapeSize = flightSize();
|
|
final landscape = beePosition();
|
|
await tester.pump(const Duration(milliseconds: 50));
|
|
expect(beePosition(), isNot(landscape));
|
|
await tester.ensureVisible(find.text('Enter a community link'));
|
|
await tester.pump();
|
|
await tester.tap(find.text('Enter a community link').hitTestable());
|
|
expect(communityLinks, 2);
|
|
final beforeReturn = beePosition();
|
|
tester.view.physicalSize = const Size(402, 874);
|
|
await tester.pump();
|
|
expect(
|
|
beePosition().dx,
|
|
closeTo(
|
|
beforeReturn.dx / landscapeSize.width * flightSize().width,
|
|
0.001,
|
|
),
|
|
);
|
|
expect(
|
|
beePosition().dy,
|
|
closeTo(
|
|
beforeReturn.dy / landscapeSize.height * flightSize().height,
|
|
0.001,
|
|
),
|
|
);
|
|
|
|
reducedMotion.value = true;
|
|
await tester.pump();
|
|
final still = beePosition();
|
|
await tester.pump(const Duration(seconds: 1));
|
|
expect(beePosition(), still);
|
|
expect(find.bySemanticsLabel('Buzz'), findsOneWidget);
|
|
expect(find.bySemanticsLabel('Animated bee'), findsNothing);
|
|
|
|
reducedMotion.value = false;
|
|
await tester.pump();
|
|
await tester.pump(const Duration(milliseconds: 50));
|
|
expect(beePosition(), isNot(still));
|
|
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
|
|
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.hidden);
|
|
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.paused);
|
|
await tester.pump();
|
|
final paused = beePosition();
|
|
await tester.pump(const Duration(seconds: 1));
|
|
expect(beePosition(), paused);
|
|
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.hidden);
|
|
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
|
|
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
|
|
await tester.pump();
|
|
await tester.pump(const Duration(milliseconds: 50));
|
|
expect(beePosition(), isNot(paused));
|
|
expect(tester.takeException(), isNull);
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
},
|
|
);
|
|
}
|