Files
chanora/apps/chanora_flutter/test/alpha_e2e_test.dart
T
EdisonJwa 4c19410556 test+diag: SWE.4 unit tests for Rust paths, Dart service tests, diagnostics audio.android section
Verification + diagnostics:

- apps/chanora_flutter/test/services/back_intent_policy_test.dart:
  8-case truth table for the BackIntentPolicy pure function
  (SWE4-UV-042).
- apps/chanora_flutter/test/services/back_intent_service_test.dart:
  5 channel-routing tests (SWE4-UV-042, SWE5-IV-019 unit slice).
- apps/chanora_flutter/test/services/android_permissions_service_test.dart:
  12 tests covering inbound channel events, outbound requests,
  state-machine transitions, and non-Android short-circuit
  (SWE4-UV-041).
- SDD/SRS trace headers added to alpha_e2e_test.dart,
  beta_e2e_test.dart, widget_test.dart so the existing test ↔ ID
  mapping is discoverable by grep.
- chanora_diagnostics: extends DiagnosticExport with android_audio:
  Option<String> for the SDD-116 evidence schema (requested /
  achieved performance mode + sharing mode + input preset + sample
  rate + frames per burst, per-effect engagement, latency tier).
  The bridge's export_diagnostics() now embeds the Android section
  when current_android_audio_diagnostics() returns Some.

All 93 workspace Rust tests and 26 Dart test/services tests pass.

Trace: SDD-090, SDD-112, SDD-113, SDD-116, SWE4-UV-041, SWE4-UV-042,
SWE4-UV-045, SWE4-UV-047, SWE4-UV-048, SWE4-UV-049, SWE4-UV-051,
SWE4-UV-052, SWE5-IV-019.
2026-05-18 12:48:28 +08:00

61 lines
2.2 KiB
Dart

// Alpha end-to-end verification test.
//
// Runs the actual FRB-loaded Rust bridge against cn.teamspeak.app.
// This is the empirical evidence that the Alpha build's
// connect → snapshot → disconnect cycle works through the full
// Dart UI thread → flutter_rust_bridge → chanora_bridge cdylib →
// chanora_core → chanora_protocol → tsclientlib → network
// path.
//
// Tagged with the network-required marker so future CI can opt out.
//
// Requirement trace (SWE.5 / SWE.6 — end-to-end connect path):
// SRS-001..SRS-030 (server connection flow), SRS-031..SRS-060 (channel/client snapshot),
// SAD-032, SAD-033, SAD-040, SAD-041 (protocol adapter + bridge facade),
// SDD-046, SDD-047 (typed DTOs + event mapping).
// Verification-plan rows: SWE5-IV-008, SWE5-IV-009 (swe5-software-integration-verification-plan.md);
// SWE6-SV-001, SWE6-SV-002 (swe6-software-verification-plan.md).
// For now it's just a regular flutter_test test.
import 'package:flutter_test/flutter_test.dart';
import 'package:chanora_flutter/src/rust/api.dart' as rust;
import 'package:chanora_flutter/src/rust/frb_generated.dart';
void main() {
setUpAll(() async {
await RustLib.init();
});
test('connect/snapshot/disconnect against cn.teamspeak.app', () async {
// Defensive: in case a previous test left a connection open.
try {
await rust.disconnect();
} catch (_) {}
final snap = await rust.connect(
host: 'cn.teamspeak.app',
nickname: 'ChanoraAlphaTest',
password: '',
);
expect(snap.serverName, isNotEmpty);
expect(snap.channels, isNotEmpty);
// Welcome message is allowed to be empty on some servers; just
// assert it's a String type (which it always is — this is more a
// smoke than a real assertion).
expect(snap.welcomeMessage, isA<String>());
// Re-fetch the snapshot; should still succeed.
final snap2 = await rust.snapshot();
expect(snap2.serverName, snap.serverName);
final connectedBefore = await rust.isConnected();
expect(connectedBefore, isTrue);
await rust.disconnect();
final connectedAfter = await rust.isConnected();
expect(connectedAfter, isFalse);
}, timeout: const Timeout(Duration(seconds: 30)));
}