diff --git a/bitrise.yml b/bitrise.yml index 8e52c89c3a7..08b8dcd4fcb 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -35,6 +35,7 @@ stages: - run-example-instrumentation-tests: { } - run-financial-connections-instrumentation-tests: { } - run-connections-e2e-payments-tests-on-push: { } + - run-connections-e2e-token-tests-on-push: { } - run-connections-e2e-data-tests-on-push: { } - run-cardscan-instrumentation-tests: { } - run-paymentsheet-end-to-end-tests: { } @@ -50,6 +51,7 @@ stages: workflows: - run-connections-e2e-payments-tests: { } - run-connections-e2e-data-tests: { } + - run-connections-e2e-token-tests: { } - run-connections-e2e-livemode-tests: { } stage-notify-connections-e2e-failure: should_always_run: true @@ -115,6 +117,11 @@ workflows: - MAESTRO_TAGS: testmode-data before_run: - _run-connections-e2e-tests + run-connections-e2e-token-tests: + envs: + - MAESTRO_TAGS: testmode-token + before_run: + - _run-connections-e2e-tests run-connections-e2e-payments-tests-on-push: envs: - MAESTRO_TAGS: testmode-payments @@ -127,6 +134,12 @@ workflows: before_run: - _build-connections - _run-connections-e2e-tests + run-connections-e2e-token-tests-on-push: + envs: + - MAESTRO_TAGS: testmode-token + before_run: + - _build-connections + - _run-connections-e2e-tests run-connections-e2e-livemode-tests: envs: - MAESTRO_TAGS: livemode-data diff --git a/maestro/financial-connections/Testmode-Token-ManualEntry.yaml b/maestro/financial-connections/Testmode-Token-ManualEntry.yaml index e3d9c635162..9489c763cb3 100644 --- a/maestro/financial-connections/Testmode-Token-ManualEntry.yaml +++ b/maestro/financial-connections/Testmode-Token-ManualEntry.yaml @@ -2,7 +2,7 @@ appId: com.stripe.android.financialconnections.example tags: - all - edge - - testmode-data + - testmode-token --- - startRecording: ${'/tmp/test_results/testmode-token_manualentry-' + new Date().getTime()} - clearState diff --git a/maestro/financial-connections/Testmode-Token-NME.yaml b/maestro/financial-connections/Testmode-Token-NME.yaml new file mode 100644 index 00000000000..1ecbab61f63 --- /dev/null +++ b/maestro/financial-connections/Testmode-Token-NME.yaml @@ -0,0 +1,68 @@ +## +## This tests Networks a manually entered account +## and reuses the same account on the bank account token flow. +## +appId: com.stripe.android.financialconnections.example +tags: + - all + - testmode-token +--- +- startRecording: ${'/tmp/test_results/testmode-nme-' + new Date().getTime()} +- clearState +- openLink: stripeconnectionsexample://playground?experience=FinancialConnections&flow=Token&financial_connections_override_native=native&merchant=networking&financial_connections_test_mode=true&permissions=payment_method&financial_connections_confirm_intent=true +- tapOn: + id: "Customer email setting" +- inputRandomEmail +- hideKeyboard +- tapOn: + id: "connect_accounts" +# Wait until the consent button is visible +- extendedWaitUntil: + visible: + id: "consent_cta" + timeout: 30000 +# Navigate to manual entry +- tapOn: + # Maestro does not yet support tapping on annotated strings. + # https://github.com/mobile-dev-inc/maestro/issues/389 + point: "50%,93%" +- tapOn: "Use test account" +## ENTER PHONE FOR NEW NETWORKED USER +- waitForAnimationToEnd +- scrollUntilVisible: + element: + text: ".*555.*" # wait for placeholder to be visible +- inputText: "6223115555" +- tapOn: "Save with Link" +# CONFIRM AND COMPLETE +- tapOn: + id: "done_button" +- assertVisible: ".*Completed!.*" +############################################ +## REUSE NEWLY CREATED NME ACCOUNT +############################################ +- tapOn: + id: "connect_accounts" +# Common: web AuthFlow - connect OAuth institution +- extendedWaitUntil: + visible: + id: "consent_cta" + timeout: 30000 +- tapOn: + id: "consent_cta" +## LOGIN TO NETWORKING +- tapOn: + id: "existing_email-button" +## 2FA +- assertVisible: + id: "OTP-0" +- inputText: "111111" +## SELECT NETWORKED ACCOUNT +# First institution should be auto selected. +- tapOn: "Connect account" +# CONFIRM AND COMPLETE +- tapOn: + id: "done_button" +- scrollUntilVisible: + element: + text: ".*Completed.*" \ No newline at end of file diff --git a/scripts/execute_maestro_tests.sh b/scripts/execute_maestro_tests.sh index f1cadc7f795..17dd8c37f84 100644 --- a/scripts/execute_maestro_tests.sh +++ b/scripts/execute_maestro_tests.sh @@ -22,7 +22,10 @@ then exit 1 fi -export MAESTRO_VERSION=1.36.0 +echo "test_environment: $test_environment" +echo "MAESTRO_TAGS: $MAESTRO_TAGS" + +export MAESTRO_VERSION=1.38.1 # Retry mechanism for Maestro installation MAX_RETRIES=5 @@ -47,6 +50,13 @@ fi # install APK. adb install $BITRISE_APK_PATH +# Function to check if a YAML file contains a specific tag +contains_tag() { + local file="$1" + local tag="$2" + awk '/tags:/,/---/' "$file" | grep -q "$tag" +} + TEST_DIR_PATH=maestro/financial-connections TEST_RESULTS_PATH=/tmp/test_results RETRY_COUNT=0 @@ -55,19 +65,24 @@ RETRY_COUNT=0 mkdir -p $TEST_RESULTS_PATH for TEST_FILE_PATH in "$TEST_DIR_PATH"/*.yaml; do - # Check if tags are present in the test file - if awk '/tags:/,/---/' "$TEST_FILE_PATH" | grep -q "$MAESTRO_TAGS"; then - # Execute Maestro test flow and retries if failed. - while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do - maestro test -e APP_ID=com.stripe.android.financialconnections.example --format junit --output $TEST_FILE_PATH.xml "$TEST_FILE_PATH" && break - let RETRY_COUNT=RETRY_COUNT+1 - echo "Maestro test attempt $RETRY_COUNT failed. Retrying..." - done - if [ "$RETRY_COUNT" -eq "$MAX_RETRIES" ]; then - echo "Maestro tests failed after $MAX_RETRIES attempts." - exit 1 - else - RETRY_COUNT=0 - fi + # Check if MAESTRO_TAGS are present in the test file + if contains_tag "$TEST_FILE_PATH" "$MAESTRO_TAGS"; then + # Just run the test if it's tagged as edge, if on an edge environment + if [ "$test_environment" != "edge" ] || contains_tag "$TEST_FILE_PATH" "edge"; then + # Execute Maestro test flow and retry if failed + while [ "$RETRY_COUNT" -lt "$MAX_RETRIES" ]; do + maestro test -e APP_ID=com.stripe.android.financialconnections.example --format junit --output $TEST_RESULTS_PATH/$(basename "$TEST_FILE_PATH").xml "$TEST_FILE_PATH" && break + let RETRY_COUNT=RETRY_COUNT+1 + echo "Maestro test attempt $RETRY_COUNT failed. Retrying..." + done + if [ "$RETRY_COUNT" -eq "$MAX_RETRIES" ]; then + echo "Maestro tests failed after $MAX_RETRIES attempts." + exit 1 + else + RETRY_COUNT=0 + fi + else + echo "Skipping test file without 'edge' tag: $TEST_FILE_PATH" fi + fi done