-
Notifications
You must be signed in to change notification settings - Fork 110
Add maestro E2E test app #1635
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
Merged
Merged
Add maestro E2E test app #1635
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
f8ce9f7
feat: add maestro E2E test app
ajpallares 5cda4d6
fix: add iOS native project files for MaestroTestApp
ajpallares 218eefe
fix: add empty yarn.lock for standalone MaestroTestApp project
ajpallares 18d9a41
fix: pin react-native-screens to ~4.4.0 for RN 0.76 compat
ajpallares ef166de
fix: update MaestroTestApp .gitignore to match repo conventions
ajpallares 0102aa8
fix: convert MaestroTestApp iOS to Swift AppDelegate
ajpallares 73da28c
feat: add StoreKit configuration for iOS maestro E2E tests
ajpallares 2a5d507
fix: add StoreKit config to Xcode project file references
ajpallares 22530ca
fix: restore correct scheme identifier path for StoreKit config
ajpallares a231be2
fix: update bundle identifier to com.revenuecat.automatedsdktests
ajpallares 5547354
fix: use correct StoreKit configuration from purchases-ios maestro app
ajpallares 7d5ac03
fix: use removeCustomerInfoUpdateListener instead of listener.remove()
ajpallares f5276e7
fix: commit resolved yarn.lock for MaestroTestApp
ajpallares 8234eb8
feat: add Android project for MaestroTestApp
ajpallares 9c43d51
chore: remove StoreKit configuration file (using test store instead)
ajpallares 75986fa
Improve Maestro test app: local deps, error handling, types, README
ajpallares 57b3bf3
Use workspace + module-resolver for local deps, surface errors in UI,…
ajpallares e9d206f
Add error handling to getCustomerInfo, use blockList, regenerate Podf…
ajpallares 86a3b0b
Refresh Podfile.lock (hermes-engine 0.76.6 → 0.76.9)
ajpallares dd68b80
Add react-native.config.js for native module auto-linking
ajpallares 666833f
Add native module includes to Android settings.gradle
ajpallares e078ea8
Upgrade MaestroTestApp to React Native 0.78 and align Android toolchain
ajpallares 501ef9f
Pin react-native-screens to ~4.11.0 and refresh lockfiles
ajpallares d61badc
Update root yarn.lock for react-native-screens ~4.11.0 pin
ajpallares cf0ccbc
Add @react-native-community/cli to MaestroTestApp devDependencies
ajpallares 1a554ee
fix: make MaestroTestApp CI-ready with embedded JS bundle
ajpallares c91d3d7
fix: add fatalError for missing jsbundle and document SDK resolution
ajpallares 87e8ba3
fix: don't commit Podfile.lock for MaestroTestApp
ajpallares 82fa025
fix: re-commit Podfile.lock for MaestroTestApp
ajpallares 79ca5af
fix: remove stale MaestroTestApp/yarn.lock
ajpallares 795e8a7
fix: pin react-native to 0.78.3 for Xcode 26.4 compatibility
ajpallares 6fc2caa
fix: bump react-native to 0.78.3 for Xcode 26.4 compatibility
ajpallares 2bd0cb0
revert: undo Podfile.lock re-commitment and react-native version bumps
ajpallares 8867ce7
chore: add MaestroTestApp pod install to bootstrap script
ajpallares 2f04c19
fix: regenerate yarn.lock from main with MaestroTestApp workspace
ajpallares b19bac4
Merge branch 'main' into e2e-tests-app
ajpallares File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # OSX | ||
| .DS_Store | ||
|
|
||
| # Xcode | ||
| build/ | ||
| *.pbxuser | ||
| !default.pbxuser | ||
| *.mode1v3 | ||
| !default.mode1v3 | ||
| *.mode2v3 | ||
| !default.mode2v3 | ||
| *.perspectivev3 | ||
| !default.perspectivev3 | ||
| xcuserdata | ||
| *.xccheckout | ||
| *.moved-aside | ||
| DerivedData | ||
| *.hmap | ||
| *.ipa | ||
| *.xcuserstate | ||
| **/.xcode.env.local | ||
|
|
||
| # Android/IntelliJ | ||
| .idea | ||
| .gradle | ||
| local.properties | ||
| *.iml | ||
| *.hprof | ||
| .cxx/ | ||
| *.keystore | ||
| !debug.keystore | ||
|
|
||
| # node.js | ||
| node_modules/ | ||
| npm-debug.log | ||
| yarn-error.log | ||
|
|
||
| # Ruby / CocoaPods | ||
| **/Pods/ | ||
| Podfile.lock | ||
| /vendor/bundle/ | ||
|
|
||
| # Bundle artifact | ||
| *.jsbundle | ||
|
|
||
| # Temporary files created by Metro to check the health of the file watcher | ||
| .metro-health-check* | ||
|
|
||
| # Yarn | ||
| .yarn/* | ||
| !.yarn/patches | ||
| !.yarn/plugins | ||
| !.yarn/releases | ||
| !.yarn/sdks | ||
| !.yarn/versions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import React, {useEffect} from 'react'; | ||
| import {NavigationContainer} from '@react-navigation/native'; | ||
| import {createNativeStackNavigator} from '@react-navigation/native-stack'; | ||
| import Purchases from 'react-native-purchases'; | ||
| import TestCasesScreen from './src/TestCasesScreen'; | ||
| import PurchaseThroughPaywallScreen from './src/PurchaseThroughPaywallScreen'; | ||
|
|
||
| export type RootStackParamList = { | ||
| TestCases: undefined; | ||
| PurchaseThroughPaywall: undefined; | ||
| }; | ||
|
|
||
| const Stack = createNativeStackNavigator<RootStackParamList>(); | ||
|
|
||
| const API_KEY = 'MAESTRO_TESTS_REVENUECAT_API_KEY'; | ||
|
|
||
| export default function App() { | ||
| useEffect(() => { | ||
| Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG); | ||
| Purchases.configure({apiKey: API_KEY}); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <NavigationContainer> | ||
| <Stack.Navigator> | ||
| <Stack.Screen | ||
| name="TestCases" | ||
| component={TestCasesScreen} | ||
| options={{title: 'Test Cases'}} | ||
| /> | ||
| <Stack.Screen | ||
| name="PurchaseThroughPaywall" | ||
| component={PurchaseThroughPaywallScreen} | ||
| options={{title: 'Purchase through paywall'}} | ||
| /> | ||
| </Stack.Navigator> | ||
| </NavigationContainer> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Maestro E2E Test App | ||
|
|
||
| A minimal React Native app used by Maestro end-to-end tests to verify RevenueCat SDK integration. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Node.js & Yarn | ||
| - Xcode (iOS) / Android Studio (Android) | ||
| - [Maestro](https://maestro.mobile.dev/) CLI | ||
| - CocoaPods (`gem install cocoapods`) | ||
|
|
||
| ## Setup | ||
|
|
||
| ```bash | ||
| yarn install | ||
| cd ios && pod install && cd .. | ||
| ``` | ||
|
|
||
| ## Running Locally | ||
|
|
||
| ```bash | ||
| # iOS | ||
| yarn ios | ||
|
|
||
| # Android | ||
| yarn android | ||
| ``` | ||
|
|
||
| ## API Key | ||
|
|
||
| The app initialises RevenueCat with the placeholder `MAESTRO_TESTS_REVENUECAT_API_KEY`. | ||
| In CI, the Fastlane lane replaces this placeholder with the real key from the | ||
| `RC_E2E_TEST_API_KEY_PRODUCTION_TEST_STORE` environment variable (provided by the | ||
| CircleCI `e2e-tests` context) before building. | ||
|
|
||
| To run locally, either: | ||
| - Replace the placeholder in `App.tsx` with a valid API key (do **not** commit it), or | ||
| - Export the env var and run the same `sed` command the Fastlane lane uses. | ||
|
|
||
| ## RevenueCat Project | ||
|
|
||
| The test uses a RevenueCat project configured with: | ||
| - A **V2 Paywall** (the test asserts "Paywall V2" is visible) | ||
| - A `pro` entitlement (the test checks entitlement status after purchase) | ||
| - The **Test Store** environment for purchase confirmation | ||
|
|
||
| ## Dependencies | ||
|
|
||
| This app is part of the `react-native-purchases` Yarn workspace. It uses the same | ||
| local dependency mechanism as `examples/purchaseTesterTypescript`: | ||
| - **Babel module-resolver** aliases `react-native-purchases` and | ||
| `react-native-purchases-ui` imports to the SDK source directories | ||
| - **Metro watchFolders** allows the bundler to access files outside the app's | ||
| project root | ||
| - **Metro exclusionList** prevents duplicate peer dependency resolution between | ||
| the app and the SDK's own `node_modules` | ||
|
|
||
| This ensures E2E tests always exercise the code on the current branch, not a | ||
| published npm version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| apply plugin: "com.android.application" | ||
| apply plugin: "org.jetbrains.kotlin.android" | ||
| apply plugin: "com.facebook.react" | ||
|
|
||
| /** | ||
| * This is the configuration block to customize your React Native Android app. | ||
| * By default you don't need to apply any configuration, just uncomment the lines you need. | ||
| */ | ||
| react { | ||
| /* Folders */ | ||
| // The root of your project, i.e. where "package.json" lives. Default is '../..' | ||
| // root = file("../../") | ||
| // The folder where the react-native NPM package is. Default is ../../node_modules/react-native | ||
| // reactNativeDir = file("../../node_modules/react-native") | ||
| // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen | ||
| // codegenDir = file("../../node_modules/@react-native/codegen") | ||
| // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js | ||
| // cliFile = file("../../node_modules/react-native/cli.js") | ||
|
|
||
| /* Variants */ | ||
| // The list of variants to that are debuggable. For those we're going to | ||
| // skip the bundling of the JS bundle and the assets. By default is just 'debug'. | ||
| // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. | ||
| // Force JS bundling in debug builds (no Metro dev server on CI) | ||
| debuggableVariants = [] | ||
|
|
||
| /* Bundling */ | ||
| // A list containing the node command and its flags. Default is just 'node'. | ||
| // nodeExecutableAndArgs = ["node"] | ||
| // | ||
| // The command to run when bundling. By default is 'bundle' | ||
| // bundleCommand = "ram-bundle" | ||
| // | ||
| // The path to the CLI configuration file. Default is empty. | ||
| // bundleConfig = file(../rn-cli.config.js) | ||
| // | ||
| // The name of the generated asset file containing your JS bundle | ||
| // bundleAssetName = "MyApplication.android.bundle" | ||
| // | ||
| // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' | ||
| // entryFile = file("../js/MyApplication.android.js") | ||
| // | ||
| // A list of extra flags to pass to the 'bundle' commands. | ||
| // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle | ||
| // extraPackagerArgs = [] | ||
|
|
||
| /* Hermes Commands */ | ||
| // The hermes compiler command to run. By default it is 'hermesc' | ||
| // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" | ||
| // | ||
| // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" | ||
| // hermesFlags = ["-O", "-output-source-map"] | ||
|
|
||
| /* Autolinking */ | ||
| autolinkLibrariesWithApp() | ||
| } | ||
|
|
||
| /** | ||
| * Set this to true to Run Proguard on Release builds to minify the Java bytecode. | ||
| */ | ||
| def enableProguardInReleaseBuilds = false | ||
|
|
||
| /** | ||
| * The preferred build flavor of JavaScriptCore (JSC) | ||
| * | ||
| * For example, to use the international variant, you can use: | ||
| * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` | ||
| * | ||
| * The international variant includes ICU i18n library and necessary data | ||
| * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that | ||
| * give correct results when using with locales other than en-US. Note that | ||
| * this variant is about 6MiB larger per architecture than default. | ||
| */ | ||
| def jscFlavor = 'org.webkit:android-jsc:+' | ||
|
|
||
| android { | ||
| ndkVersion rootProject.ext.ndkVersion | ||
| buildToolsVersion rootProject.ext.buildToolsVersion | ||
| compileSdk rootProject.ext.compileSdkVersion | ||
|
|
||
| namespace "com.revenuecat.automatedsdktests" | ||
| defaultConfig { | ||
| applicationId "com.revenuecat.automatedsdktests" | ||
| minSdkVersion rootProject.ext.minSdkVersion | ||
| targetSdkVersion rootProject.ext.targetSdkVersion | ||
| versionCode 1 | ||
| versionName "1.0" | ||
| } | ||
| signingConfigs { | ||
| debug { | ||
| storeFile file('debug.keystore') | ||
| storePassword 'android' | ||
| keyAlias 'androiddebugkey' | ||
| keyPassword 'android' | ||
| } | ||
| } | ||
| buildTypes { | ||
| debug { | ||
| signingConfig signingConfigs.debug | ||
| } | ||
| release { | ||
| // Caution! In production, you need to generate your own keystore file. | ||
| // see https://reactnative.dev/docs/signed-apk-android. | ||
| signingConfig signingConfigs.debug | ||
| minifyEnabled enableProguardInReleaseBuilds | ||
| proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| // The version of react-native is set by the React Native Gradle Plugin | ||
| implementation("com.facebook.react:react-android") | ||
|
|
||
| if (hermesEnabled.toBoolean()) { | ||
| implementation("com.facebook.react:hermes-android") | ||
| } else { | ||
| implementation jscFlavor | ||
| } | ||
| } | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Add project specific ProGuard rules here. | ||
| # By default, the flags in this file are appended to flags specified | ||
| # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt | ||
| # You can edit the include path and order by changing the proguardFiles | ||
| # directive in build.gradle. | ||
| # | ||
| # For more details, see | ||
| # http://developer.android.com/guide/developing/tools/proguard.html | ||
|
|
||
| # Add any project specific keep options here: |
9 changes: 9 additions & 0 deletions
9
e2e-tests/MaestroTestApp/android/app/src/debug/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:tools="http://schemas.android.com/tools"> | ||
|
|
||
| <application | ||
| android:usesCleartextTraffic="true" | ||
| tools:targetApi="28" | ||
| tools:ignore="GoogleAppIndexingWarning"/> | ||
| </manifest> |
26 changes: 26 additions & 0 deletions
26
e2e-tests/MaestroTestApp/android/app/src/main/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
|
|
||
| <application | ||
| android:name=".MainApplication" | ||
| android:label="@string/app_name" | ||
| android:icon="@mipmap/ic_launcher" | ||
| android:roundIcon="@mipmap/ic_launcher_round" | ||
| android:allowBackup="false" | ||
| android:theme="@style/AppTheme" | ||
| android:supportsRtl="true"> | ||
| <activity | ||
| android:name=".MainActivity" | ||
| android:label="@string/app_name" | ||
| android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" | ||
| android:launchMode="singleTask" | ||
| android:windowSoftInputMode="adjustResize" | ||
| android:exported="true"> | ||
| <intent-filter> | ||
| <action android:name="android.intent.action.MAIN" /> | ||
| <category android:name="android.intent.category.LAUNCHER" /> | ||
| </intent-filter> | ||
| </activity> | ||
| </application> | ||
| </manifest> |
22 changes: 22 additions & 0 deletions
22
...MaestroTestApp/android/app/src/main/java/com/revenuecat/automatedsdktests/MainActivity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.revenuecat.automatedsdktests | ||
|
|
||
| import com.facebook.react.ReactActivity | ||
| import com.facebook.react.ReactActivityDelegate | ||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled | ||
| import com.facebook.react.defaults.DefaultReactActivityDelegate | ||
|
|
||
| class MainActivity : ReactActivity() { | ||
|
|
||
| /** | ||
| * Returns the name of the main component registered from JavaScript. This is used to schedule | ||
| * rendering of the component. | ||
| */ | ||
| override fun getMainComponentName(): String = "MaestroTestApp" | ||
|
|
||
| /** | ||
| * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] | ||
| * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] | ||
| */ | ||
| override fun createReactActivityDelegate(): ReactActivityDelegate = | ||
| DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) | ||
| } |
44 changes: 44 additions & 0 deletions
44
...stroTestApp/android/app/src/main/java/com/revenuecat/automatedsdktests/MainApplication.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package com.revenuecat.automatedsdktests | ||
|
|
||
| import android.app.Application | ||
| import com.facebook.react.PackageList | ||
| import com.facebook.react.ReactApplication | ||
| import com.facebook.react.ReactHost | ||
| import com.facebook.react.ReactNativeHost | ||
| import com.facebook.react.ReactPackage | ||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load | ||
| import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost | ||
| import com.facebook.react.defaults.DefaultReactNativeHost | ||
| import com.facebook.react.soloader.OpenSourceMergedSoMapping | ||
| import com.facebook.soloader.SoLoader | ||
|
|
||
| class MainApplication : Application(), ReactApplication { | ||
|
|
||
| override val reactNativeHost: ReactNativeHost = | ||
| object : DefaultReactNativeHost(this) { | ||
| override fun getPackages(): List<ReactPackage> = | ||
| PackageList(this).packages.apply { | ||
| // Packages that cannot be autolinked yet can be added manually here, for example: | ||
| // add(MyReactNativePackage()) | ||
| } | ||
|
|
||
| override fun getJSMainModuleName(): String = "index" | ||
|
|
||
| override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG | ||
|
|
||
| override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED | ||
| override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED | ||
| } | ||
|
|
||
| override val reactHost: ReactHost | ||
| get() = getDefaultReactHost(applicationContext, reactNativeHost) | ||
|
|
||
| override fun onCreate() { | ||
| super.onCreate() | ||
| SoLoader.init(this, OpenSourceMergedSoMapping) | ||
| if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { | ||
| // If you opted-in for the New Architecture, we load the native entry point for this app. | ||
| load() | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.