7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fastlane/plugin/firebase_test_lab/helper/ios_validator.rb', line 7
def self.validate_ios_app(file_path)
absolute_path = File.expand_path(file_path)
begin
Zip::File.open(absolute_path) do |zip_file|
xctestrun_files = zip_file.glob("*.xctestrun")
if xctestrun_files.size != 1
UI.user_error!("app verification failed: There must be only one .xctestrun files in the ZIP file.")
end
conf = Plist.parse_xml(xctestrun_files.first.get_input_stream)
unless conf.size == 1
UI.user_error!("The app bundle may contain only one scheme, #{conf.size} found")
end
_, scheme_conf = conf.first
unless scheme_conf["IsUITestBundle"]
UI.user_error!("The app bundle is not a UI test bundle. Did you build with build-for-testing argument?")
end
unless scheme_conf.key?("TestHostPath") || scheme_conf.key?("TestBundlePath")
UI.user_error!("Either TestHostPath or TestBundlePath must be in the app bundle. Please check your " \
"xcodebuild arguments")
end
end
rescue Zip::Error => e
UI.user_error!("Failed to read the ZIP file #{file_path}: #{e.message}")
end
end
|