Skip to content

Commit 72a9823

Browse files
ci(e2e/ios): Debug build with embedded JS + mock web-auth transport for social test
Release embeds the JS bundle but disables the SDK's mock web-auth transport (FronteggRuntime.allowsTestingWebAuthenticationTransport is #if DEBUG), so the Google social-login smoke test hit a real ASWebAuthenticationSession that can't complete headlessly in CI. Switch back to a Debug build (mock transport available) and make the app self-contained without Metro: - build with FORCE_BUNDLING=1 so the Debug app embeds main.jsbundle - AppDelegate loads the embedded bundle under test (frontegg-testing=true) - launchApp gains a useTestingWebAuthenticationTransport flag - LoginViaGoogleTest launches with the mock transport so the social flow completes against the local mock server instead of a real Safari VC Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 11c66e2 commit 72a9823

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/react-native-sdk-e2e.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ jobs:
188188
build-for-testing \
189189
-workspace ReactNativeExample.xcworkspace \
190190
-scheme ReactNativeExample \
191-
-configuration Release \
192191
-destination "platform=iOS Simulator,name=iPhone 16" \
193192
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
194193
CODE_SIGNING_ALLOWED=NO \
194+
FORCE_BUNDLING=1 \
195195
2>&1 | tee "$RUNNER_TEMP/build.log"
196196
197197
- name: Run UI tests
@@ -202,7 +202,6 @@ jobs:
202202
test-without-building \
203203
-workspace ReactNativeExample.xcworkspace \
204204
-scheme ReactNativeExample \
205-
-configuration Release \
206205
-only-testing:ReactNativeExampleUITests \
207206
-destination "platform=iOS Simulator,name=iPhone 16" \
208207
-derivedDataPath "$RUNNER_TEMP/DerivedData" \

example/ios/ReactNativeExample/AppDelegate.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull N
4949
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
5050
{
5151
#if DEBUG
52+
// Under E2E tests the JS bundle is embedded (FORCE_BUNDLING) and Metro is not running,
53+
// while the SDK's mock web-auth transport requires a DEBUG build. So in a testing launch
54+
// prefer the embedded bundle; fall back to Metro for normal development.
55+
if ([[[NSProcessInfo processInfo] environment][@"frontegg-testing"] isEqualToString:@"true"]) {
56+
NSURL *embeddedBundleURL = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
57+
if (embeddedBundleURL != nil) {
58+
return embeddedBundleURL;
59+
}
60+
}
5261
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
5362
#else
5463
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

example/ios/ReactNativeExampleUITests/LoginViaGoogleTest.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import XCTest
44
/// the app survives tapping it.
55
final class LoginViaGoogleTest: UITestCase {
66
func test_social_login_button_is_reachable() throws {
7-
launchApp()
7+
// Use the SDK's mock web-auth transport (DEBUG-only) so the social flow completes
8+
// against the local mock server instead of a real ASWebAuthenticationSession, which
9+
// can't be driven headlessly in CI.
10+
launchApp(useTestingWebAuthenticationTransport: true)
811
let button = app.buttons["loginWithGoogleButton"]
912
waitFor(button, timeout: 10)
1013
button.tap()

example/ios/ReactNativeExampleUITests/UITestCase.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ class UITestCase: XCTestCase {
5050
// MARK: - Launch
5151

5252
@discardableResult
53-
func launchApp(resetState: Bool = true) -> XCUIApplication {
53+
func launchApp(
54+
resetState: Bool = true,
55+
useTestingWebAuthenticationTransport: Bool = false
56+
) -> XCUIApplication {
5457
let app = XCUIApplication()
5558
app.launchEnvironment = Self.server.launchEnvironment(
5659
resetState: resetState,
57-
useTestingWebAuthenticationTransport: false
60+
useTestingWebAuthenticationTransport: useTestingWebAuthenticationTransport
5861
)
5962
app.launch()
6063
self.app = app

0 commit comments

Comments
 (0)