Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support taking snapshots in light and dark mode #125

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

steve509
Copy link

Hello 👋, I wanted to add support for taking snapshot tests for both light and dark mode.

}

func FBSnapshotVerifyViewControllerForLightDarkMode(_ viewController: UIViewController, identifier: String? = nil, delay: TimeInterval = 0, perPixelTolerance: CGFloat = 0, overallTolerance: CGFloat = 0, file: StaticString = #file, line: UInt = #line) {
if #available(iOS 13.0, *) {

Choose a reason for hiding this comment

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

Might be better to mark the method as available in iOS 13+ only (and the method above) rather than having this no-op on iOS 12 and below.

Copy link
Author

Choose a reason for hiding this comment

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

Good point, thanks Nick!

@ahmedAlmasri
Copy link

@steve509 I think we have an issue when try to use FBSnapshotVerifyViewControllerForLightDarkMode always show this error

  • Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=4 "Images different" UserInfo={NSLocalizedFailureReason=image pixels differed by more than 0.00% from the reference image,

@NoahHines
Copy link

Any updates on approving this? :)

@steve509
Copy link
Author

@steve509 I think we have an issue when try to use FBSnapshotVerifyViewControllerForLightDarkMode always show this error

  • Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=4 "Images different" UserInfo={NSLocalizedFailureReason=image pixels differed by more than 0.00% from the reference image,

Hi @ahmedAlmasri, I'm not seeing that error myself 🤔 . Is the snapshot test failing even if you re-take the image? Which snapshot image is it failing on, the light or dark image?

@NoahHines
Copy link

Any updates on this?

@steve509
Copy link
Author

Is there anything I can do to help get this reviewed and approved? Please let me know.

@alanzeino
Copy link
Collaborator

Is there anything I can do to help get this reviewed and approved? Please let me know.

Happy to review it now, but a minor merge conflict — do you mind rebasing?

@steve509 steve509 force-pushed the support-light-dark-modes branch from 976d902 to a5b642a Compare December 4, 2021 14:54
@steve509
Copy link
Author

steve509 commented Dec 4, 2021

Is there anything I can do to help get this reviewed and approved? Please let me know.

Happy to review it now, but a minor merge conflict — do you mind rebasing?

Thanks @alanzeino, i've rebased. Please let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants