Skip to content

Commit

Permalink
Make test pass standalone (fastlane#22268)
Browse files Browse the repository at this point in the history
Make sure all individual test files pass when ran on their own.
  • Loading branch information
lacostej authored Oct 3, 2024
1 parent 9570878 commit 91fbc4d
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 150 deletions.
224 changes: 111 additions & 113 deletions deliver/spec/app_screenshot_spec.rb

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions deliver/spec/deliver_constants.rb

This file was deleted.

26 changes: 12 additions & 14 deletions deliver/spec/sync_screenshots_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
require 'deliver/sync_screenshots'
require 'fakefs/spec_helpers'
require_relative 'deliver_constants'

describe Deliver::SyncScreenshots do
describe '#do_replace_screenshots' do
include DeliverConstants

subject { described_class.new(app: nil, platform: nil) }

Expand All @@ -22,10 +20,10 @@
context 'ASC has nothing and going to add screenshots' do
let(:screenshots) do
[
mock_screenshot(path: '5.5_1.jpg', screen_size: ScreenSize::IOS_55),
mock_screenshot(path: '5.5_2.jpg', screen_size: ScreenSize::IOS_55),
mock_screenshot(path: '6.5_1.jpg', screen_size: ScreenSize::IOS_65),
mock_screenshot(path: '6.5_2.jpg', screen_size: ScreenSize::IOS_65)
mock_screenshot(path: '5.5_1.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_55),
mock_screenshot(path: '5.5_2.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_55),
mock_screenshot(path: '6.5_1.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_65),
mock_screenshot(path: '6.5_2.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_65)
]
end

Expand Down Expand Up @@ -55,10 +53,10 @@
context 'ASC has a screenshot on each screenshot set and going to add another screenshot' do
let(:screenshots) do
[
mock_screenshot(path: '5.5_1.jpg', screen_size: ScreenSize::IOS_55),
mock_screenshot(path: '5.5_2.jpg', screen_size: ScreenSize::IOS_55),
mock_screenshot(path: '6.5_1.jpg', screen_size: ScreenSize::IOS_65),
mock_screenshot(path: '6.5_2.jpg', screen_size: ScreenSize::IOS_65)
mock_screenshot(path: '5.5_1.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_55),
mock_screenshot(path: '5.5_2.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_55),
mock_screenshot(path: '6.5_1.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_65),
mock_screenshot(path: '6.5_2.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_65)
]
end

Expand Down Expand Up @@ -128,10 +126,10 @@

let(:screenshots) do
[
mock_screenshot(path: '5.5_1.jpg', screen_size: ScreenSize::IOS_55),
mock_screenshot(path: '5.5_2_improved.jpg', screen_size: ScreenSize::IOS_55),
mock_screenshot(path: '6.5_1.jpg', screen_size: ScreenSize::IOS_65),
mock_screenshot(path: '6.5_2_improved.jpg', screen_size: ScreenSize::IOS_65)
mock_screenshot(path: '5.5_1.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_55),
mock_screenshot(path: '5.5_2_improved.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_55),
mock_screenshot(path: '6.5_1.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_65),
mock_screenshot(path: '6.5_2_improved.jpg', screen_size: Deliver::AppScreenshot::ScreenSize::IOS_65)
]
end

Expand Down
25 changes: 13 additions & 12 deletions gym/spec/code_signing_mapping_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe Gym::CodeSigningMapping do
describe Gym::CodeSigningMapping, requires_xcodebuild: true do
describe "#app_identifier_contains?" do
it "returns false if it doesn't contain it" do
csm = Gym::CodeSigningMapping.new(project: nil)
Expand Down Expand Up @@ -28,38 +28,39 @@
describe "#detect_project_profile_mapping" do
it "returns the mapping of the selected provisioning profiles", requires_xcode: true do
workspace_path = "gym/spec/fixtures/projects/cocoapods/Example.xcworkspace"
project = FastlaneCore::Project.new({
workspace: workspace_path
})
options = { workspace: workspace_path, scheme: "Example" }
project = FastlaneCore::Project.new(options)
Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, options)
csm = Gym::CodeSigningMapping.new(project: project)
expect(csm.detect_project_profile_mapping).to eq({ "family.wwdc.app" => "match AppStore family.wwdc.app", "family.wwdc.app.watchkitapp" => "match AppStore family.wwdc.app.watchkitapp", "family.wwdc.app.watchkitapp.watchkitextension" => "match AppStore family.wwdc.app.watchkitappextension" })
end

it "detects the build configuration from selected scheme", requires_xcode: true do
workspace_path = "gym/spec/fixtures/projects/cocoapods/Example.xcworkspace"
project = FastlaneCore::Project.new({ workspace: workspace_path })
options = { workspace: workspace_path, scheme: "Example (Debug)" }
project = FastlaneCore::Project.new(options)
Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, options)
csm = Gym::CodeSigningMapping.new(project: project)
Gym.config[:scheme] = "Example (Debug)"
expect(csm.detect_project_profile_mapping).to eq({ "family.wwdc.app" => "match Development family.wwdc.app", "family.wwdc.app.watchkitapp" => "match Development family.wwdc.app.watchkitapp", "family.wwdc.app.watchkitapp.watchkitextension" => "match Development family.wwdc.app.watchkitappextension" })
end

it "detects the build configuration from selected scheme of a project based on inheritance for resolve xcconfigs", requires_xcode: true do
workspace_path = "gym/spec/fixtures/projects/projectBasedOnInheritance/ExampleWithInheritedXcconfig.xcworkspace"
project = FastlaneCore::Project.new({ workspace: workspace_path })
options = { workspace: workspace_path, scheme: "Target A" }
project = FastlaneCore::Project.new(options)
Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, options)
csm = Gym::CodeSigningMapping.new(project: project)
Gym.config[:scheme] = "Target A"
expect(csm.detect_project_profile_mapping).to eq({ "com.targeta.release" => "release-targeta", "com.targetb.release" => "release-targetb" })
end
end

describe "#detect_project_profile_mapping_for_tv_os" do
it "returns the mapping of the selected provisioning profiles for tv_os", requires_xcode: true do
workspace_path = "gym/spec/fixtures/projects/cocoapods/Example.xcworkspace"
project = FastlaneCore::Project.new({
workspace: workspace_path
})
options = { workspace: workspace_path, scheme: "ExampletvOS", destination: "generic/platform=tvOS" }
project = FastlaneCore::Project.new(options)
Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, options)
csm = Gym::CodeSigningMapping.new(project: project)
Gym.config[:destination] = "generic/platform=tvOS"
expect(csm.detect_project_profile_mapping).to eq({ "family.wwdc.app" => "match AppStore family.wwdc.app.tvos" })
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F828205B1F74189B00B0DC54"
BuildableName = "ExampletvOS.app"
BlueprintName = "ExampletvOS"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F828205B1F74189B00B0DC54"
BuildableName = "ExampletvOS.app"
BlueprintName = "ExampletvOS"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F828205B1F74189B00B0DC54"
BuildableName = "ExampletvOS.app"
BlueprintName = "ExampletvOS"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,27 @@
ReferencedContainer = "container:ExampleWithComplexXcconfig.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B8D1A31422313F9C002434A4"
BuildableName = "Target A.app"
BlueprintName = "Target A"
ReferencedContainer = "container:ExampleWithInheritedXcconfig.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +50,8 @@
ReferencedContainer = "container:ExampleWithComplexXcconfig.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,8 +73,6 @@
ReferencedContainer = "container:ExampleWithComplexXcconfig.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -80,6 +90,15 @@
ReferencedContainer = "container:ExampleWithComplexXcconfig.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B8D1A31422313F9C002434A4"
BuildableName = "Target A.app"
BlueprintName = "Target A"
ReferencedContainer = "container:ExampleWithComplexXcconfig.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
describe Spaceship::Portal::ProvisioningProfileTemplate do
before { Spaceship.login }
it "should factor a new provisioning profile template" do
attrs = {
"description" => "Template description",
Expand Down

0 comments on commit 91fbc4d

Please sign in to comment.