package com.cottondb.notes import android.app.Application import androidx.compose.ui.test.assertTextEquals import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performTextInput import com.cottondb.shell.OwnWordsLineSheet import kotlinx.serialization.json.Json import kotlinx.serialization.json.jsonObject import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config /** * Settings → Privacy → Add a person did nothing in Words (seen on emulator-5600 against dev, 24 Nov 2026): the shell's * one-line ask was drawn only on the old fan surface. In Words' own sheet it stands with the core's title and hint, the * number typed goes to the commit, and a refusal is said under it. Invented number. */ @RunWith(RobolectricTestRunner::class) @Config(sdk = [35], qualifiers = "w400dp-h800dp-mdpi", application = Application::class) class WordsAddPersonTest { @get:Rule val compose = createComposeRule() private val ask = Json.parseToJsonElement("""{"editor":"line","title":"Add a person","words":"","hint":"Their phone number, starting with +","keyboard":"phone","writes":{"kind":"people_add"}}""").jsonObject @Test fun the_number_typed_goes_to_the_commit() { var committed: String? = null compose.setContent { val c = androidx.compose.ui.platform.LocalContext.current val (face, mono) = NotesLook.faces(c.assets) OwnWordsLineSheet(NotesCardLook(NotesLook.standing(c, false), face, mono), ask, said = "That number isn't on Cotton yet.", close = "Close", done = "Done", onClose = {}) { committed = it } } compose.onNodeWithTag("words-line-field").performTextInput("+15550190007 ") compose.onNodeWithTag("words-line-done").performClick() assertEquals("+15550190007", committed) compose.onNodeWithTag("words-line-said", useUnmergedTree = true).assertTextEquals("That number isn't on Cotton yet.") } }