Skip to content

Commit

Permalink
Turn off failing XCTest attachment collection (flutter#19668)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman authored Jul 14, 2020
1 parent ed15ce2 commit d2a036d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
systemAttachmentLifetime = "keepNever">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
systemAttachmentLifetime = "keepNever">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,26 @@ - (void)checkGolden {
GoldenImage* golden = self.manager.goldenImage;

XCUIScreenshot* screenshot = [[XCUIScreen mainScreen] screenshot];
XCTAttachment* attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
attachment.name = @"new_golden";
attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
[self addAttachment:attachment];

if (golden.image) {
XCTAttachment* goldenAttachment = [XCTAttachment attachmentWithImage:golden.image];
attachment.name = @"current_golden";
goldenAttachment.lifetime = XCTAttachmentLifetimeKeepAlways;
[self addAttachment:goldenAttachment];
} else {
if (!golden.image) {
XCTAttachment* attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
attachment.name = @"new_golden";
attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
[self addAttachment:attachment];
XCTFail(@"This test will fail - no golden named %@ found. Follow the steps in the "
@"README to add a new golden.",
golden.goldenName);
}

XCTAssertTrue([golden compareGoldenToImage:screenshot.image]);
if (![golden compareGoldenToImage:screenshot.image]) {
XCTAttachment* goldenAttachment;
goldenAttachment = [XCTAttachment attachmentWithImage:golden.image];
goldenAttachment.name = @"current_golden";
goldenAttachment.lifetime = XCTAttachmentLifetimeKeepAlways;
[self addAttachment:goldenAttachment];

XCTFail(@"Goldens to not match. Follow the steps in the "
@"README to update golden named %@ if needed.",
golden.goldenName);
}
}
@end

0 comments on commit d2a036d

Please sign in to comment.