Skip to content

Commit

Permalink
Adds a test for form activity respecting primary button label. (#10221)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaynewstrom-stripe authored Feb 19, 2025
1 parent 10a1019 commit eb2329b
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package com.stripe.android.paymentelement.embedded.form

import android.app.Application
import android.os.Bundle
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.hasParent
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.lifecycle.Lifecycle
import androidx.test.core.app.ActivityScenario
Expand Down Expand Up @@ -67,6 +69,16 @@ internal class FormActivityTest {
primaryButton.assertIsEnabled()
}

@Test
fun `Primary button label is correctly applied`() = launch(
configuration = EmbeddedPaymentElement.Configuration
.Builder("Example, Inc.")
.primaryButtonLabel("Hi mom")
.build()
) {
primaryButton.assert(hasText("Hi mom"))
}

private fun launch(
selectedPaymentMethodCode: PaymentMethodCode = "card",
paymentMethodMetadata: PaymentMethodMetadata = PaymentMethodMetadataFactory.create(),
Expand Down

0 comments on commit eb2329b

Please sign in to comment.