diff --git a/e2e/BITRISE.md b/e2e/BITRISE.md index 55c8372fb..e08cef9cb 100644 --- a/e2e/BITRISE.md +++ b/e2e/BITRISE.md @@ -118,10 +118,15 @@ The `e2e-execute-browserstack-run` workflow fans out one parallel copy per Brows These secrets are configured in Bitrise.io; they cannot live in the repository. `scripts/setup_storefront_env` reads them to configure the sample app before builds. -| Secret | Purpose | -| ------------------------- | ---------------------------------------------- | -| `STOREFRONT_DOMAIN` | Storefront domain for sample app builds. | -| `STOREFRONT_ACCESS_TOKEN` | Storefront access token for sample app builds. | +| Secret | Purpose | +| --------------------------------------------- | --------------------------------------------------------- | +| `STOREFRONT_DOMAIN` | Storefront domain for sample app builds. | +| `STOREFRONT_ACCESS_TOKEN` | Storefront access token for sample app builds. | +| `SWIFT_APPLE_PAY_MERCHANT_IDENTIFIER` | Apple Pay entitlement for the Swift E2E application. | + +Expose these secrets to pull-request builds. The Swift build fails before Xcode +when the generated merchant identifier is missing or blank, and never prints its +configured value. ## BrowserStack secrets diff --git a/e2e/config/matrix.yml b/e2e/config/matrix.yml index 739f4363b..9cdad4001 100644 --- a/e2e/config/matrix.yml +++ b/e2e/config/matrix.yml @@ -59,6 +59,12 @@ applications: app_id: com.shopify.checkoutkit.swiftdemo artifact_env: E2E_SWIFT_IOS_APP_PATH ready_marker: checkout-kit-sample-ready + # This provisioned app carries the Apple Pay entitlement and is checked for a + # nonblank merchant identifier before it is built. + exclude_tags: + - flaky + - wip + - full changed_files_filters: - swift - protocolSwift diff --git a/e2e/scripts/build_swift_ios b/e2e/scripts/build_swift_ios index ec0c65733..ef5182964 100755 --- a/e2e/scripts/build_swift_ios +++ b/e2e/scripts/build_swift_ios @@ -7,6 +7,7 @@ source "$script_dir/bitrise_ci_helpers" source "$script_dir/ios_build_helpers" e2e_configure_storefront +"$script_dir/check_swift_apple_pay_config" e2e_log "Generating Swift sample Xcode projects" platforms/swift/Scripts/generate_xcode_projects diff --git a/e2e/test/check_swift_apple_pay_config_test.rb b/e2e/test/check_swift_apple_pay_config_test.rb index ef0d62459..552fd6d3c 100644 --- a/e2e/test/check_swift_apple_pay_config_test.rb +++ b/e2e/test/check_swift_apple_pay_config_test.rb @@ -7,6 +7,7 @@ class CheckSwiftApplePayConfigTest < Minitest::Test REPO_ROOT = File.expand_path("../..", __dir__) SCRIPT = File.join(REPO_ROOT, "e2e", "scripts", "check_swift_apple_pay_config") + BUILD_SCRIPT = File.join(REPO_ROOT, "e2e", "scripts", "build_swift_ios") SYNTHETIC_IDENTIFIER = "merchant.com.example.e2e" def test_script_is_executable_bash @@ -59,6 +60,19 @@ def test_nonblank_assignment_succeeds_without_printing_the_value end end + def test_bitrise_swift_build_checks_config_after_generating_it + script = File.read(BUILD_SCRIPT) + configure_index = script.index("e2e_configure_storefront") + check_index = script.index('"$script_dir/check_swift_apple_pay_config"') + xcodegen_index = script.index("platforms/swift/Scripts/generate_xcode_projects") + + refute_nil configure_index + refute_nil check_index + refute_nil xcodegen_index + assert_operator configure_index, :<, check_index + assert_operator check_index, :<, xcodegen_index + end + private def with_config(contents) diff --git a/e2e/test/e2e_matrix_to_browserstack_run_plan_test.rb b/e2e/test/e2e_matrix_to_browserstack_run_plan_test.rb index c599268ab..00e8afabc 100644 --- a/e2e/test/e2e_matrix_to_browserstack_run_plan_test.rb +++ b/e2e/test/e2e_matrix_to_browserstack_run_plan_test.rb @@ -48,13 +48,17 @@ def test_runs_carry_default_tags_and_the_other_platform_exclusion android_run = run_for("kotlin-android") assert_equal ["launch", "checkout"], ios_run.fetch("include_tags") - assert_equal ["flaky", "wip", "full", "apple-pay", "android-only"], ios_run.fetch("exclude_tags") + assert_equal ["flaky", "wip", "full", "android-only"], ios_run.fetch("exclude_tags") assert_equal ["flaky", "wip", "full", "apple-pay", "ios-only"], android_run.fetch("exclude_tags") end - def test_apple_pay_is_excluded_from_every_application_by_default + def test_only_the_swift_ios_application_allows_apple_pay plan.expand.each do |run| - assert_includes run.fetch("exclude_tags"), "apple-pay", run.fetch("application_id") + if run.fetch("application_id") == "swift-ios" + refute_includes run.fetch("exclude_tags"), "apple-pay" + else + assert_includes run.fetch("exclude_tags"), "apple-pay", run.fetch("application_id") + end end end