mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-09-11 12:56:03 +03:00
Compare commits
2 Commits
1415e57c87
...
d88a466333
Author | SHA1 | Date | |
---|---|---|---|
|
d88a466333 | ||
|
9034be374c |
@ -1064,6 +1064,7 @@ A multiline script can be written using the various YAML multiline methods, for
|
||||
- [ ] **captureScreenshotsAutomatically**: **Bool** - indicates whether screenshots should be captured automatically while UI Testing. This defaults to true.
|
||||
- [ ] **deleteScreenshotsWhenEachTestSucceeds**: **Bool** - whether successful UI tests should cause automatically-captured screenshots to be deleted. If `captureScreenshotsAutomatically` is false, this value is ignored. This defaults to true.
|
||||
- [ ] **testPlans**: **[[Test Plan](#test-plan)]** - List of test plan locations that will be referenced in the scheme.
|
||||
- [ ] **preferredScreenCaptureFormat**: **String** - automatic screen capture format to use while UI Testing. Possible values are `screenshots`, `screenRecording`. Default is `screenRecording`.
|
||||
|
||||
#### Test Target
|
||||
A target can be one of a 2 types:
|
||||
|
@ -86,8 +86,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/tuist/XcodeProj.git",
|
||||
"state" : {
|
||||
"revision" : "6e60fb55271c80f83a186c9b1b4982fd991cfc0a",
|
||||
"version" : "8.13.0"
|
||||
"revision" : "3797181813ee963fe305d939232bc576d23ddbb0",
|
||||
"version" : "8.15.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ let package = Package(
|
||||
.package(url: "https://github.com/yonaskolb/JSONUtilities.git", from: "4.2.0"),
|
||||
.package(url: "https://github.com/kylef/Spectre.git", from: "0.9.2"),
|
||||
.package(url: "https://github.com/onevcat/Rainbow.git", from: "4.0.0"),
|
||||
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.13.0"),
|
||||
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.15.0"),
|
||||
.package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.3"),
|
||||
.package(url: "https://github.com/mxcl/Version", from: "2.0.0"),
|
||||
.package(url: "https://github.com/SwiftDocOrg/GraphViz.git", exact: "0.2.0"),
|
||||
|
@ -203,6 +203,7 @@ public struct Scheme: Equatable {
|
||||
public static let debugEnabledDefault = true
|
||||
public static let captureScreenshotsAutomaticallyDefault = true
|
||||
public static let deleteScreenshotsWhenEachTestSucceedsDefault = true
|
||||
public static let preferredScreenCaptureFormatDefault = XCScheme.TestAction.ScreenCaptureFormat.screenRecording
|
||||
|
||||
public var config: String?
|
||||
public var gatherCoverageData: Bool
|
||||
@ -220,6 +221,7 @@ public struct Scheme: Equatable {
|
||||
public var captureScreenshotsAutomatically: Bool
|
||||
public var deleteScreenshotsWhenEachTestSucceeds: Bool
|
||||
public var testPlans: [TestPlan]
|
||||
public var preferredScreenCaptureFormat: XCScheme.TestAction.ScreenCaptureFormat
|
||||
|
||||
public struct TestTarget: Equatable, ExpressibleByStringLiteral {
|
||||
|
||||
@ -286,7 +288,8 @@ public struct Scheme: Equatable {
|
||||
debugEnabled: Bool = debugEnabledDefault,
|
||||
customLLDBInit: String? = nil,
|
||||
captureScreenshotsAutomatically: Bool = captureScreenshotsAutomaticallyDefault,
|
||||
deleteScreenshotsWhenEachTestSucceeds: Bool = deleteScreenshotsWhenEachTestSucceedsDefault
|
||||
deleteScreenshotsWhenEachTestSucceeds: Bool = deleteScreenshotsWhenEachTestSucceedsDefault,
|
||||
preferredScreenCaptureFormat: XCScheme.TestAction.ScreenCaptureFormat = preferredScreenCaptureFormatDefault
|
||||
) {
|
||||
self.config = config
|
||||
self.gatherCoverageData = gatherCoverageData
|
||||
@ -304,6 +307,7 @@ public struct Scheme: Equatable {
|
||||
self.customLLDBInit = customLLDBInit
|
||||
self.captureScreenshotsAutomatically = captureScreenshotsAutomatically
|
||||
self.deleteScreenshotsWhenEachTestSucceeds = deleteScreenshotsWhenEachTestSucceeds
|
||||
self.preferredScreenCaptureFormat = preferredScreenCaptureFormat
|
||||
}
|
||||
|
||||
public var shouldUseLaunchSchemeArgsEnv: Bool {
|
||||
@ -620,6 +624,7 @@ extension Scheme.Test: JSONObjectConvertible {
|
||||
customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit")
|
||||
captureScreenshotsAutomatically = jsonDictionary.json(atKeyPath: "captureScreenshotsAutomatically") ?? Scheme.Test.captureScreenshotsAutomaticallyDefault
|
||||
deleteScreenshotsWhenEachTestSucceeds = jsonDictionary.json(atKeyPath: "deleteScreenshotsWhenEachTestSucceeds") ?? Scheme.Test.deleteScreenshotsWhenEachTestSucceedsDefault
|
||||
preferredScreenCaptureFormat = jsonDictionary.json(atKeyPath: "preferredScreenCaptureFormat") ?? Scheme.Test.preferredScreenCaptureFormatDefault
|
||||
}
|
||||
}
|
||||
|
||||
@ -662,6 +667,10 @@ extension Scheme.Test: JSONEncodable {
|
||||
dict["deleteScreenshotsWhenEachTestSucceeds"] = deleteScreenshotsWhenEachTestSucceeds
|
||||
}
|
||||
|
||||
if preferredScreenCaptureFormat != Scheme.Test.preferredScreenCaptureFormatDefault {
|
||||
dict["preferredScreenCaptureFormat"] = preferredScreenCaptureFormat.toJSONValue()
|
||||
}
|
||||
|
||||
return dict
|
||||
}
|
||||
}
|
||||
@ -1013,3 +1022,9 @@ extension XCScheme.LaunchAction.GPUValidationMode: JSONEncodable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension XCScheme.TestAction.ScreenCaptureFormat: JSONEncodable {
|
||||
public func toJSONValue() -> Any {
|
||||
rawValue
|
||||
}
|
||||
}
|
||||
|
@ -306,6 +306,7 @@ public class SchemeGenerator {
|
||||
language: scheme.test?.language,
|
||||
region: scheme.test?.region,
|
||||
systemAttachmentLifetime: scheme.test?.systemAttachmentLifetime,
|
||||
preferredScreenCaptureFormat: scheme.test?.preferredScreenCaptureFormat,
|
||||
customLLDBInitFile: scheme.test?.customLLDBInit
|
||||
)
|
||||
|
||||
|
@ -568,6 +568,42 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
.init(reference: "container:\(testPlanPath2)", default: true),
|
||||
]
|
||||
}
|
||||
|
||||
$0.it("generates scheme with screenshots as preferred screen capture format") {
|
||||
let scheme = Scheme(
|
||||
name: "MyScheme",
|
||||
build: Scheme.Build(targets: [buildTarget]),
|
||||
run: Scheme.Run(config: "Debug"),
|
||||
test: Scheme.Test(config: "Debug", preferredScreenCaptureFormat: .screenshots)
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
targets: [app, framework],
|
||||
schemes: [scheme]
|
||||
)
|
||||
let xcodeProject = try project.generateXcodeProject()
|
||||
|
||||
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
|
||||
try expect(xcscheme.testAction?.preferredScreenCaptureFormat) == .screenshots
|
||||
}
|
||||
|
||||
$0.it("generates scheme with screen recording as preferred screen capture format") {
|
||||
let scheme = Scheme(
|
||||
name: "MyScheme",
|
||||
build: Scheme.Build(targets: [buildTarget]),
|
||||
run: Scheme.Run(config: "Debug"),
|
||||
test: Scheme.Test(config: "Debug", preferredScreenCaptureFormat: .screenRecording)
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
targets: [app, framework],
|
||||
schemes: [scheme]
|
||||
)
|
||||
let xcodeProject = try project.generateXcodeProject()
|
||||
|
||||
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
|
||||
try expect(xcscheme.testAction?.preferredScreenCaptureFormat) == .screenRecording
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user