Skip to content

Commit

Permalink
allow remote xctest connections w/ a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
herval committed Dec 11, 2024
1 parent e9d684c commit 8a1d5cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions maestro-ios-driver/src/main/kotlin/util/XCRunnerCLIUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object XCRunnerCLIUtils {
return runningApps(deviceId)[bundleId]
}

fun runXcTestWithoutBuild(deviceId: String, xcTestRunFilePath: String, port: Int, enableXCTestOutputFileLogging: Boolean = false): Process {
fun runXcTestWithoutBuild(deviceId: String, xcTestRunFilePath: String, port: Int, enableXCTestOutputFileLogging: Boolean = false, acceptRemoteConnections: Boolean = false): Process {
val date = dateFormatter.format(LocalDateTime.now())
val outputFile = if (enableXCTestOutputFileLogging) {
File(logDirectory, "xctest_runner_$date.log")
Expand All @@ -142,7 +142,7 @@ object XCRunnerCLIUtils {
),
waitForCompletion = false,
outputFile = outputFile,
params = mapOf("TEST_RUNNER_PORT" to port.toString())
params = mapOf("TEST_RUNNER_PORT" to port.toString(), "ACCEPT_REMOTE_CONNECTIONS" to acceptRemoteConnections.toString())
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class LocalXCTestInstaller(
connectTimeout = 1.seconds,
readTimeout = 100.seconds,
),
private val acceptRemoteConnections: Boolean = false,
) : XCTestInstaller {

private val logger = LoggerFactory.getLogger(LocalXCTestInstaller::class.java)
Expand Down Expand Up @@ -202,6 +203,7 @@ class LocalXCTestInstaller(
xcTestRunFilePath = xctestRunFile.absolutePath,
port = defaultPort,
enableXCTestOutputFileLogging = enableXCTestOutputFileLogging,
acceptRemoteConnections = acceptRemoteConnections,
)
logger.info("[Done] Running XcUITest with `xcodebuild test-without-building`")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct XCTestHTTPServer {
let port = ProcessInfo.processInfo.environment["PORT"]?.toUInt16()
let acceptRemoteConnections = ProcessInfo.processInfo.environment["ACCEPT_REMOTE_CONNECTIONS"] == "true"

let address: HTTPServer.Address = acceptRemoteConnections ? .any(port: port) : .loopback(port: port)
let address = acceptRemoteConnections ? .inet(port: port) : .loopback(port: port)

for route in Route.allCases {
let handler = await RouteHandlerFactory.createRouteHandler(route: route)
Expand Down

0 comments on commit 8a1d5cd

Please sign in to comment.