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

Can't generate image folder set in FB_REFERENCE_IMAGE_DIR #130

Open
williamhqs opened this issue Jul 30, 2020 · 4 comments
Open

Can't generate image folder set in FB_REFERENCE_IMAGE_DIR #130

williamhqs opened this issue Jul 30, 2020 · 4 comments

Comments

@williamhqs
Copy link

I followed the set the Environment Variables like below:

FB_REFERENCE_IMAGE_DIR $(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages
IMAGE_DIFF_DIR $(SOURCE_ROOT)/$(PROJECT_NAME)Tests/FailureDiffs

but I can't find the folders ReferenceImages and FailureDiffs.

I can only find it from the log:

/Users/william/Library/Developer/Xcode/DerivedData/MyProject-gpgfmvvbgxrsaqamedlklzlbhyxu/Build/Products/Test-iphonesimulator/MyProject.app/PlugIns/MyProject Tests.xctest/ReferenceImages_64/MyProject Tests.CountdownViewTests/testExampleAndReturnError:@2x.png

I also tried set a fixed path, still doesn't work. Not sure the reason why, I don't want to find it from the console every time.

Any help? Thanks!

@ekranac
Copy link

ekranac commented Aug 11, 2020

Same here. I've also taken a look at getReferenceImageDirectoryWithDefault method and found that none of the defined environment variables gets passed upon running.

@ekranac
Copy link

ekranac commented Aug 12, 2020

If you are using test plans, this might be of help to you.

Since I've recently converted to test plans, I was defining the environment variables the wrong way. I've opened a pull request (#131) with updated instructions. Basically, you need to set the variables inside the test plans configuration, not the run action section of your scheme because they will not get automatically transferred to the test action as they did before.

@rfodge
Copy link

rfodge commented Apr 26, 2021

One additional note wrt @ekranac comment above, in addition to setting the environment variables for the configuration, I had to pick the scheme in the 'Target for Variable Expansion' setting

@dennismozart1994
Copy link

I'm having the same issue... Even if I set the values on test plans or branch new schemes, the code fails to create the directory at _saveReferenceImage function under FBSnapshotTestController.m.

When calling the [_fileManager createDirectoryAtPath:[filePath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:&creationError]; it returns the following error:

Error Domain=NSCocoaErrorDomain Code=4 "The file “MyTestScheme.MyTestClass” doesn’t exist." UserInfo={NSFilePath=/Users/MyUser/MyProjectName/MyTestScheme/ReferenceImages_64/MyTestScheme.MyTestClass, NSUnderlyingError=0x600003b45e60 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

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

No branches or pull requests

4 participants