package com.cottondb.storyimport android.app.Applicationimport androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.test.assertCountEqualsimport androidx.compose.ui.test.getBoundsInRootimport androidx.compose.ui.test.junit4.createComposeRuleimport androidx.compose.ui.test.onAllNodesWithTextimport androidx.compose.ui.test.onNodeWithTagimport androidx.compose.ui.test.performClickimport com.cottondb.shell.HelpSectionimport com.cottondb.shell.LocalCardLookimport com.cottondb.shell.core.CottonCoreimport com.cottondb.story.ink.InkCardLookimport com.cottondb.story.ink.WriteToUsimport com.cottondb.story.ink.inkFontsimport kotlinx.serialization.json.jsonObjectimport org.junit.Assert.assertEqualsimport org.junit.Assert.assertTrueimport org.junit.Ruleimport org.junit.Testimport org.junit.runner.RunWithimport org.robolectric.RobolectricTestRunnerimport org.robolectric.annotation.Config/** * Story's Settings says Help and feedback once: Write to us stands under its Share a report. On the emulator (21 Nov * 2026) the page had a "Help and feedback · Write to us" row of its own at the top and the shell's Help and feedback * (Share a report) further down. */@RunWith(RobolectricTestRunner::class)@Config(sdk = [35], qualifiers = "w400dp-h800dp-mdpi", application = Application::class)classStoryHelpOnceTest { @get:Ruleval compose = createComposeRule() @Test fun write_to_us_stands_under_the_one_help_and_feedback() {val help = CottonCore.json.parseToJsonElement("""{"title":"Help and feedback","share":{"label":"Share a report","line":"A small text file for support."}}""", ).jsonObjectvar wrote = 0 compose.setContent {CompositionLocalProvider(LocalCardLook provides InkCardLook(inkFonts(LocalContext.current))) {HelpSection(help, more = { WriteToUs("Write to us") { wrote++ } }) {} } } compose.onAllNodesWithText("Help and feedback").assertCountEquals(1)val section = compose.onNodeWithTag("settings-help").getBoundsInRoot()val share = compose.onNodeWithTag("settings-share-report").getBoundsInRoot()val write = compose.onNodeWithTag("story-settings-help").getBoundsInRoot() assertTrue("Write to us ($write) stands in Help and feedback ($section), under Share a report ($share)", write.top >= share.bottom && write.bottom <= section.bottom) compose.onNodeWithTag("story-settings-help").performClick() compose.runOnIdle { assertEquals(1, wrote) } }}