Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FC] Add livetesting OAuth tests + some Maestro improvements #7514

Merged
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
24 changes: 13 additions & 11 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ stages:
workflows:
- run-connections-e2e-payments-tests: { }
- run-connections-e2e-data-tests: { }
- run-connections-e2e-livemode-tests: { }
stage-notify-connections-e2e-failure:
should_always_run: true
workflows:
Expand Down Expand Up @@ -101,12 +102,17 @@ workflows:
- pipeline_intermediate_files: "$BITRISE_APK_PATH:BITRISE_APK_PATH"
run-connections-e2e-payments-tests:
envs:
- MAESTRO_TAGS: payment
- MAESTRO_TAGS: testmode-payments
before_run:
- _run-connections-e2e-tests
run-connections-e2e-data-tests:
envs:
- MAESTRO_TAGS: data
- MAESTRO_TAGS: testmode-data
before_run:
- _run-connections-e2e-tests
run-connections-e2e-livemode-tests:
envs:
- MAESTRO_TAGS: livemode-data
before_run:
- _run-connections-e2e-tests
_run-connections-e2e-tests:
Expand All @@ -116,22 +122,18 @@ workflows:
after_run:
- conclude_all
steps:
- pull-intermediate-files@1:
inputs:
- artifact_sources: .*
- wait-for-android-emulator@1:
inputs:
- boot_timeout: 600
- pull-intermediate-files@1:
inputs:
- artifact_sources: .*
- script@1:
title: Execute Maestro tests
inputs:
- content: |-
#!/usr/bin/env bash
bash ./scripts/execute_maestro_tests.sh -t $MAESTRO_TAGS
- custom-test-results-export@1:
inputs:
- search_pattern: '*/maestroReport.xml'
- test_name: Maestro tests $MAESTRO_TAGS
bash ./scripts/execute_maestro_tests.sh -t $MAESTRO_TAGS
notify-connections-e2e-failure:
steps:
- slack@4:
Expand Down Expand Up @@ -165,7 +167,7 @@ workflows:
inputs:
- content: |-
#!/usr/bin/env bash
bash ./scripts/execute_maestro_tests.sh -t all
bash ./scripts/execute_maestro_tests.sh -t edge
- slack@3:
is_always_run: true
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand Down Expand Up @@ -141,6 +145,7 @@ class FinancialConnectionsPlaygroundActivity : AppCompatActivity() {
)
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
@Suppress("LongMethod")
private fun PlaygroundContent(
Expand Down Expand Up @@ -173,9 +178,12 @@ class FinancialConnectionsPlaygroundActivity : AppCompatActivity() {
color = Color.Gray
)
Button(
modifier = Modifier
.semantics { testTagsAsResourceId = true }
.testTag("connect_accounts"),
onClick = onButtonClick,
) {
Text("Connect Accounts!")
Text("Connect Accounts")
}
LazyColumn {
items(state.status) { item ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ enum class Merchant(val apiValue: String) {
App2App("app2app"),
Networking("networking"),
NetworkingTestMode("networking_testmode"),
Livetesting("live_testing"),
Other("other");

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
Expand All @@ -43,12 +43,16 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.TextFieldValue
Expand Down Expand Up @@ -319,9 +323,16 @@ private fun SearchInstitutionsList(
}
}
} else {
items(institutions().data, key = { it.id }) { institution ->
InstitutionResultTile({ onInstitutionSelected(it, false) }, institution)
}
itemsIndexed(
items = institutions().data,
key = { _, institution -> institution.id },
itemContent = { index, institution ->
InstitutionResultTile(
institution = institution,
index = index
) { onInstitutionSelected(it, false) }
}
)
if (institutions().showManualEntry == true) {
item {
Divider(
Expand Down Expand Up @@ -413,15 +424,19 @@ private fun ManualEntryRow(onManualEntryClick: () -> Unit) {
}
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun InstitutionResultTile(
onInstitutionSelected: (FinancialConnectionsInstitution) -> Unit,
institution: FinancialConnectionsInstitution
institution: FinancialConnectionsInstitution,
index: Int,
onInstitutionSelected: (FinancialConnectionsInstitution) -> Unit
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxSize()
.semantics { testTagsAsResourceId = true }
.testTag("search_result_$index")
Comment on lines +438 to +439
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes result list clickable by index in tests.

.clickableSingle { onInstitutionSelected(institution) }
.padding(
vertical = 8.dp,
Expand Down
49 changes: 49 additions & 0 deletions maestro/financial-connections/Livemode-Data-Finbank.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- livemode-data
---
- startRecording: /tmp/test_results/livemode-data-finbank
- openLink: stripeconnectionsexample://playground?flow=Data&financial_connections_override_native=native&merchant=live_testing
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
id: "consent_cta"
timeout: 30000
# Common: web AuthFlow - connect OAuth institution
- tapOn: "Agree and continue"
# SEARCH AND SELECT FINBANK INSTITUTION
- tapOn: "Search"
- inputText: "finbank"
- tapOn:
id: "search_result_0"
####### Bypass Chrome on-boarding screen #######
- runFlow:
file: ../common/subflow-skip-chrome-welcome.yaml
# LOG IN WITH TEST FINBANK INSTITUTION
- extendedWaitUntil:
visible:
text: "Image of FinBank logo"
timeout: 30000
- tapOn: "Banking Userid "
- inputText: "f_i_n"
- tapOn: "Banking Password "
- inputText: "b_a_n_k"
- tapOn: "Submit"
###############################################
# SELECT ALL ACCOUNTS
- extendedWaitUntil:
visible: "Select all accounts"
timeout: 60000
- tapOn: "Select all accounts" # select all accounts
- tapOn:
text: "Link accounts"
retryTapIfNoChange: false
# CONFIRM AND COMPLETE
- assertVisible: ".*Success.*"
- tapOn: "Done"
- assertVisible: ".*Completed!.*"
- assertVisible: ".*FinBank.*"
- stopRecording
36 changes: 36 additions & 0 deletions maestro/financial-connections/Livemode-Data-MXBank.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- livemode-data
---
- startRecording: /tmp/test_results/livemode-data-mxbank
- openLink: stripeconnectionsexample://playground?flow=Data&financial_connections_override_native=native&merchant=live_testing
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
id: "consent_cta"
timeout: 30000
# Common: web AuthFlow - connect OAuth institution
- tapOn: "Agree and continue"
# SEARCH AND SELECT FINBANK INSTITUTION
- tapOn: "Search"
- inputText: "mx"
- tapOn:
id: "search_result_1"
- tapOn: "Continue"
####### Bypass Chrome on-boarding screen #######
- runFlow:
file: ../common/subflow-skip-chrome-welcome.yaml
# LOG IN WITH TEST FINBANK INSTITUTION
- tapOn: "Authorize"
###############################################
# SELECT ALL ACCOUNTS
# - Mx bank skips account selection
# CONFIRM AND COMPLETE
- assertVisible: ".*Success.*"
- tapOn: "Done"
- assertVisible: ".*Completed!.*"
- assertVisible: ".*MX Bank.*"
- stopRecording
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- testmode
- native
- data
- edge
- testmode-data
---
- startRecording: /tmp/test_results/testmode-data-testoauthinstitution
- openLink: stripeconnectionsexample://playground?flow=Data&financial_connections_override_native=native&merchant=testmode
- tapOn: "Connect Accounts!"
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- testmode
- native
- payment
- edge
- testmode-payments
---
- startRecording: /tmp/test_results/testmode-paymentintent-testinstitution-networking
- openLink: stripeconnectionsexample://playground?flow=PaymentIntent&financial_connections_override_native=native&merchant=networking_testmode
- tapOn:
id: "Customer email setting"
- inputRandomEmail
- hideKeyboard
- tapOn: "Connect Accounts!"
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
Expand Down Expand Up @@ -48,7 +48,8 @@ tags:
###########################################
# REUSE NEWLY CREATED LINK ACCOUNT
###########################################
- tapOn: "Connect Accounts!"
- tapOn:
id: "connect_accounts"
# Common: web AuthFlow - connect OAuth institution
- extendedWaitUntil:
visible:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- testmode
- native
- payment
- edge
- testmode-payments
---
- startRecording: /tmp/test_results/testmode-paymentintent-testinstitution
- openLink: stripeconnectionsexample://playground?flow=PaymentIntent&financial_connections_override_native=native&merchant=testmode
- tapOn: "Connect Accounts!"
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- testmode
- native
- token
- edge
- testmode-data
---
- startRecording: /tmp/test_results/testmode-token_manualentry
- openLink: stripeconnectionsexample://playground?flow=Token&financial_connections_override_native=native&merchant=testmode
- tapOn: "Connect Accounts!"
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
Expand Down
Loading
Loading