Skip to content

Commit 961d88c

Browse files
Merge pull request #64 from frontegg/chore/example-app-frontegg-credentials-and-e2e-review
Use shared Frontegg credentials in example app and add E2E tests review
2 parents 6422b2f + d838554 commit 961d88c

5 files changed

Lines changed: 144 additions & 9 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Runs React Native SDK E2E tests from e2e-system-tests on every PR.
2+
# The check runs in the e2e-system-tests repo and reports back here; merge is blocked until it passes.
3+
# Require this check in branch protection: Settings → Branches → rule → "React Native SDK E2E".
4+
5+
name: React Native SDK E2E
6+
7+
on:
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
react-native-sdk-e2e:
13+
name: React Native SDK E2E
14+
uses: frontegg/e2e-system-tests/.github/workflows/react-native-sdk-e2e-reusable.yml@main
15+
with:
16+
repo_ref: ${{ github.event.pull_request.head.sha }}
17+
test_suite: hosted:no-social
18+
secrets: inherit
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Review: React Native E2E Tests (e2e-system-tests/mobile-sdk)
2+
3+
This document reviews the React Native tests in the **e2e-system-tests** repo (`mobile-sdk/nightwatch/mobile-app-tests/react-native-sdk/`) against the **frontegg-react-native** SDK and its example app.
4+
5+
---
6+
7+
## 1. Overview
8+
9+
| Item | Location / Details |
10+
|------|-------------------|
11+
| **E2E repo** | `e2e-system-tests/mobile-sdk` |
12+
| **App under test** | `frontegg-react-native/example` (iOS & Android) |
13+
| **Framework** | Nightwatch.js + Appium |
14+
| **Environments** | `app.ios.react-native-sdk.hosted`, `app.android.react-native-sdk.hosted` |
15+
16+
The tests assume the example app is built from `frontegg-react-native/example` and that the e2e repo can resolve the app binary via relative paths (`../../frontegg-react-native`, `../frontegg-react-native`, or `frontegg-react-native` from cwd).
17+
18+
---
19+
20+
## 2. Credentials Alignment
21+
22+
- **E2E auth-utils** (`auth-utils.ts`) uses:
23+
- `clientId`: `5f493de4-01c5-4a61-8642-fca650a6a9dc`
24+
- `serviceGateway`: `https://app-x4gr8g28fxr5.frontegg.com`
25+
- **Example app** (after your recent change) uses the same:
26+
- iOS: `Frontegg.plist``baseUrl`, `clientId`
27+
- Android: `build.gradle``fronteggDomain`, `fronteggClientId`
28+
29+
So the e2e suite and the example app are aligned on the same Frontegg app. No change needed in e2e for credentials.
30+
31+
---
32+
33+
## 3. Page Object & Selectors vs Example App
34+
35+
### 3.1 Start page (unauthenticated)
36+
37+
| E2E selector | Example app (HomeScreen) | Notes |
38+
|--------------|-------------------------|--------|
39+
| Login button: `@name="Login"` (iOS) / `@text="Login"` (Android) | `<Button title={…'Logout' : 'Login'} />` | Matches. |
40+
| Title: "React Native Example" | `<Text>React Native Example</Text>` | Matches. |
41+
| "Not Logged in" | `<Text>… state.user ? state.user.email : 'Not Logged in'</Text>` | Matches. |
42+
43+
### 3.2 User page (authenticated)
44+
45+
| E2E selector | Example app (HomeScreen when authenticated) | Notes |
46+
|--------------|---------------------------------------------|--------|
47+
| Logout button | `<Button title="Logout" />` | Matches. |
48+
| Request Authorization button | `<Button title="Request Authorization" />` | Matches. |
49+
| Refresh Token button | `<Button title="Refresh Token" />` | Selector exists in `ReactNativeSDKUserPageSelectors` but there is no `clickRefreshToken()` in the page object (only used if needed later). |
50+
| User email visible | XPath contains email | App shows `state.user.email`; assertion is correct. |
51+
52+
React Native’s default accessibility behavior (button `title` → accessibility name/label) matches the XPath-based selectors. No `testID` or explicit `accessibilityLabel` is required for current coverage.
53+
54+
---
55+
56+
## 4. Test Coverage vs Example App Features
57+
58+
| Example app feature | E2E test coverage | Comment |
59+
|--------------------|--------------------|--------|
60+
| Login (email/password) | Yes — `react-native-sdk-login-test.ts` | Full flow: start → Login → WebView login → user page. |
61+
| Logout | Yes — `react-native-sdk-logout-test.ts` | Login then logout, assert back on start page. |
62+
| Sign up (concept) | Partial — `react-native-sdk-signup-test.ts` | See §5.1. |
63+
| Magic link | Yes — `react-native-sdk-magic-link-test.ts` | Uses MagicLink strategy + Mailosaur. |
64+
| MFA (authenticator) | Yes — `react-native-sdk-mfa-authenticator-test.ts` ||
65+
| MFA (SMS) | Yes — `react-native-sdk-mfa-sms-test.ts` ||
66+
| Password complexity | Yes — `react-native-sdk-login-password-complexity-test.ts` ||
67+
| Step-up / Request Authorization | Yes — `react-native-sdk-step-up-test.ts` | Clicks "Request Authorization", asserts user page. |
68+
| User profile (email/name on screen) | Yes — `react-native-sdk-user-profile-test.ts` | Asserts user info displayed. |
69+
| Tenant switching | Yes — `react-native-sdk-tenant-switching-test.ts` | Asserts "Active Tenant" text; handles case where tenant UI is absent. |
70+
| Social login (e.g. Google) | Yes — `react-native-sdk-social-login-test.ts` ||
71+
| Passkeys (Register / Login with Passkeys) | No | Buttons exist in example app; no dedicated e2e yet. |
72+
| Refresh Token button | No | Selector exists; no test that explicitly uses it. |
73+
74+
So: core auth, MFA, step-up, tenant, and social flows are covered; Passkeys and “Refresh Token” are not.
75+
76+
---
77+
78+
## 5. Findings & Recommendations
79+
80+
### 5.1 Signup test semantics
81+
82+
- **File:** `react-native-sdk-signup-test.ts`
83+
- **Current flow:** `authUtils.createUser()` (API) → launch app → tap Login → in WebView call `iOSLoginPage.login(newUser.email, newUser.password)` / `androidLoginPage.login(...)`.
84+
- So the test exercises “log in with a newly created user,” not the hosted signup UI (no “Sign up” link, no signup form).
85+
- **Recommendation:** Either rename to something like “Newly created user can log in” or extend the test to open the signup flow in the WebView and complete signup there, then assert on the user page.
86+
87+
### 5.2 App path resolution
88+
89+
- **nightwatch.conf.js** resolves the React Native app from:
90+
- `REACT_NATIVE_SDK_HOSTED_IOS_APP_PATH` / `REACT_NATIVE_SDK_HOSTED_ANDROID_APP_PATH`, or
91+
- Relative paths under `frontegg-react-native` (e.g. `example/ios/build/.../ReactNativeExample.app`, `example/android/app/build/outputs/apk/debug/app-debug.apk`).
92+
- If the e2e repo and `frontegg-react-native` are not in the expected relative layout, tests will fail at session start. The README in `mobile-sdk` does not document that the React Native example app must be built and where it must live relative to the e2e repo.
93+
- **Recommendation:** Document in `e2e-system-tests/mobile-sdk/README.md` (or a dedicated React Native section):
94+
- Build the app from `frontegg-react-native/example` (iOS and/or Android).
95+
- Expected relative location of `frontegg-react-native` (e.g. sibling of `e2e-system-tests`) or set `REACT_NATIVE_SDK_HOSTED_*` to absolute paths.
96+
97+
### 5.3 Optional: more stable selectors
98+
99+
- Selectors are text-based (button title / static text). They are correct for the current example app but can break if copy or i18n changes.
100+
- **Recommendation (optional):** In the example app, add `testID` (and optionally `accessibilityLabel`) to key elements (e.g. `Login`, `Logout`, `Request Authorization`), and in e2e use `testID`-based or accessibility selectors where the framework supports it, to reduce fragility.
101+
102+
### 5.4 Unused selector
103+
104+
- `ReactNativeSDKUserPageSelectors.REFRESH_TOKEN_BUTTON_*` is defined but the page object has no `clickRefreshToken()`. No test uses it.
105+
- **Recommendation:** Either add a small test that taps “Refresh Token” and asserts token/state (if useful), or remove the selector to avoid dead code.
106+
107+
### 5.5 Step-up test assertion
108+
109+
- **File:** `react-native-sdk-step-up-test.ts`
110+
- After `clickRequestAuthorize()`, the test only checks that the user page is still loaded. The example app’s `requestAuthorize` can succeed or fail (e.g. 403); the test does not assert on success/failure or any step-up UI.
111+
- **Recommendation:** If step-up behavior is important, consider asserting on a visible outcome (e.g. success message or error) or on a specific screen after authorization, depending on product requirements.
112+
113+
---
114+
115+
## 6. Summary
116+
117+
- **Credentials:** E2E and the example app use the same Frontegg app (`app-x4gr8g28fxr5.frontegg.com`, clientId `5f493de4-01c5-4a61-8642-fca650a6a9dc`). No e2e credential change needed.
118+
- **Selectors:** Aligned with the example app’s HomeScreen (Login/Logout, Request Authorization, title, “Not Logged in”, user email). No breaking mismatch found.
119+
- **Coverage:** Login, logout, magic link, MFA, password complexity, step-up, user profile, tenant switching, and social login are covered; Passkeys and “Refresh Token” are not.
120+
- **Improvements:** Clarify signup test intent or flow (§5.1), document app build and path for React Native (§5.2), optionally add testID/accessibility and use Refresh Token or remove its selector (§5.3–5.4), and optionally tighten step-up assertions (§5.5).

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def enableProguardInReleaseBuilds = false
6868
*/
6969
def jscFlavor = 'org.webkit:android-jsc:+'
7070

71-
def fronteggDomain = "autheu.davidantoon.me"
72-
def fronteggClientId = "b6adfe4c-d695-4c04-b95f-3ec9fd0c6cca"
71+
def fronteggDomain = "app-x4gr8g28fxr5.frontegg.com"
72+
def fronteggClientId = "5f493de4-01c5-4a61-8642-fca650a6a9dc"
7373

7474
android {
7575
ndkVersion rootProject.ext.ndkVersion

example/ios/Frontegg.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<plist version="1.0">
44
<dict>
55
<key>baseUrl</key>
6-
<string>https://autheu.davidantoon.me</string>
6+
<string>https://app-x4gr8g28fxr5.frontegg.com</string>
77
<key>clientId</key>
8-
<string>b6adfe4c-d695-4c04-b95f-3ec9fd0c6cca</string>
8+
<string>5f493de4-01c5-4a61-8642-fca650a6a9dc</string>
99
<key>logLevel</key>
1010
<string>trace</string>
1111
</dict>

example/ios/ReactNativeExample/ReactNativeExample.entitlements

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
<dict>
55
<key>com.apple.developer.associated-domains</key>
66
<array>
7-
<string>webcredentials:autheu.davidantoon.me</string>
8-
<string>applinks:autheu.davidantoon.me</string>
9-
<string>webcredentials:authus.davidantoon.me</string>
10-
<string>webcredentials:davidantoon.me</string>
11-
<string>applinks:authus.davidantoon.me</string>
7+
<string>webcredentials:app-x4gr8g28fxr5.frontegg.com</string>
8+
<string>applinks:app-x4gr8g28fxr5.frontegg.com</string>
129
</array>
1310
</dict>
1411
</plist>

0 commit comments

Comments
 (0)