captureScreenArtifacts method

void captureScreenArtifacts(
  1. EnsembleTestContext ctx
)

Implementation

void captureScreenArtifacts(EnsembleTestContext ctx) {
  return RunnerBenchmark.sync('workflow', 'captureScreenArtifacts', () {
    final screenName = ScreenTracker().getCurrentScreenIdentifier();
    if (screenName == null || screenName.isEmpty) return;

    Map<String, dynamic>? performance;
    if (ctx.config.performance.enabled) {
      try {
        performance = buildScreenPerformanceJson(
          screenName: screenName,
          frames: ctx.runtime.appFrameTimings,
          markers: ctx.runtime.performanceMarkers,
          apiCalls: ctx.apiOverlay.calls,
          storageChanges: ctx.runtime.storageStepDiffs,
          secureStorageChanges: ctx.runtime.secureStorageStepDiffs,
          keychainChanges: ctx.runtime.keychainStepDiffs,
          storageDiagnosticsEnabled: ctx.config.logStorage.enabled,
        );
      } catch (_) {}
    }

    if (performance != null) {
      ctx.runtime.screenArtifacts[screenName] = {
        'performance': performance,
      };
    }
  });
}