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

The file "Test.swift" doesn’t exist #151

Closed
upeugene opened this issue Dec 19, 2018 · 13 comments
Closed

The file "Test.swift" doesn’t exist #151

upeugene opened this issue Dec 19, 2018 · 13 comments
Labels
help wanted Extra attention is needed

Comments

@upeugene
Copy link

upeugene commented Dec 19, 2018

Can not make SnapshotTesting work.
When I use assertSnapshot(matching: view, as: .image) I get this message "The file "failed "Test.swift" doesn’t exist"

What I can do ?

@stephencelis
Copy link
Member

Hi @Hoppus, thanks for the report! We haven't heard of anyone hitting this issue. Can you provide step-by-step instructions on how to reproduce the failure and/or attach a sample project exhibiting the issue?

@upeugene
Copy link
Author

@stephencelis
I created new project from scratch but after I added pod, I started to get this failed message:

SnapshotTestApp[31552:1158378] Failed to load test bundle from file:///Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest/: Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest/SnapshotTestAppTests): 

Library not loaded: @rpath/libswiftGLKit.dylib
  Referenced from: /Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest/Frameworks/SnapshotTesting.framework/SnapshotTesting
  Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest/SnapshotTestAppTests, NSDebugDescription=dlopen_preflight(/Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest/SnapshotTestAppTests): Library not loaded: @rpath/libswiftGLKit.dylib
  Referenced from: /Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest/Frameworks/SnapshotTesting.framework/SnapshotTesting
  Reason: image not found, NSBundlePath=/Users/eugenypopov/Library/Developer/Xcode/DerivedData/SnapshotTestApp-ezokglikaewvzbdydofehynpzvvd/Build/Products/Debug-iphonesimulator/SnapshotTestApp.app/PlugIns/SnapshotTestAppTests.xctest, NSLocalizedDescription=The bundle “SnapshotTestAppTests” couldn’t be loaded because it is damaged or missing necessary resources.}

Podfile:

platform :ios, '12'

inhibit_all_warnings!
use_frameworks!

target 'SnapshotTestAppTests' do
    pod 'SnapshotTesting', '~> 1.1'
end

@stephencelis
Copy link
Member

@Hoppus I think you want to set your Podfile up for your app target as a whole. Can you change your Podfile to the following?

platform :ios, '12'

inhibit_all_warnings!
use_frameworks!

target 'SnapshotTestApp' do
  target 'SnapshotTestAppTests' do
    pod 'SnapshotTesting', '~> 1.1'
  end
end

Can you also verify that the SnapshotTestAppTests target was generated with your new project? It's possible the "Include Unit Tests" option was unchecked.

@upeugene
Copy link
Author

@stephencelis
It's still the same error message.
Unit Tests Included.

Don't know why it doesn't work.
Here's the project if you could take a look
https://www.dropbox.com/s/h8ohqlq9mvfw8no/SnapshotTestApp.zip

@stephencelis
Copy link
Member

stephencelis commented Dec 23, 2018

Hey @Hoppus. Someone else reported the issue here:

CocoaPods/CocoaPods#8318

I've followed up with a comment that shows a working Podfile vs. a non-working one. But, basically, we wanna go back to a non-nested config for now. This Podfile in its entirety works for me:

target 'SnapshotTestAppTests' do
  pod 'SnapshotTesting', '~> 1.1'
end

@stephencelis stephencelis added help wanted Extra attention is needed cocoapods labels Jan 8, 2019
@upeugene
Copy link
Author

upeugene commented Jan 9, 2019

I still don't know how to fix it

screen shot 2019-01-09 at 2 02 50 pm
screen shot 2019-01-09 at 2 02 00 pm

If someone could help it would be really nice.

@upeugene
Copy link
Author

upeugene commented Jan 9, 2019

I just created new file and it started to work 🤔😩

@alexito4
Copy link

@stephencelis sorry for raising this old issue again. But it randomly started happening to our project too. I thought it was Xcode 11 related but other colleagues on 10 are also seeing issues. I've never seen it happen before today so not sure what can be the trigger.

Our Podfile does have the test target nested to the app target. Is that what's causing problems?

@klein-thibault
Copy link

Same as @alexito4 we just saw this issue happening. We had the test target nested in the Podfile so we updated to have it separated but same issue. Do we know what's causing this and how to fix it?

@upeugene
Copy link
Author

I just recreated test file, and the issue was gone

@klein-thibault
Copy link

I have it working fine on my local machine but the test fails in other machines or in CI with the "file doesn't exist" error. I tried refactoring the Podfile to extract the test target, remove and re-add the file, still getting the error.

@klein-thibault
Copy link

I got it... I had a case difference between the Xcode group name and Finder folder name (one was all caps, the other was capitalized) hence why the framework couldn't find the file in the Finder. Updating the folder name to match with the Xcode group fixed the issue.

@mikhailokarpenko
Copy link

mikhailokarpenko commented Jun 1, 2021

I had problem also and figured out that for framework it doesn’t matter. SnapshotFolder or snapshotfolder are equal. So if you change capitalization remember to rename snapshot folder inside _Snapshots_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants