Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apple): support preferredScreenCaptureFormat #965

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ data class XcresultConfiguration(
@JsonProperty("pullingPolicy") val pullingPolicy: PullingPolicy = PullingPolicy.ALWAYS,
@JsonProperty("remoteClean") val remoteClean: Boolean = true,
@JsonProperty("attachments") val attachments: AttachmentsConfiguration = AttachmentsConfiguration(),
@JsonProperty("preferredScreenCaptureFormat") val preferredScreenCaptureFormat: ScreenCaptureFormat? = null,
)

data class AttachmentsConfiguration(
Expand Down Expand Up @@ -36,3 +37,13 @@ enum class PullingPolicy {
@JsonProperty("ALWAYS") ALWAYS,
@JsonProperty("ON_FAILURE") ON_FAILURE,
}

enum class ScreenCaptureFormat {
@JsonProperty("screenshots") SCREENSHOTS,
@JsonProperty("screenRecording") SCREEN_RECORDING;

fun xcodevalue() = when(this) {
SCREENSHOTS -> "screenshots"
SCREEN_RECORDING -> "screenRecording"
}
}
15 changes: 15 additions & 0 deletions docs/runner/apple/configure/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ deleted on success and user attachments will always be kept in the xcresult, but

Possible values for the lifetime are `KEEP_ALWAYS`, `DELETE_ON_SUCCESS` and `KEEP_NEVER`.

#### xcresult screen recorder configuration
Since Xcode 15 test execution defaults to recording test video and attaching it to xcresults. This can be configured as follows:
```yaml
xcresult:
preferredScreenCaptureFormat: SCREENSHOTS
```

Possible values for the screen capture format are `SCREENSHOTS` and `SCREEN_RECORDING`.

:::warning

This setting doesn't influence marathon's screen recorder which is configured separately.

:::

### Screen recorder configuration

By default, marathon will record a h264-encoded video of the internal display with black mask if it is supported.
Expand Down
15 changes: 15 additions & 0 deletions docs/runner/apple/configure/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,21 @@ deleted on success and user attachments will always be kept in the xcresult, but

Possible values for the lifetime are `KEEP_ALWAYS`, `DELETE_ON_SUCCESS` and `KEEP_NEVER`.

#### xcresult screen recorder configuration
Since Xcode 15 test execution defaults to recording test video and attaching it to xcresults. This can be configured as follows:
```yaml
xcresult:
preferredScreenCaptureFormat: SCREENSHOTS
```

Possible values for the screen capture format are `SCREENSHOTS` and `SCREEN_RECORDING`.

:::warning

This setting doesn't influence marathon's screen recorder which is configured separately.

:::

### xctestrun Environment and TestingEnvironment variables

You can specify additional Environment and TestingEnvironment variables for your test run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class TestRootFactory(
testBundlePath = remoteXctest,
testHostPath = testRunnerApp,
uiTargetAppPath = remoteTestApp,
preferredScreenCaptureFormat = xcresultConfiguration.preferredScreenCaptureFormat?.xcodevalue(),
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class TestTarget : TestTarget {
testRegion: String? = null,
isUITestBundle: Boolean? = null,
isAppHostedTestBundle: Boolean? = null,
preferredScreenCaptureFormat: String? = null,
): V2TestTarget {
return V2TestTarget(
name = name,
Expand Down Expand Up @@ -65,6 +66,7 @@ class TestTarget : TestTarget {
testRegion = testRegion,
isUITestBundle = isUITestBundle,
isAppHostedTestBundle = isAppHostedTestBundle,
preferredScreenCaptureFormat = preferredScreenCaptureFormat,
)
}

Expand Down Expand Up @@ -161,6 +163,7 @@ class TestTarget : TestTarget {
testRegion: String? = null,
isUITestBundle: Boolean? = null,
isAppHostedTestBundle: Boolean? = null,
preferredScreenCaptureFormat: String? = null,
) : super(
testBundlePath,
testHostPath,
Expand Down Expand Up @@ -192,6 +195,7 @@ class TestTarget : TestTarget {
testRegion?.let { this.testRegion = it }
isUITestBundle?.let { this.isUITestBundle = it }
isAppHostedTestBundle?.let { this.isAppHostedTestBundle = it }
preferredScreenCaptureFormat?.let { this.preferredScreenCaptureFormat = it }
}

/**
Expand Down Expand Up @@ -270,4 +274,10 @@ class TestTarget : TestTarget {
*/
var isUITestBundle: Boolean? by delegate.optionalDelegateFor("IsUITestBundle")
var isAppHostedTestBundle: Boolean? by delegate.optionalDelegateFor("IsAppHostedTestBundle")

/**
* Added in xcode 15, possible values are [screenshots, screenRecording]. Defaults to screenRecording
* Ignored by previous versions of xcode
*/
var preferredScreenCaptureFormat: String? by delegate.optionalDelegateFor("preferredScreenCaptureFormat")
}
Loading