package com.cottondb.messages.warm import android.app.Application import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.performClick import androidx.compose.ui.test.performScrollTo import com.cottondb.shell.core.CottonCore 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 /** * Comms' Help and feedback ends with the privacy policy and the way to reach us, as every app's does (chat/CONTRACT * "Help's two links"; store pass, 24 Nov 2026: Comms drew Share a report alone). Invented answer. */ @RunWith(RobolectricTestRunner::class) @Config(sdk = [35], qualifiers = "w360dp-h800dp-mdpi", application = Application::class) class YouHelpLinksTest { @get:Rule val compose = createComposeRule() @Test fun help_opens_the_privacy_policy_and_the_help_page() { val help = CottonCore.json.parseToJsonElement( """{"title":"Help and feedback","share":{"label":"Share a report","line":"A small text file."}, "links":[{"id":"privacy","label":"Privacy policy","url":"https://cottondb.com/privacy"},{"id":"support","label":"Help and contact","url":"https://cottondb.com/support"}]}""", ).jsonObject val opened = mutableListOf() compose.setContent { WarmTheme(night = false) { HelpPage(help, "Something's wrong", "Back", onShare = {}, onBack = {}, onOpen = { opened += it }) } } compose.onNodeWithTag("settings-link-privacy").performScrollTo().performClick() compose.onNodeWithTag("settings-link-support").performScrollTo().performClick() assertEquals(listOf("https://cottondb.com/privacy", "https://cottondb.com/support"), opened) } }