Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11,800 changes: 10,216 additions & 1,584 deletions apps/flipcash/app/src/release/generated/baselineProfiles/baseline-prof.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,14 @@ class BaselineProfileGenerator {

if (onScanner) {
// Already logged in from a prior iteration
scannerJourney()
discoveryJourney()
walletJourney()
giveJourney()
menuJourney()
authenticatedJourneys()
} else {
val seed = seedPhrase
if (seed.isNullOrBlank()) {
preAuthJourney()
} else {
login(seed)
scannerJourney()
walletJourney()
giveJourney()
menuJourney()
authenticatedJourneys()
}
}
}
Expand Down Expand Up @@ -100,12 +93,74 @@ class BaselineProfileGenerator {
device.waitForIdle()
}

/** All authenticated journeys, run from the scanner. */
private fun MacrobenchmarkScope.authenticatedJourneys() {
scannerJourney()
discoveryJourney()
sendChatJourney()
walletJourney()
giveJourney()
menuJourney()
}

private fun MacrobenchmarkScope.scannerJourney() {
// Scanner is the home screen — let it fully render
device.wait(Until.findObject(By.res("scanner_view")), TIMEOUT)
device.waitForIdle()
}

private fun MacrobenchmarkScope.sendChatJourney() {
// Open the Send tab -> contact list
device.wait(Until.findObject(By.text("Send")), TIMEOUT)?.click()
// Dismiss the "N Contacts Already On Flipcash" info dialog if it appears
device.waitForIdle()
device.findObject(By.text("OK"))?.click()
device.wait(Until.findObject(By.res("send_contact_list")), LOGIN_TIMEOUT)
device.waitForIdle()

// Pull down to reveal the search bar, type random chars (exercises the empty
// search state), then clear it.
device.findObject(By.res("send_contact_list"))?.let { list ->
val b = list.visibleBounds
device.swipe(b.centerX(), b.top + 40, b.centerX(), b.centerY() + 200, 20)
}
device.wait(Until.findObject(By.res("send_search_field")), TIMEOUT)?.click()
device.waitForIdle()
device.executeShellCommand("input text zzqxwv")
device.waitForIdle()
device.findObject(By.res("send_search_clear"))?.click()
device.waitForIdle()
device.pressBack() // dismiss the keyboard

// Open the FIRST contact's chat and send a text message. A message is fund-free
// (money-safety: never tap Send Cash / confirm a spend). Contact is not
// hardcoded — send_contact_row resolves to the first row.
device.wait(Until.findObject(By.res("send_contact_row")), TIMEOUT)?.click()
device.wait(Until.findObject(By.res("chat_screen")), LOGIN_TIMEOUT)
device.waitForIdle()
device.findObject(By.res("chat_send_message_button"))?.click()
device.wait(Until.findObject(By.res("chat_message_input")), TIMEOUT)
device.waitForIdle()
device.executeShellCommand("input text BaselineProfileTest")
device.waitForIdle()
device.findObject(By.res("chat_send_icon"))?.click()
device.waitForIdle()

// Scroll the message list so MessageList / bubble composition gets compiled.
flingScroll("chat_message_list", Direction.DOWN, 2)
flingScroll("chat_message_list", Direction.UP, 2)

// Back to the contact list, fling it for coverage, then back to the scanner.
device.pressBack()
device.wait(Until.findObject(By.res("send_contact_list")), TIMEOUT)
device.waitForIdle()
flingScroll("send_contact_list", Direction.UP, 2)
flingScroll("send_contact_list", Direction.DOWN, 1)
device.pressBack()
device.wait(Until.findObject(By.res("scanner_view")), TIMEOUT)
device.waitForIdle()
}

private fun MacrobenchmarkScope.discoveryJourney() {
// Open the Discover tab from the scanner bottom nav
device.wait(Until.findObject(By.text("Discover")), TIMEOUT)?.click()
Expand Down Expand Up @@ -208,13 +263,25 @@ class BaselineProfileGenerator {
}

private fun MacrobenchmarkScope.giveJourney() {
// Open give/cash screen
device.wait(Until.findObject(By.text("Give")), TIMEOUT)?.click()
device.wait(Until.findObject(By.res("cash_screen")), TIMEOUT)
// Open the Cash tab (the give/cash screen with the amount keypad)
device.wait(Until.findObject(By.text("Cash")), TIMEOUT)?.click()
device.wait(Until.findObject(By.res("keypad_dot")), TIMEOUT)
device.waitForIdle()

// Close sheet
dismissSheet()
// Pull out the smallest bill ($0.01) to warm the keypad + bill rendering, then
// Cancel to put it straight back — a self-reclaiming round-trip (net ~0).
// MONEY-SAFETY: smallest amount, immediate Cancel, never Share/Collect. If an
// iteration dies between Next and Cancel, the app reclaims the un-shared bill on
// the next relaunch.
device.findObject(By.res("keypad_dot"))?.click()
device.findObject(By.res("keypad_0"))?.click()
device.findObject(By.res("keypad_1"))?.click()
device.findObject(By.text("Next"))?.click()
device.wait(Until.findObject(By.res("cash_bill")), LOGIN_TIMEOUT)
device.waitForIdle()
device.findObject(By.text("Cancel"))?.click()
device.wait(Until.findObject(By.res("scanner_view")), TIMEOUT)
device.waitForIdle()
}

private fun MacrobenchmarkScope.menuJourney() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.flipcash.app.core.AppRoute
Expand Down Expand Up @@ -147,7 +148,9 @@ internal fun ContactListScreen() {
.padding(vertical = CodeTheme.dimens.grid.x3),
) {
SearchInput(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.testTag("send_search_field"),
state = state.searchState,
contentPadding = PaddingValues(start = CodeTheme.dimens.grid.x1),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
Expand Down Expand Up @@ -77,6 +78,7 @@ internal fun ContactList(

LazyColumn(
modifier = Modifier
.testTag("send_contact_list")
.verticalScrollStateGradient(
scrollState = listState,
color = CodeTheme.colors.background,
Expand Down Expand Up @@ -324,6 +326,7 @@ private fun ContactRowItem(
Row(
modifier = Modifier
.fillMaxWidth()
.testTag("send_contact_row")
.clickable(onClick = onClick)
.padding(vertical = CodeTheme.dimens.inset)
.padding(end = CodeTheme.dimens.inset),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -95,6 +96,7 @@ internal fun MessengerScreen(viewModel: ChatViewModel) {
MessageList(
modifier = Modifier
.fillMaxSize()
.testTag("chat_message_list")
.hazeSource(hazeState),
state = state,
contentPadding = overlapPadding,
Expand Down Expand Up @@ -274,6 +276,7 @@ private fun UserControlBottomBar(
CodeButton(
modifier = Modifier
.weight(1f)
.testTag("chat_send_message_button")
.hazeEffect(hazeState) {
blurEffect {
style = material
Expand All @@ -289,6 +292,7 @@ private fun UserControlBottomBar(
ChatViewModel.UserState.Typing -> {
ChatInput(
modifier = Modifier
.testTag("chat_message_input")
.fillMaxWidth()
.border(
CodeTheme.dimens.border,
Expand Down Expand Up @@ -348,7 +352,7 @@ private fun ChatInputScaffold(
var topBarHeight by remember { mutableStateOf(0.dp) }
var bottomBarHeight by remember { mutableStateOf(0.dp) }

Box(modifier = Modifier.imePadding()) {
Box(modifier = Modifier.imePadding().testTag("chat_screen")) {
content(
PaddingValues(
top = topBarHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.outlined.Close
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import com.getcode.theme.CodeTheme
import com.getcode.theme.White50
Expand Down Expand Up @@ -41,9 +42,11 @@ fun SearchInput(
trailingIcon = {
if (state.text.isNotEmpty()) {
Icon(
modifier = Modifier.unboundedClickable {
state.clearText()
}.padding(end = CodeTheme.dimens.grid.x3),
modifier = Modifier
.testTag("send_search_clear")
.unboundedClickable {
state.clearText()
}.padding(end = CodeTheme.dimens.grid.x3),
imageVector = Icons.Outlined.Close,
contentDescription = null,
tint = White50,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
Expand Down Expand Up @@ -98,6 +99,7 @@ fun ChatInput(
trailingIcon = {
Icon(
modifier = Modifier
.testTag("chat_send_icon")
.graphicsLayer {
alpha = sendAlpha
scaleX = sendScale
Expand Down
Loading