49 lines
1.6 KiB
Dart
49 lines
1.6 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
import 'live_ikar_smoke.dart' as live;
|
|
|
|
Future<void> main() async {
|
|
final stamp = DateTime.now().millisecondsSinceEpoch.toString().substring(5);
|
|
final phone = '+999$stamp';
|
|
final peer = await live.Device.create(
|
|
Uri.parse('https://ikar.kusoft.xyz'),
|
|
Platform.environment['IKAR_TEST_NODE'] ?? 'node',
|
|
phone,
|
|
'IKAR Test Contact',
|
|
);
|
|
try {
|
|
stdout.writeln(jsonEncode({'ready': true, 'phone': phone, 'id': peer.id}));
|
|
final received = await peer.transport.events
|
|
.firstWhere(
|
|
(event) =>
|
|
event['opcode'] == 128 &&
|
|
event['payload']?['message']?['text'] == 'IKAR phone regression',
|
|
)
|
|
.timeout(const Duration(minutes: 10));
|
|
final chatId = received['payload']['chatId'];
|
|
final history = await peer.ok(49, {'chatId': chatId, 'count': 40});
|
|
final report = {
|
|
'passed': (history['messages'] as List).any(
|
|
(m) => m['text'] == 'IKAR phone regression',
|
|
),
|
|
'boundary':
|
|
'physical Android UI to independent HTTPS peer and persisted history',
|
|
'receivedText': 'IKAR phone regression',
|
|
'timestamp': DateTime.now().toUtc().toIso8601String(),
|
|
};
|
|
await peer.ok(64, {
|
|
'chatId': chatId,
|
|
'message': {'text': 'IKAR regression reply'},
|
|
});
|
|
await File(
|
|
'artifacts/phone-messaging-fix-peer.json',
|
|
).writeAsString(const JsonEncoder.withIndent(' ').convert(report));
|
|
stdout.writeln(jsonEncode(report));
|
|
// Keep the isolated test contact available for UI rename/remove checks.
|
|
await stdin.first;
|
|
} finally {
|
|
await peer.ok(199, {});
|
|
await peer.close();
|
|
}
|
|
}
|