ios-snapshot-test-case icon indicating copy to clipboard operation
ios-snapshot-test-case copied to clipboard

failed - Snapshot comparison failed: Optional(Error Domain=Foundation._GenericObjCError Code=0 "(null)")

Open brunosrocha opened this issue 4 years ago • 8 comments

Does someone have the same issue?

No matter what I do I keep getting this failed - Snapshot comparison failed: Optional(Error Domain=Foundation._GenericObjCError Code=0 "(null)") when trying to run my snapshot tests.

I am using XCode 11.3.1

brunosrocha avatar Mar 30 '20 14:03 brunosrocha

We're also having this issue -- interestingly it's only affecting some of us, despite having near-identical setups.

@brunodossantosrocha1510 have you managed to find any workarounds since you posted this?

MichaelKearnsSoftwire avatar May 14 '20 16:05 MichaelKearnsSoftwire

@MichaelKearnsSoftwire I have tried literally everything and also didn't have success.. Have you had any success?

brunosrocha avatar May 15 '20 10:05 brunosrocha

I'm having exactly the same problem with version 11.3.1 of XCode

anaccborba avatar May 15 '20 17:05 anaccborba

Have you had any success?

@brunodossantosrocha1510 yes, we have in fact! It seemed to be a permissions issue.

Things you could try which might solve the problem:

  1. Try running as a different user (either as admin or non-admin)
  2. Delete the snapshot files, re-generate them then re-execute the tests.

In our investigation, we saw that executing against the freshly checked-out repository caused the above error, but deleting and re-generating the snapshot images enabled them to pass -- the re-generated images had the same binary content (so git did not show any differences) but inspecting the files with ls -al@ showed that the extended attributes of the file had changed, adding a new com.apple.macl attribute (more info on this here)

Afraid I don't have any more info right now -- hopefully the above helps you out, if not I'll see if I can find out more next week.

MichaelKearnsSoftwire avatar May 16 '20 11:05 MichaelKearnsSoftwire

I think I was seeing these errors and was able to solve them by giving SimulatorTrampoline.xpc full disk access. I'm not sure that's ideal, though.

cgi-isaac avatar Jul 13 '20 21:07 cgi-isaac

Same here, XCode 11.6. Tried to give full access to SimulatorTrampoline without success

Unihilator avatar Jul 25 '20 07:07 Unihilator

@brunodossantosrocha1510

I had the same problem. And that was resolved.

I was NOT calling the super.setUp(). hope this helps.

watanavex avatar Oct 07 '20 21:10 watanavex

I have this problem and it was happening because the Desktop folder locked the files and the snapshot can not read them, so now I just use the root folder (~/) and everything worked.

davifmarcelino avatar Dec 21 '22 18:12 davifmarcelino