Files
pluriwave/test/servicios/servicio_tutorial_ayuda_test.dart
T
FreeTLab 015a20a823 feat(tutorial): add 9-screen help/tutorial carousel
Add PantallaTutorialAyuda, a PageView-based carousel covering saved
stations/groups, per-station equalizer, recording, adaptive alarms,
Android Auto favorites, auto-reconnect, snooze duration, custom
stations, and a closing summary with a "watch it again" reminder.

ServicioTutorialAyuda persists a one-time seen flag so the carousel
shows once via mostrarSiProcede, independent of entry point; the
final page's CTA label depends on the primerArranque constructor
parameter ("Empezar a escuchar" vs "Cerrar").

Translate the new copy into all 13 supported locales and update
helpSubtitle to describe the new entry point.
2026-08-01 11:34:53 +02:00

55 lines
1.9 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:pluriwave/servicios/servicio_tutorial_ayuda.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// `ServicioTutorialAyuda` decides whether the 9-screen help/tutorial
/// carousel (`PantallaTutorialAyuda`) is still due on this launch. Same
/// injectable-prefs, versioned-key convention as `ServicioBienvenida`: a
/// plain one-time boolean flag, since this tutorial shows once (to both
/// fresh installs and existing installs upgrading to this version) and is
/// otherwise only reachable manually from Ajustes.
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('ServicioTutorialAyuda', () {
test(
'debeMostrarTutorial is true before it has ever been marked seen',
() async {
SharedPreferences.setMockInitialValues({});
final servicio = ServicioTutorialAyuda();
expect(await servicio.debeMostrarTutorial(), isTrue);
},
);
test('debeMostrarTutorial is false after marcarTutorialVisto', () async {
SharedPreferences.setMockInitialValues({});
final servicio = ServicioTutorialAyuda();
await servicio.marcarTutorialVisto();
expect(await servicio.debeMostrarTutorial(), isFalse);
});
test('respects a seen flag already persisted by a prior launch', () async {
SharedPreferences.setMockInitialValues({'pluri_tutorial_visto_v1': true});
final servicio = ServicioTutorialAyuda();
expect(await servicio.debeMostrarTutorial(), isFalse);
});
test(
'is still due on an existing install that has other unrelated flags '
'set but never this one (e.g. the welcome screen already seen)',
() async {
SharedPreferences.setMockInitialValues({
'pluri_bienvenida_vista_v1': true,
});
final servicio = ServicioTutorialAyuda();
expect(await servicio.debeMostrarTutorial(), isTrue);
},
);
});
}