Files
tmail-flutter/integration_test/memory/memory_probe_web.dart
T
Dang Dat 7af4869bed test: add memory test tag, heavy image and memory probe
Add the memory tag (excluded from the normal Patrol runs), a per-test timeout,
a generated 5 MB PNG, inline-image provisioning and a probe that samples the
Dart heap on Android and the sidecar on web.

Refs #4365
2026-11-06 15:40:29 +07:00

26 lines
782 B
Dart

import 'dart:js_interop';
import 'dart:js_interop_unsafe';
import 'package:dio/dio.dart';
/// Web: tags this page with [caseId] so the sidecar can find it over CDP,
/// then asks the sidecar to take a heap snapshot (`<sidecarUrl>/snapshot`).
Future<void> postSample({
required String sidecarUrl,
required String caseId,
required String label,
}) async {
globalContext['__tmailMemoryProbeId'] = caseId.toJS;
final response = await Dio().post<String>(
'$sidecarUrl/snapshot',
queryParameters: {'case': caseId, 'label': label},
options: Options(
receiveTimeout: const Duration(seconds: 120),
validateStatus: (_) => true,
),
);
if (response.statusCode != 200) {
throw StateError('sidecar ${response.statusCode}: ${response.data}');
}
}