Skip to content

Commit 6bd803a

Browse files
authored
Add smoke UI tests (#10)
1 parent 4bebbdf commit 6bd803a

File tree

6 files changed

+51
-654
lines changed

6 files changed

+51
-654
lines changed

.github/workflows/build.main.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ workflow(
2727
) {
2828
uses(action = Checkout())
2929
uses(action = ActionsSetupGradle())
30-
run(command = "./gradlew build")
30+
// Skipping Wasm JS tests because of a memory consumption problem.
31+
// TODO: re-enable once it works again https://kotlinlang.slack.com/archives/CDFP59223/p1735278520024339
32+
// See https://github.com/typesafegithub/github-actions-typing-editor/issues/43
33+
run(command = "./gradlew build --exclude-task wasmJsBrowserTest")
3134
}
3235

3336
job(

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- id: 'step-1'
3333
uses: 'gradle/actions/setup-gradle@v4'
3434
- id: 'step-2'
35-
run: './gradlew build'
35+
run: './gradlew build --exclude-task wasmJsBrowserTest'
3636
build_kotlin_scripts:
3737
name: 'Build Kotlin scripts'
3838
runs-on: 'ubuntu-latest'

composeApp/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ kotlin {
2323
}
2424
}
2525
}
26+
testTask {
27+
// Skipping Wasm JS tests because of a memory consumption problem.
28+
// TODO: re-enable once it works again https://kotlinlang.slack.com/archives/CDFP59223/p1735278520024339
29+
// See https://github.com/typesafegithub/github-actions-typing-editor/issues/43
30+
enabled = false
31+
}
2632
}
2733
binaries.executable()
2834
}
@@ -54,6 +60,13 @@ kotlin {
5460
implementation(libs.ktor.client.core)
5561
implementation(libs.kaml)
5662
}
63+
64+
commonTest.dependencies {
65+
implementation(kotlin("test"))
66+
67+
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
68+
implementation(compose.uiTest)
69+
}
5770
}
5871
}
5972

composeApp/src/commonMain/kotlin/App.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.compose.material.TextField
1111
import androidx.compose.runtime.*
1212
import androidx.compose.ui.Alignment
1313
import androidx.compose.ui.Modifier
14+
import androidx.compose.ui.platform.testTag
1415
import androidx.compose.ui.text.font.FontWeight
1516
import androidx.compose.ui.unit.dp
1617
import io.ktor.client.HttpClient
@@ -57,7 +58,7 @@ private fun manifest(manifest: Metadata?) {
5758
Text("<none>")
5859
}
5960
manifest?.inputs?.forEach {
60-
Text(it.key)
61+
Text(it.key, modifier = Modifier.testTag("inputName"))
6162
}
6263

6364
Spacer(Modifier.height(10.dp))
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import androidx.compose.ui.test.*
2+
import kotlin.test.Test
3+
4+
class SmokeTest {
5+
6+
@OptIn(ExperimentalTestApi::class)
7+
@Test
8+
fun `loads action manifest`() = runComposeUiTest {
9+
setContent {
10+
App()
11+
}
12+
13+
waitUntilAtLeastOneExists(hasTestTag("inputName"))
14+
15+
onAllNodesWithTag("inputName").assertAny(hasText("repository"))
16+
}
17+
}

0 commit comments

Comments
 (0)