Skip to content

Commit 16f56d8

Browse files
committed
Also test WordPressEditor
Test Add runtime validation Make Rubocop Happy
1 parent 6ea8eb3 commit 16f56d8

2 files changed

Lines changed: 135 additions & 5 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1310"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "F1D360AC2092947500B4E7A5"
18+
BuildableName = "WordPressEditor.framework"
19+
BlueprintName = "WordPressEditor"
20+
ReferencedContainer = "container:WordPressEditor.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "F1D360B52092947500B4E7A5"
36+
BuildableName = "WordPressEditorTests.xctest"
37+
BlueprintName = "WordPressEditorTests"
38+
ReferencedContainer = "container:WordPressEditor.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
</TestAction>
43+
<LaunchAction
44+
buildConfiguration = "Debug"
45+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
launchStyle = "0"
48+
useCustomWorkingDirectory = "NO"
49+
ignoresPersistentStateOnLaunch = "NO"
50+
debugDocumentVersioning = "YES"
51+
debugServiceExtension = "internal"
52+
allowLocationSimulation = "YES">
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<MacroExpansion>
61+
<BuildableReference
62+
BuildableIdentifier = "primary"
63+
BlueprintIdentifier = "F1D360AC2092947500B4E7A5"
64+
BuildableName = "WordPressEditor.framework"
65+
BlueprintName = "WordPressEditor"
66+
ReferencedContainer = "container:WordPressEditor.xcodeproj">
67+
</BuildableReference>
68+
</MacroExpansion>
69+
</ProfileAction>
70+
<AnalyzeAction
71+
buildConfiguration = "Debug">
72+
</AnalyzeAction>
73+
<ArchiveAction
74+
buildConfiguration = "Release"
75+
revealArchiveInOrganizer = "YES">
76+
</ArchiveAction>
77+
</Scheme>

fastlane/Fastfile

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,73 @@
22

33
default_platform(:ios)
44

5-
IOS_VERSION = '15.0'
6-
TEST_DEVICES = ['iPhone 11'].freeze
5+
TEST_RUNTIME = 'iOS 14.0'
6+
TEST_DEVICE = 'iPhone 11'
77

88
platform :ios do
99
desc 'Builds the project and runs tests'
1010
lane :test do
11+
device = create_simulator(TEST_RUNTIME, TEST_DEVICE)
12+
1113
run_tests(
1214
workspace: 'Aztec.xcworkspace',
1315
scheme: 'Aztec',
14-
devices: TEST_DEVICES,
15-
deployment_target_version: IOS_VERSION,
16+
device: device.name,
1617
prelaunch_simulator: true,
1718
buildlog_path: File.join(__dir__, '.build', 'logs'),
18-
derived_data_path: File.join(__dir__, '.build', 'derived-data')
19+
derived_data_path: File.join(__dir__, '.build', 'derived-data'),
20+
ensure_devices_found: true
1921
)
22+
23+
run_tests(
24+
workspace: 'Aztec.xcworkspace',
25+
scheme: 'WordPressEditor',
26+
device: device.name,
27+
prelaunch_simulator: true,
28+
buildlog_path: File.join(__dir__, '.build', 'logs'),
29+
derived_data_path: File.join(__dir__, '.build', 'derived-data'),
30+
ensure_devices_found: true
31+
)
32+
33+
destroy_simulator(device)
34+
end
35+
end
36+
37+
def create_simulator(runtime, device)
38+
fastlane_require 'simctl'
39+
fastlane_require 'securerandom'
40+
41+
validate_runtime_exists(runtime)
42+
43+
simulator = SimCtl.create_device(
44+
SecureRandom.uuid,
45+
SimCtl.devicetype(name: device),
46+
SimCtl.runtime(name: runtime)
47+
)
48+
49+
UI.success "Successfully created an #{runtime} #{device} labelled #{simulator.name}"
50+
51+
simulator
52+
end
53+
54+
def validate_runtime_exists(runtime)
55+
fastlane_require 'simctl'
56+
57+
begin
58+
SimCtl.runtime({ name: runtime })
59+
rescue StandardError
60+
SimCtl.list_runtimes.each do |existing_runtime|
61+
puts existing_runtime.name
62+
end
63+
64+
UI.user_error! "#{runtime} is not available. Available runtimes are listed above."
2065
end
2166
end
67+
68+
def destroy_simulator(simulator)
69+
runtime = simulator.runtime.name
70+
device_type_name = simulator.devicetype.name
71+
72+
simulator.delete
73+
UI.success "Successfully deleted #{runtime} #{device_type_name}"
74+
end

0 commit comments

Comments
 (0)