Skip to content

Commit 7fb7ce4

Browse files
committed
feat: update maestro tests to match iOS V2 paywall flow and add confirm_purchase utility
Update purchase_through_paywall.yaml to assert Paywall V2, tap Yearly/Continue (matching purchases-ios), and add utils/confirm_purchase.yaml with conditional flows for iOS (app_store) and Android (test_store) purchase confirmation. Made-with: Cursor
1 parent 599e3f6 commit 7fb7ce4

File tree

2 files changed

+56
-17
lines changed

2 files changed

+56
-17
lines changed
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# This flow tests the purchase through paywall flow.
2-
# It navigates to the purchase screen, verifies initial entitlements,
3-
# presents the paywall, makes a purchase, and verifies entitlements update.
1+
# This flow requires passing the MAESTRO_STORE environment variable.
2+
# app_store for iOS, test_store for Android.
3+
# Example:
4+
# maestro test -e MAESTRO_STORE=app_store purchase_through_paywall.yaml
45

5-
appId: com.revenuecat.maestro.e2e
6+
appId: com.revenuecat.automatedsdktests
67
name: Purchase through paywall
78

89
---
@@ -22,22 +23,18 @@ name: Purchase through paywall
2223
- assertVisible: "Present Paywall"
2324
- tapOn:
2425
text: "Present Paywall"
25-
# Wait for paywall to load
26-
- extendedWaitUntil:
27-
visible: "Subscribe"
28-
timeout: 30000
26+
- assertVisible: "Paywall V2"
27+
- takeScreenshot: "purchase_through_paywall - Paywall"
2928
- tapOn:
30-
text: "Subscribe"
31-
# Handle StoreKit purchase confirmation on iOS simulator
32-
- extendedWaitUntil:
33-
visible: "OK"
34-
timeout: 15000
35-
- waitForAnimationToEnd
29+
text: "Yearly"
3630
- tapOn:
37-
text: "OK"
38-
# Verify entitlements updated after purchase
31+
text: "Continue"
32+
- runFlow:
33+
file: ../utils/confirm_purchase.yaml
34+
env:
35+
SCREENSHOT_PREFIX: purchase_through_paywall
3936
- extendedWaitUntil:
4037
visible: "Entitlements: pro"
4138
timeout: 15000
4239
- assertVisible: "Entitlements: pro"
43-
- takeScreenshot: "purchase_through_paywall_completed"
40+
- takeScreenshot: "purchase_through_paywall - completed"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This flow requires passing some parameters:
2+
# MAESTRO_STORE environment variable. app_store or test_store.
3+
# SCREENSHOT_PREFIX environment variable. Used to prefix the screenshot name.
4+
# Example:
5+
# maestro test -e MAESTRO_STORE=app_store -e SCREENSHOT_PREFIX=purchase_through_paywall confirm_purchase.yaml
6+
7+
appId: com.revenuecat.automatedsdktests
8+
name: Confirm purchase - handles both IAP Sheet and Test Store Purchase Alert
9+
env:
10+
MAESTRO_STORE: ${MAESTRO_STORE || 'app_store'}
11+
12+
---
13+
# Validate MAESTRO_STORE parameter - fail if invalid
14+
- assertTrue:
15+
condition: ${MAESTRO_STORE == 'app_store' || MAESTRO_STORE == 'test_store'}
16+
label: "MAESTRO_STORE is set to ${MAESTRO_STORE}, but expected app_store or test_store"
17+
18+
# Handle Test Store Purchase Alert flow (Android)
19+
- runFlow:
20+
when:
21+
true: ${MAESTRO_STORE == 'test_store'}
22+
commands:
23+
- takeScreenshot: "${SCREENSHOT_PREFIX} - Test Store Purchase Alert"
24+
- assertVisible: "Test purchase"
25+
- tapOn:
26+
text: "Test valid purchase"
27+
28+
# Handle regular IAP Sheet flow (iOS)
29+
- runFlow:
30+
when:
31+
true: ${MAESTRO_STORE == 'app_store'}
32+
commands:
33+
- takeScreenshot: "${SCREENSHOT_PREFIX} - IAP Sheet"
34+
- tapOn:
35+
text: "Subscribe"
36+
- takeScreenshot: "${SCREENSHOT_PREFIX} - IAP Confirmation"
37+
- extendedWaitUntil:
38+
visible: "OK"
39+
timeout: 15000
40+
- waitForAnimationToEnd
41+
- tapOn:
42+
text: "OK"

0 commit comments

Comments
 (0)