Skip to content

Commit 1bd37e2

Browse files
committed
Surface PresentPaywall errors in UI, add errorLabel field
- Show errors in a visible errorLabel Text element instead of only Debug.LogError, so Maestro can capture failures in screenshots - Update setup instructions with new ErrorLabel wiring step Made-with: Cursor
1 parent 8f1366e commit 1bd37e2

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

e2e-tests/MaestroTestApp/Assets/Scripts/MaestroTestApp.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class MaestroTestApp : Purchases.UpdatedCustomerInfoListener
99
public GameObject testCasesScreen;
1010
public GameObject purchaseScreen;
1111
public Text entitlementsLabel;
12+
public Text errorLabel;
1213

1314
private Purchases purchases;
1415

@@ -22,6 +23,11 @@ void Start()
2223
purchases.SetLogLevel(Purchases.LogLevel.Verbose);
2324
purchases.listener = this;
2425

26+
if (errorLabel != null)
27+
{
28+
errorLabel.gameObject.SetActive(false);
29+
}
30+
2531
ShowTestCases();
2632
}
2733

@@ -35,18 +41,21 @@ public void ShowPurchaseScreen()
3541
{
3642
testCasesScreen.SetActive(false);
3743
purchaseScreen.SetActive(true);
44+
ClearError();
3845
UpdateEntitlements();
3946
}
4047

4148
public async void PresentPaywall()
4249
{
50+
ClearError();
4351
try
4452
{
4553
await PaywallsPresenter.Present();
4654
}
4755
catch (System.Exception e)
4856
{
4957
Debug.LogError($"Failed to present paywall: {e}");
58+
ShowError(e.Message);
5059
}
5160
}
5261

@@ -74,4 +83,21 @@ private void UpdateEntitlementsFromInfo(CustomerInfo info)
7483
entitlementsLabel.text = "Entitlements: " + (hasPro ? "pro" : "none");
7584
}
7685
}
86+
87+
private void ShowError(string message)
88+
{
89+
if (errorLabel != null)
90+
{
91+
errorLabel.text = "Error: " + message;
92+
errorLabel.gameObject.SetActive(true);
93+
}
94+
}
95+
96+
private void ClearError()
97+
{
98+
if (errorLabel != null)
99+
{
100+
errorLabel.gameObject.SetActive(false);
101+
}
102+
}
77103
}

e2e-tests/MaestroTestApp/setup-instructions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ cannot be created outside the editor.
4343
- Add a child **Button** (UI > Legacy > Button):
4444
- Set the button's child Text to: `Present Paywall`
4545
- On Click: drag the Purchases GameObject, select `MaestroTestApp > PresentPaywall`.
46+
- Add a child **Text** named "ErrorLabel" (UI > Legacy > Text):
47+
- Text content: (leave empty)
48+
- Font size: 14, color red, centered.
49+
- Set it to **inactive** by default.
4650
- Add a child **Button** for back navigation:
4751
- Set the button's child Text to: `Back`
4852
- On Click: drag the Purchases GameObject, select `MaestroTestApp > ShowTestCases`.
@@ -52,6 +56,7 @@ cannot be created outside the editor.
5256
- Drag "TestCasesScreen" to the `testCasesScreen` field.
5357
- Drag "PurchaseScreen" to the `purchaseScreen` field.
5458
- Drag "EntitlementsLabel" Text to the `entitlementsLabel` field.
59+
- Drag "ErrorLabel" Text to the `errorLabel` field.
5560

5661
### 6. Project Settings
5762

0 commit comments

Comments
 (0)