diff --git a/Test/SnapshotTestCase.swift b/Test/SnapshotTestCase.swift index 6b3177ac5..b829d0880 100644 --- a/Test/SnapshotTestCase.swift +++ b/Test/SnapshotTestCase.swift @@ -72,7 +72,7 @@ class SnapshotTestCase : FBSnapshotTestCase { // Standardize on a size so we don't have to worry about different simulators // etc. // Pick a non standard width so we can catch width assumptions. - return CGSize(width: 375, height: 667) + return CGSize(width: 390, height: 844) } fileprivate var majorVersion : Int { diff --git a/build.gradle b/build.gradle index ca2c72853..5d8fa3fff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,4 @@ + import com.dd.plist.* import org.edx.builder.TaskHelper @@ -256,11 +257,36 @@ wrapper { gradleVersion = '6.3' } +def getSimulatorUDID(deviceName, osVersion) { + def output = ["xcrun", "simctl", "list", "devices"].execute().text + println output + def lines = output.split('\n') + def osFound = false + + for (line in lines) { + if (line.contains("-- iOS $osVersion --")) { + osFound = true + } else if (osFound && line.contains(deviceName)) { + def match = line =~ /(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/ + if (match) { + return match[0][0] + } + } + } + + return null +} + def testBuildArguments(workspace, scheme, OS, record) { + def deviceName = OS.startsWith("16") ? "iPhone 14 Pro" : "iPhone 13 Pro" + def udid = getSimulatorUDID(deviceName, OS) + def args = [ - 'xcodebuild', '-workspace', workspace, '-scheme', scheme, '-sdk', 'iphonesimulator', '-destination', 'platform=iOS Simulator,name=iPhone 8,OS=' + OS, 'test' + 'xcodebuild', '-workspace', workspace, '-scheme', scheme, '-sdk', 'iphonesimulator', + '-destination', "id=$udid", 'test' ] - if(record) { + + if (record) { args += ["OTHER_SWIFT_FLAGS=\$(OTHER_SWIFT_FLAGS) -D RECORD_SNAPSHOTS"] } return args @@ -270,7 +296,7 @@ def RTLSchemeForScheme(scheme) { return scheme + '-RTL' } -def operatingSystems = ["currentOS": "15.2", "previousOS": "14.4"] +def operatingSystems = ["currentOS": "16.4", "previousOS": "15.5"] def directions = ["LTR": scheme, "RTL": RTLSchemeForScheme(scheme)] def commands = ["test" : ["record" : false], "recordSnapshots": ["record" : true]] @@ -287,4 +313,4 @@ for(OS in operatingSystems) { task test(dependsOn: tasks.findAll { task -> task.name.startsWith('test')}) {} -task recordSnapshots(dependsOn: tasks.findAll { task -> task.name.startsWith('recordSnapshots')}) {} \ No newline at end of file +task recordSnapshots(dependsOn: tasks.findAll { task -> task.name.startsWith('recordSnapshots')}) {}