ChargePoint / xcparse

Command line tool & Swift framework for parsing Xcode 11+ xcresult
MIT License
381 stars 42 forks source link

[BUG] xcparse attachments does not include png/json attachments #84

Open JJdeGroot opened 1 year ago

JJdeGroot commented 1 year ago

Describe the bug When using the xcparse attachments command, only .heic images are extracted from my xctest. The output folder also contains .png images and .json files which are not extracted.

Desktop (please complete the following information):

Crash Report The DiagnosticReports folder does not contain any xcparse reports.

To Reproduce Steps to reproduce the behavior:

  1. Create XCTestCase
  2. Use XCTIssue with XCTAttachment to attach a PNG screenshot
  3. Use XCTIssue with XCTAttachment to attach JSON data
  4. Build test, find .xctest location
  5. Run xcparse attachments /path/to/.xcresult /output/path with the right locations

Expected behavior I expect to receive a folder with all attachments for the test. E.g. the same attachments as I can browse using the Xcode interface.

Additional context The Xcode output directory looks like this:

IDEResultCache-D7CA4802-DD80-4106-8282-28A9346E918C-55257-0000046BB055F232 % tree
.
├── 0~2QKSXk_fXkTsHPJGs0iqE1oE2oJ23H2s12fhKNzCSTrSpPmPiphWggu-TJRKG0RnRPcjE7bVuf4K-OWcVUzHBw==
│   └── Element snapshot_2_BC641069-A876-42D7-AD9E-54D7CB3B984D.png
├── 0~BuQTrGpXqnd977I76c4YXa-Upu5oQsLFGPcttqCH858WKqfdVfR5raQ-QNb-VPm3aquG3vZvb6gbzydAx-Lpzg==
│   └── Element screenshot_1_BC641069-A876-42D7-AD9E-54D7CB3B984D.png
├── 0~HX82NkiROKN3OSbjkqSttx2NjlMyg5mj0-zE581a3se7JR-UtSsdBu2wrITqNo_drSea0kRU5TWFiaxYu4UO9A==
│   └── Diagnostics
│       ├── AbraTests-A8C90B44-9B69-478C-B8B9-ADFE9F59F19F-Configuration-Test Scheme Action-Iteration-1
│       │   ├── AbraTests-E113A3A6-4679-4423-8CA8-551BDA44E742
│       │   │   ├── Session-AbraTests-2023-08-24_120055-zs75Ia.log
│       │   │   ├── StandardOutputAndStandardError-xxx.xxx.xxx.txt
│       │   │   └── StandardOutputAndStandardError.txt
│       │   └── scheduling.log
│       └── iPhone XXXXX
│           └── testmanagerd.log
├── 0~RQgnd2gIorXiOFhHeYK51GOSHI5EgUKIYmgh6avDoy_haMKTlIaDdPhKB5A6YI7VcZsSe7xK-XR6uS0LY3W-Lg==
│   ├── Screenshot_1_29B55B7F-01F5-480D-B5E7-020E4A6AEEF2.heic
│   └── Screenshot_1_872A04D0-776B-4BD4-9707-66DA5BC5EDF1.heic
├── 0~_4soaPjeoge_8u8tboih21NzssNTe3Y4epOu9eSkfPcA5GMnJlr7GbdIqjbaJNcOSYaz8kj1uQfCBqa0Jh4YAQ==
│   ├── Screenshot_1_53473D18-426F-4EAC-92B7-307C67A414EC.heic
│   └── Screenshot_1_92377D15-AFCF-4A00-B518-C090C276B78E.heic
├── 0~dyU0Q5vAdoMCOmnB25QWpZ3WfKDhY3v39YkjhM8YqO3nTQKRyODYik43gg9EiObqIQ40jAAnxUEIiAXNlt0zPw==
│   ├── Screenshot_1_57C28ABA-FF43-4436-8A4A-1360E5C8BB7D.heic
│   ├── Screenshot_1_5B1D6582-4E7F-4187-9B1D-CD19D0F7A768.heic
│   └── Screenshot_1_B60F278D-A78F-4FB2-AE2F-C14CA60F2A1A.heic
├── 0~py6RqezrHff1Af-25NvN4lai1nkkwawW6BwUyADrkPAygG8FaV0UrFDa6taUOH5AUptUwLRJQhbhY8jOjhAcSg==
│   └── Screenshot_1_CCD2EF25-30E2-4A5D-A0B2-F7C7AAC5A7C2.heic
└── 0~tojreXv06JtyW9zi6QnKUthxF0UPNOBQC0yCGoKln08V8P3epCB7yq5FLt6m57jiamHi8gQt4q0yOUsu5uQLaw==
    └── Element data_3_BC641069-A876-42D7-AD9E-54D7CB3B984D.json

The xcparse output folder looks like this

XcodeScreens % tree
.
├── Screenshot_1_05AB0F74-05EF-4BBA-A957-D2EFAEE04297.heic
├── Screenshot_1_1726F397-FF48-4869-832C-C4125CC266EC.heic
├── Screenshot_1_42381FDC-22CD-484C-B1E9-42A0F200CA00.heic
├── Screenshot_1_509A5C5D-301E-45AE-B96E-DBE954A35B92.heic
├── Screenshot_1_BE7AF80A-F929-41B9-A35A-523108E9D625.heic
├── Screenshot_1_C8EF09E2-9D66-46C4-ABD0-4B822C2057F7.heic
├── Screenshot_1_E2C414BD-9DA7-4083-BB92-A810BCFD3B6E.heic
└── Screenshot_1_E30DCFB8-9111-4683-93D1-0DAAEE08AA58.heic

The .json and .png attachments are missing.

The .heic screenshots are automatically taken by Xcode.

JJdeGroot commented 1 year ago

I have also tried creating .heic screenshots, this results in the same issue.

Xcode results

/private/var/folders/wf/zyzjsh9532l7g_p54x97_hlm0000gn/T/IDEResultCache-855BCFEB-7CB5-41C2-BFAF-C02EDC675AB5-72352-000004EE621E90F8
├── 0~-ZCdcalHHnWrLlCWCvnCNKqVELSDACDTL8zs9Jct0v2hU17dgVVuOH1IW_wA0zJuMK3XE_kzOMZ4Dq7DwuIzWA==
│   └── Screenshot_3_60983CFF-C0E2-4DFF-B88B-12C0527FFD8C.jpeg
├── 0~2lPSnjZ0HB-GjJETQBPMYy4XwrM3v3SpwWQeA72j2lTkit3SF1uO52ojCeJ6ntlgFgZazP9uSBGcw19kZbVh3g==
│   └── Screenshot_1_D379317E-B6A9-402D-A1C7-EBE1EA5490D6.heic
├── 0~9uDN1_NdHLa7s9iJKGhT00KqmZj6lcOKOpRvFz5jBbUemDm-N_uz2hlMVvY9Qck7bRt8f2ax0dzsNBJSCbQ58g==
│   └── AbraScreenshotHEIC_2_60983CFF-C0E2-4DFF-B88B-12C0527FFD8C.heic
├── 0~FryBgpoqw4XTk0MTcM6Ru_Vq9bWsS2J6456_GIFLTpag3ARZDqrWWPQ1cBV0YooeonIhJJ4x7tVUCq0U-2RFsA==
│   ├── Screenshot_1_6CF284B6-FAF4-4742-B7D4-E12D413CF862.heic
│   └── Screenshot_1_F8F2DCE3-7A86-4651-B0CB-2D268299D1F5.heic
├── 0~OoJq31rL9RjfzQWZHVDeTa2HMGe6Bea01wXTdElCK9LgrwQGyVYDXPFQFEEHg2k2Bl9Z8DCwh3Kn-qyZsLoEHA==
│   └── Screenshot_1_B3F57900-855B-4D30-9FF9-2D875AF1B4E3.heic
├── 0~XBrx5C5pZvFbO_LaYDj4P7jnqIN5ijVL0WcPhn9c5TqvXgrJhhEd8SAAxAaF03lqPYU2F5x6Cldit_fcV57lTQ==
│   └── AbraScreenshotOriginal_1_60983CFF-C0E2-4DFF-B88B-12C0527FFD8C.png
├── 0~dR2_t8E6C2HRWEf4Qh-w_hgmoKRJJ7kF-5Cm5a7SleNV8K1PNrI7OFz6a6VqRlBz3yM8ghNMHAcM7XLZL7u4jA==
│   └── AbraScreenshotHEIC_2_D3EB2213-E67D-4658-ACBA-0EE636073BDA.heic
├── 0~dTw4s2CZ9CdG4jxsCqHgzB4hM2OyTGZ6mFcc4lX3whU7UwzhpNSWbk0SezJ3pD1xmeKa9r47U3oOQ4oWEIIATA==
│   └── Screenshot_1_AF78AA5B-2ED1-4D12-8F0E-D7DBC6800901.heic
└── 0~tSyQzL0qL9FaN-yGrm6dYnGAC6aOgY73SNyIgV_d-7pJQNQcUcuKDYqlrBBJ24jM7OrUo5v2j0l38L9dw-CUhQ==
    └── Diagnostics
        ├── AbraTests-BF3B75DF-045D-4DB5-BF9C-DE2000432C53-Configuration-Test Scheme Action-Iteration-1
        │   ├── AbraTests-370BFD77-728C-4028-B9AE-8E912D350508
        │   │   ├── Session-AbraTests-2023-08-24_151208-IUYEWS.log
        │   │   ├── StandardOutputAndStandardError-XXXX.txt
        │   │   └── StandardOutputAndStandardError.txt
        │   └── scheduling.log
        └── iPhone van XXXXX
            └── testmanagerd.log

xcparse results

/Users/JJ/Downloads/XcodeScreens
├── Screenshot_1_42086982-0586-4D1B-BC8F-268BBD7010C1.heic
├── Screenshot_1_582BC9BD-1961-4141-BA14-46B585393DFC.heic
├── Screenshot_1_6CF284B6-FAF4-4742-B7D4-E12D413CF862.heic
├── Screenshot_1_AF78AA5B-2ED1-4D12-8F0E-D7DBC6800901.heic
├── Screenshot_1_B3F57900-855B-4D30-9FF9-2D875AF1B4E3.heic
├── Screenshot_1_C69F17B9-5C45-4900-9A79-08D4AB6280D9.heic
├── Screenshot_1_D379317E-B6A9-402D-A1C7-EBE1EA5490D6.heic
└── Screenshot_1_F8F2DCE3-7A86-4651-B0CB-2D268299D1F5.heic

For example, AbraScreenshotHEIC_2_60983CFF-C0E2-4DFF-B88B-12C0527FFD8C.heic has not been processed.