Skip to content

Commit

Permalink
Enable maestro tests for iOS (#15)
Browse files Browse the repository at this point in the history
* Enable maestro tests for iOS

* Update main.ios.kt
  • Loading branch information
aaalaniz authored Mar 3, 2024
1 parent 9de3599 commit 6a96a51
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/lightsaber-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-lightsaber-ci


# TODO Run e2e tests when Compose Multiplatform supports either Compose test tags or
# accessibility labels
- name: Check for app file
run: test -e ./iosApp/build/ios/Release-iphonesimulator/Lightsaber.app
# - uses: mobile-dev-inc/[email protected]
# with:
# api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
# app-file: ./iosApp/build/ios/Release-iphonesimulator/Lightsaber.app
- uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: ./iosApp/build/ios/Release-iphonesimulator/Lightsaber.app
19 changes: 17 additions & 2 deletions shared/src/iosMain/kotlin/xyz/alaniz/aaron/lightsaber/main.ios.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xyz.alaniz.aaron.lightsaber

import androidx.compose.runtime.ExperimentalComposeApi
import androidx.compose.ui.platform.AccessibilitySyncOptions
import androidx.compose.ui.window.ComposeUIViewController
import kotlinx.cinterop.ExperimentalForeignApi
import platform.Foundation.NSDocumentDirectory
Expand All @@ -11,8 +13,21 @@ import xyz.alaniz.aaron.lightsaber.di.create
import xyz.alaniz.aaron.lightsaber.di.dataStoreFileName
import xyz.alaniz.aaron.lightsaber.ui.lightsaber.IosLightsaberScreen

@OptIn(ExperimentalForeignApi::class)
fun MainViewController() = ComposeUIViewController {
@OptIn(ExperimentalForeignApi::class, ExperimentalComposeApi::class)
fun MainViewController() = ComposeUIViewController(configure = {
/**
* TODO Update this to only sync the accessibility tree for debug builds
*/
accessibilitySyncOptions = AccessibilitySyncOptions.Always(debugLogger = null)

/**
* TODO Understand why this needs to be false for Maestro tests to pass
*
* The default value for this is true, but then the accessibility tree mappings include an
* offset for the status bar
*/
platformLayers = false
}) {
val documentDirectory: NSURL? = NSFileManager.defaultManager.URLForDirectory(
directory = NSDocumentDirectory,
inDomain = NSUserDomainMask,
Expand Down

0 comments on commit 6a96a51

Please sign in to comment.