Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Turn off failing XCTest attachment collection #19668

Merged
merged 3 commits into from
Jul 14, 2020

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Jul 11, 2020

Description

Turn off XCUITest attachment collection in iOS tests, which by default get saved for failing tests. This is failing in Xcode 11.x on the command line, and the logs are mostly spew from that, which hides other failures:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket.appspot.com/8875129688297197088/+/steps/Scenario_App_Integration_Tests/0/stdout

Details:  Error writing attachment data to file /Users/swarming/Library/Developer/Xcode/DerivedData/Scenarios-efgskbqbyxwwrrfdsxqpswpwbbkb/Logs/Test/Test-Scenarios-2020.07.10_14-50-15--0700.xcresult/Staging/1_Test/Attachments/new_golden_1_EC3183D7-0D02-4773-9B7C-D3A58744B8ED.png: Error Domain=NSCocoaErrorDomain Code=4 "The folder “new_golden_1_EC3183D7-0D02-4773-9B7C-D3A58744B8ED.png” doesn’t exist." UserInfo={NSFilePath=/Users/swarming/Library/Developer/Xcode/DerivedData/Scenarios-efgskbqbyxwwrrfdsxqpswpwbbkb/Logs/Test/Test-Scenarios-2020.07.10_14-50-15--0700.xcresult/Staging/1_Test/Attachments/new_golden_1_EC3183D7-0D02-4773-9B7C-D3A58744B8ED.png, NSUserStringVariant=Folder, NSUnderlyingError=0x7f838c7b0d90 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Object:   <IDESchemeActionTestAttachment: 0x7f838c7b0180>
Method:   -_savePayload:
Thread:   <NSThread: 0x7f838c4153b0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2020-07-10 14:51:55.769 xcodebuild[39107:576449] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-14936/IDEFoundation/ProjectModel/ActionRecords/IDESchemeActionTestAttachment.m:218
Details:  Error writing attachment data to file /Users/swarming/Library/Developer/Xcode/DerivedData/Scenarios-efgskbqbyxwwrrfdsxqpswpwbbkb/Logs/Test/Test-Scenarios-2020.07.10_14-50-15--0700.xcresult/Staging/1_Test/Attachments/public.png_1_C171348C-EE13-4736-B74E-74772B51A566.png: Error Domain=NSCocoaErrorDomain Code=4 "The folder “public.png_1_C171348C-EE13-4736-B74E-74772B51A566.png” doesn’t exist." UserInfo={NSFilePath=/Users/swarming/Library/Developer/Xcode/DerivedData/Scenarios-efgskbqbyxwwrrfdsxqpswpwbbkb/Logs/Test/Test-Scenarios-2020.07.10_14-50-15--0700.xcresult/Staging/1_Test/Attachments/public.png_1_C171348C-EE13-4736-B74E-74772B51A566.png, NSUserStringVariant=Folder, NSUnderlyingError=0x7f834c613480 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Object:   <IDESchemeActionTestAttachment: 0x7f836c4e8c00>
Method:   -_savePayload:
Thread:   <NSThread: 0x7f838c4153b0>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    . testPlatformView (4.035 seconds)

Screen Shot 2020-07-10 at 4 54 40 PM

Additionally, only save goldens attachments when either the comparison golden isn't found, or the screenshot doesn't match the golden. Do not save attachments when the test passes.

Related Issues

Found as part of flutter/flutter#61267 investigation.

Tests

https://ci.chromium.org/swarming/task/4d638c548f418810?server=chromium-swarm.appspot.com

@jmagman jmagman added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jul 13, 2020
@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Linux Fuchsia has failed. Please fix the issues identified (or deflake) before re-applying this label.
  • The status or check suite Mac iOS Engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jul 13, 2020
@jmagman
Copy link
Member Author

jmagman commented Jul 13, 2020

@jmagman
Copy link
Member Author

jmagman commented Jul 13, 2020

Hm this didn't do what I'd hoped, I still see:

Details:  Error writing attachment data to file /Users/swarming/Library/Developer/Xcode/DerivedData/Scenarios-efgskbqbyxwwrrfdsxqpswpwbbkb/Logs/Test/Test-Scenarios-2020.07.10_19-32-01--0700.xcresult/Staging/1_Test/Attachments/Debug description for `TextView`_1_1471A472-1791-4DC8-9F9C-5888158B388A.txt: Error Domain=NSCocoaErrorDomain Code=4 "The folder “Debug description for `TextView`_1_1471A472-1791-4DC8-9F9C-5888158B388A.txt” doesn’t exist." UserInfo={NSFilePath=/Users/swarming/Library/Developer/Xcode/DerivedData/Scenarios-efgskbqbyxwwrrfdsxqpswpwbbkb/Logs/Test/Test-Scenarios-2020.07.10_19-32-01--0700.xcresult/Staging/1_Test/Attachments/Debug description for `TextView`_1_1471A472-1791-4DC8-9F9C-5888158B388A.txt, NSUserStringVariant=Folder, NSUnderlyingError=0x7fe982f86c40 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Object:   <IDESchemeActionTestAttachment: 0x7fe975d8bc70>
Method:   -_savePayload:
Thread:   <NSThread: 0x7fe982c15390>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.

@jmagman jmagman force-pushed the attachment-tests branch from de387e9 to 32621cc Compare July 14, 2020 00:26

if (golden.image) {
XCTAttachment* goldenAttachment = [XCTAttachment attachmentWithImage:golden.image];
attachment.name = @"current_golden";
Copy link
Member Author

@jmagman jmagman Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a copy-paste bug and was intended to be goldenAttachment.name

@jmagman jmagman requested a review from dnfield July 14, 2020 00:29
@jmagman
Copy link
Member Author

jmagman commented Jul 14, 2020

@jmagman jmagman added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jul 14, 2020
@fluttergithubbot fluttergithubbot merged commit d2a036d into flutter:master Jul 14, 2020
@jmagman jmagman deleted the attachment-tests branch July 14, 2020 16:55
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 14, 2020
auto-submit bot pushed a commit that referenced this pull request Dec 21, 2023
Save a recording/screenshot to the uploaded xcresult when a Scenario test fails.

<img width="1052" alt="Screenshot 2023-12-14 at 6 34 47�PM" src="https://github.com/flutter/engine/assets/682784/c1294497-28f6-4400-b21c-da689a224dc4">

<img width="244" alt="Screenshot 2023-12-14 at 6 41 03�PM" src="https://github.com/flutter/engine/assets/682784/f769dd5f-a71b-4320-b9ef-64eac722166a">

No more errant spew as reported in #19668 when this was originally turned off.
```
 Test Case '-[StatusBarTest testTapStatusBar]' started.
     t =     0.00s Start Test at 2023-12-14 18:20:34.207
...
     t =     2.69s     Synthesize event
     t =     2.70s         Find the StatusBar at {{0.0, 0.0}, {375.0, 20.0}}
     t =     2.72s         Find the StatusBar at {{0.0, 0.0}, {375.0, 20.0}}
     t =     2.74s         Find the StatusBar at {{0.0, 0.0}, {375.0, 20.0}}
     t =     3.03s     Wait for com.apple.springboard to idle
     t =     3.43s Waiting 1.0s for "0,PointerChange.add,device=0,buttons=0,signalKind=PointerSignalKind.none" TextField to exist
     t =     4.43s     Checking `Expect predicate `exists == 1` for object "0,PointerChange.add,device=0,buttons=0,signalKind=PointerSignalKind.none" TextField`
     t =     4.43s         Checking existence of `"0,PointerChange.add,device=0,buttons=0,signalKind=PointerSignalKind.none" TextField`
     t =     4.45s         Capturing element debug description
     t =     4.45s Checking existence of `"0,PointerChange.add,device=0,buttons=0,signalKind=PointerSignalKind.none" TextField`
 /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim/scenario_app/Scenarios/ScenariosUITests/StatusBarTest.m:37: error: -[StatusBarTest testTapStatusBar] : ((exists) is true) failed
     t =     4.48s Tear Down
```
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8761683198070320113/+/u/test:_Scenario_App_Integration_Tests__3_/stdout

Fixes flutter/flutter#140192

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants