Files
meshcore-open/test/widgets/get_node_banner_test.dart
T
zjs81 bc14de586f Add opt-in network map uploads and online map view
- Opt-in upload of header-only packet records and repeater/room server
  adverts to map.meshcoreopen.org about once a minute; payloads, channel
  and DM hashes and transport codes are stripped on the phone, locations
  snapped to a ~2 km grid, install ID rotates daily
- One-time opt-in dialog on first radio connection; toggle and status in
  App settings
- Local / Online / Both switch on the map screen with online repeater
  hexagons, links, add-to-contacts and manage
- Node purchase banner on the connect screen (affiliate link, disclosed)
- Privacy policy and network map documentation
- Translations for all locales
2026-10-11 21:54:16 -07:00

49 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/l10n/app_localizations.dart';
import 'package:meshcore_open/widgets/get_node_banner.dart';
void main() {
Future<void> pumpBanner(
WidgetTester tester, {
required Size size,
required double textScale,
}) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: MediaQuery(
data: MediaQueryData(
size: size,
textScaler: TextScaler.linear(textScale),
),
child: const Scaffold(bottomNavigationBar: GetNodeBanner()),
),
),
);
}
testWidgets('shows the pitch and affiliate link', (tester) async {
await pumpBanner(tester, size: const Size(390, 844), textScale: 1);
expect(find.text('Need a new node?'), findsOneWidget);
expect(find.text('Get one here'), findsOneWidget);
expect(find.textContaining('Affiliate link'), findsOneWidget);
expect(getNodeUrl, contains('sensecap_affiliate=JFWID0g'));
// Leaves most of the screen for the device list.
expect(
tester.getSize(find.byType(GetNodeBanner)).height,
lessThan(844 * 0.4),
);
});
testWidgets('lays out on a narrow phone with large text', (tester) async {
await pumpBanner(tester, size: const Size(320, 800), textScale: 1.5);
expect(tester.takeException(), isNull);
});
}