File size: 2,507 Bytes
d197cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { describe, expect, it } from "vitest";

const { detectChangedScope, shouldRunIosScreenshots } =
  await import("../../scripts/ci-changed-scope.mjs");

describe("shouldRunIosScreenshots", () => {
  it("conservatively routes screenshot-pipeline owners to release capture", () => {
    for (const changedPath of [
      "apps/ios/Sources/RootTabs.swift",
      "apps/ios/UITests/OpenClawSnapshotUITests.swift",
      "apps/ios/WatchApp/Sources/WatchVoiceControls.swift",
      "apps/ios/project.yml",
      "apps/ios/Tests/Info.plist",
      "apps/ios/Resources/Localizable.xcstrings",
      "apps/ios/fastlane/Fastfile",
      "apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatView.swift",
      "apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatPasteboardTests.swift",
      "apps/swabble/Sources/SwabbleKit/WakeWordGate.swift",
      "scripts/ios-screenshots.sh",
      "scripts/ios-screenshot-evidence.mjs",
      "scripts/ios-screenshot-evidence.d.mts",
      "scripts/lib/ios-fastlane.sh",
      "scripts/ios-write-swift-filelist.mjs",
      "config/swiftformat",
    ]) {
      expect(shouldRunIosScreenshots([changedPath]), changedPath).toBe(true);
      expect(
        shouldRunIosScreenshots(["apps/ios/Tests/NodeAppModelInvokeTests.swift", changedPath]),
        changedPath,
      ).toBe(true);
    }

    for (const changedPath of [
      "apps/android/app/src/main/java/ai/openclaw/app/MainActivity.kt",
      "docs/ci.md",
      "ui/src/pages/activity/activity-page.ts",
    ]) {
      expect(shouldRunIosScreenshots([changedPath]), changedPath).toBe(false);
    }

    expect(shouldRunIosScreenshots([])).toBe(false);
    expect(shouldRunIosScreenshots(null)).toBe(true);
  });

  it.each([
    "apps/ios/Tests/NodeAppModelInvokeTests.swift",
    "apps/ios/Tests/Logic/WatchVoiceTurnTrackerTests.swift",
    "apps/ios/WatchTests/WatchSpeechPlaybackTests.swift",
  ])("keeps %s in native build scope without unrelated screenshot capture", (changedPath) => {
    expect(detectChangedScope([changedPath]).runIosBuild).toBe(true);
    expect(shouldRunIosScreenshots([changedPath])).toBe(false);
  });

  it("keeps screenshot capture wrappers inside the iOS build lane", () => {
    for (const changedPath of [
      "scripts/ios-screenshots.sh",
      "scripts/ios-screenshot-evidence.mjs",
      "scripts/ios-screenshot-evidence.d.mts",
      "scripts/lib/ios-fastlane.sh",
    ]) {
      expect(detectChangedScope([changedPath]).runIosBuild, changedPath).toBe(true);
    }
  });
});