Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
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

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