Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add native Xcode tests for iOS app (#1404)

Leendert de Borstfb618522ee25
diff --git a/apps/mobile-app/app/initialize.tsx b/apps/mobile-app/app/initialize.tsx
index 11aba1b4b..147ba56a5 100644
--- a/apps/mobile-app/app/initialize.tsx
+++ b/apps/mobile-app/app/initialize.tsx
@@ -172,7 +172,7 @@ export default function Initialize() : React.ReactNode {
});
return (
- <ThemedView style={styles.container}>
+ <ThemedView style={styles.container} testID="initialize-screen">
<View>
<LoadingIndicator status={status || ''} />
</View>
diff --git a/apps/mobile-app/app/reinitialize.tsx b/apps/mobile-app/app/reinitialize.tsx
index 793930a9d..2cb3df8d8 100644
--- a/apps/mobile-app/app/reinitialize.tsx
+++ b/apps/mobile-app/app/reinitialize.tsx
@@ -191,7 +191,7 @@ export default function ReinitializeScreen() : React.ReactNode {
});
return (
- <ThemedView style={styles.container}>
+ <ThemedView style={styles.container} testID="reinitialize-screen">
<View style={styles.contentWrapper}>
<View style={styles.messageContainer}>
{status ? <LoadingIndicator status={status} /> : null}
diff --git a/apps/mobile-app/ios/.swiftlint.yml b/apps/mobile-app/ios/.swiftlint.yml
index 1633db564..8c2930cd9 100644
--- a/apps/mobile-app/ios/.swiftlint.yml
+++ b/apps/mobile-app/ios/.swiftlint.yml
@@ -5,7 +5,6 @@ included:
- VaultStoreKit
- VaultStoreKitTests
- VaultUI
- - VaultUITests
- VaultUtils
excluded:
diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
index 77869fdc2..747156546 100644
--- a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj
@@ -8,7 +8,8 @@
/* Begin PBXBuildFile section */
07A10A71081ED4937FFAA625 /* RustCoreFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61BC8C49EE3C1989FFB6DB3B /* RustCoreFramework.framework */; };
- 0EF28D873AC559A33A3B178F /* libPods-VaultUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A795EF04BF70F714FA4B0E5 /* libPods-VaultUITests.a */; };
+ 07A10A71081ED4937FFAA626 /* RustCoreFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61BC8C49EE3C1989FFB6DB3B /* RustCoreFramework.framework */; };
+ 07A10A71081ED4937FFAA627 /* VaultModels.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE482AA2DBE8EFE00F4A367 /* VaultModels.framework */; };
1381C2F6D317F2404928BA59 /* libPods-VaultUI.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C32D89DCBA51D7C8CDE51DD2 /* libPods-VaultUI.a */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
3D1B0279B0714C8FF732D2D3 /* libPods-AliasVault.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E23F2188770B15FCBFEBC57 /* libPods-AliasVault.a */; };
@@ -30,7 +31,6 @@
CE48FCEC2DBE939A00E5E3D6 /* VaultModels.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE482AA2DBE8EFE00F4A367 /* VaultModels.framework */; };
CE48FD372DBE95EB00E5E3D6 /* VaultModels.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE482AA2DBE8EFE00F4A367 /* VaultModels.framework */; };
CE48FD632DBEA3B800E5E3D6 /* VaultUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE4816A2DBE8AC800F4A367 /* VaultUI.framework */; };
- CE59C7632E4F47FE0024A246 /* VaultUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE4816A2DBE8AC800F4A367 /* VaultUI.framework */; };
CE73B3A02DFC8A0C0081B6CB /* AliasVault.icon in Resources */ = {isa = PBXBuildFile; fileRef = CE73B39F2DFC8A0C0081B6CB /* AliasVault.icon */; };
CE7782632EA1822400A75E6F /* VaultUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE77825D2EA1822400A75E6F /* VaultUtils.framework */; };
CE7782642EA1822400A75E6F /* VaultUtils.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CE77825D2EA1822400A75E6F /* VaultUtils.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -83,8 +83,15 @@
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = CEE481692DBE8AC800F4A367;
- remoteInfo = VaultUI;
+ remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
+ remoteInfo = AliasVault;
+ };
+ CE59C7662E4F47FE0024A247 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = CEE482A92DBE8EFE00F4A367;
+ remoteInfo = VaultModels;
};
CE7782612EA1822400A75E6F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -198,8 +205,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 017AFF1289CCDC7514CC84DA /* Pods-VaultUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VaultUITests.release.xcconfig"; path = "Target Support Files/Pods-VaultUITests/Pods-VaultUITests.release.xcconfig"; sourceTree = "<group>"; };
- 0185B497D6794232013782D4 /* Pods-VaultUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VaultUITests.debug.xcconfig"; path = "Target Support Files/Pods-VaultUITests/Pods-VaultUITests.debug.xcconfig"; sourceTree = "<group>"; };
+ 017AFF1289CCDC7514CC84DA /* Pods-AliasVaultUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AliasVaultUITests.release.xcconfig"; path = "Target Support Files/Pods-AliasVaultUITests/Pods-AliasVaultUITests.release.xcconfig"; sourceTree = "<group>"; };
+ 0185B497D6794232013782D4 /* Pods-AliasVaultUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AliasVaultUITests.debug.xcconfig"; path = "Target Support Files/Pods-AliasVaultUITests/Pods-AliasVaultUITests.debug.xcconfig"; sourceTree = "<group>"; };
09DFCC3CBA13D19073CBCC7F /* Pods-VaultStoreKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VaultStoreKit.debug.xcconfig"; path = "Target Support Files/Pods-VaultStoreKit/Pods-VaultStoreKit.debug.xcconfig"; sourceTree = "<group>"; };
0E23F2188770B15FCBFEBC57 /* libPods-AliasVault.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AliasVault.a"; sourceTree = BUILT_PRODUCTS_DIR; };
13B07F961A680F5B00A75B9A /* AliasVault.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AliasVault.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -226,7 +233,7 @@
962DE0FB93C9458BAFEEED60 /* AliasVault-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "AliasVault-Bridging-Header.h"; path = "AliasVault/AliasVault-Bridging-Header.h"; sourceTree = "<group>"; };
9668BBEEC62508A81A7214E2 /* Pods-PreviewHost.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PreviewHost.release.xcconfig"; path = "Target Support Files/Pods-PreviewHost/Pods-PreviewHost.release.xcconfig"; sourceTree = "<group>"; };
9996E7A841D488251B139CFC /* aliasvault_core.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = aliasvault_core.swift; path = RustCoreFramework/RustCore/Generated/aliasvault_core.swift; sourceTree = "<group>"; };
- 9A795EF04BF70F714FA4B0E5 /* libPods-VaultUITests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-VaultUITests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 9A795EF04BF70F714FA4B0E5 /* libPods-AliasVaultUITests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AliasVaultUITests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9E9AD944E3A0F270C797F5DD /* libPods-VaultStoreKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-VaultStoreKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A9E70CCF7AAA4E05B57CCCC4 /* Pods-VaultStoreKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VaultStoreKitTests.debug.xcconfig"; path = "Target Support Files/Pods-VaultStoreKitTests/Pods-VaultStoreKitTests.debug.xcconfig"; sourceTree = "<group>"; };
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = AliasVault/SplashScreen.storyboard; sourceTree = "<group>"; };
@@ -241,7 +248,7 @@
C9F10947D429671B08FE934C /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CE26D68C2DA7FCD2006DC04D /* VaultManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VaultManager.swift; sourceTree = "<group>"; };
CE3AE2B02DC7ACD700E7745E /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
- CE59C75F2E4F47FD0024A246 /* VaultUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VaultUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ CE59C75F2E4F47FD0024A246 /* AliasVaultUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AliasVaultUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
CE73B39F2DFC8A0C0081B6CB /* AliasVault.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = AliasVault.icon; sourceTree = "<group>"; };
CE77825D2EA1822400A75E6F /* VaultUtils.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VaultUtils.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CE9A58FA2DBA982100CB0A4C /* RCTNativeVaultManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTNativeVaultManager.h; sourceTree = "<group>"; };
@@ -275,7 +282,7 @@
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
- CE59C7602E4F47FD0024A246 /* VaultUITests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUITests; sourceTree = "<group>"; };
+ CE59C7602E4F47FD0024A246 /* AliasVaultUITests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = AliasVaultUITests; sourceTree = "<group>"; };
CE77825E2EA1822400A75E6F /* VaultUtils */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultUtils; sourceTree = "<group>"; };
CEE480882DBE86DC00F4A367 /* VaultStoreKit */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultStoreKit; sourceTree = "<group>"; };
CEE480972DBE86DD00F4A367 /* VaultStoreKitTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = VaultStoreKitTests; sourceTree = "<group>"; };
@@ -310,8 +317,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- CE59C7632E4F47FE0024A246 /* VaultUI.framework in Frameworks */,
- 0EF28D873AC559A33A3B178F /* libPods-VaultUITests.a in Frameworks */,
+ 07A10A71081ED4937FFAA626 /* RustCoreFramework.framework in Frameworks */,
+ 07A10A71081ED4937FFAA627 /* VaultModels.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -414,7 +421,7 @@
456ACD01FF420AE789429A59 /* libPods-VaultStoreTests.a */,
C32D89DCBA51D7C8CDE51DD2 /* libPods-VaultUI.a */,
9E9AD944E3A0F270C797F5DD /* libPods-VaultStoreKitTests.a */,
- 9A795EF04BF70F714FA4B0E5 /* libPods-VaultUITests.a */,
+ 9A795EF04BF70F714FA4B0E5 /* libPods-AliasVaultUITests.a */,
DC967BC4C05235EC23436A20 /* iOS */,
);
name = Frameworks;
@@ -471,7 +478,7 @@
CEE480882DBE86DC00F4A367 /* VaultStoreKit */,
CEE480972DBE86DD00F4A367 /* VaultStoreKitTests */,
CEE4816B2DBE8AC800F4A367 /* VaultUI */,
- CE59C7602E4F47FD0024A246 /* VaultUITests */,
+ CE59C7602E4F47FD0024A246 /* AliasVaultUITests */,
CE77825E2EA1822400A75E6F /* VaultUtils */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
@@ -495,7 +502,7 @@
CEE480912DBE86DD00F4A367 /* VaultStoreKitTests.xctest */,
CEE4816A2DBE8AC800F4A367 /* VaultUI.framework */,
CEE482AA2DBE8EFE00F4A367 /* VaultModels.framework */,
- CE59C75F2E4F47FD0024A246 /* VaultUITests.xctest */,
+ CE59C75F2E4F47FD0024A246 /* AliasVaultUITests.xctest */,
CE77825D2EA1822400A75E6F /* VaultUtils.framework */,
61BC8C49EE3C1989FFB6DB3B /* RustCoreFramework.framework */,
);
@@ -572,8 +579,8 @@
1A927300CBD3BFE2B7A3CA37 /* Pods-VaultUI.release.xcconfig */,
A9E70CCF7AAA4E05B57CCCC4 /* Pods-VaultStoreKitTests.debug.xcconfig */,
B18F3A7E310165C29C8C6DFE /* Pods-VaultStoreKitTests.release.xcconfig */,
- 0185B497D6794232013782D4 /* Pods-VaultUITests.debug.xcconfig */,
- 017AFF1289CCDC7514CC84DA /* Pods-VaultUITests.release.xcconfig */,
+ 0185B497D6794232013782D4 /* Pods-AliasVaultUITests.debug.xcconfig */,
+ 017AFF1289CCDC7514CC84DA /* Pods-AliasVaultUITests.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
@@ -695,11 +702,10 @@
productReference = 61BC8C49EE3C1989FFB6DB3B /* RustCoreFramework.framework */;
productType = "com.apple.product-type.framework";
};
- CE59C75E2E4F47FD0024A246 /* VaultUITests */ = {
+ CE59C75E2E4F47FD0024A246 /* AliasVaultUITests */ = {
isa = PBXNativeTarget;
- buildConfigurationList = CE59C7682E4F47FE0024A246 /* Build configuration list for PBXNativeTarget "VaultUITests" */;
+ buildConfigurationList = CE59C7682E4F47FE0024A246 /* Build configuration list for PBXNativeTarget "AliasVaultUITests" */;
buildPhases = (
- 2E8B1031EFFD64F99242A5C1 /* [CP] Check Pods Manifest.lock */,
CE59C75B2E4F47FD0024A246 /* Sources */,
CE59C75C2E4F47FD0024A246 /* Frameworks */,
CE59C75D2E4F47FD0024A246 /* Resources */,
@@ -708,14 +714,15 @@
);
dependencies = (
CE59C7652E4F47FE0024A246 /* PBXTargetDependency */,
+ CE59C7672E4F47FE0024A247 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
- CE59C7602E4F47FD0024A246 /* VaultUITests */,
+ CE59C7602E4F47FD0024A246 /* AliasVaultUITests */,
);
- name = VaultUITests;
- productName = VaultUITests;
- productReference = CE59C75F2E4F47FD0024A246 /* VaultUITests.xctest */;
- productType = "com.apple.product-type.bundle.unit-test";
+ name = AliasVaultUITests;
+ productName = AliasVaultUITests;
+ productReference = CE59C75F2E4F47FD0024A246 /* AliasVaultUITests.xctest */;
+ productType = "com.apple.product-type.bundle.ui-testing";
};
CE77825C2EA1822400A75E6F /* VaultUtils */ = {
isa = PBXNativeTarget;
@@ -926,7 +933,7 @@
CEE480862DBE86DC00F4A367 /* VaultStoreKit */,
CEE480902DBE86DD00F4A367 /* VaultStoreKitTests */,
CEE481692DBE8AC800F4A367 /* VaultUI */,
- CE59C75E2E4F47FD0024A246 /* VaultUITests */,
+ CE59C75E2E4F47FD0024A246 /* AliasVaultUITests */,
CEE482A92DBE8EFE00F4A367 /* VaultModels */,
CE77825C2EA1822400A75E6F /* VaultUtils */,
55118F9387BE1BFE21365CB8 /* RustCoreFramework */,
@@ -1064,28 +1071,6 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AliasVault/Pods-AliasVault-resources.sh\"\n";
showEnvVarsInLog = 0;
};
- 2E8B1031EFFD64F99242A5C1 /* [CP] Check Pods Manifest.lock */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- );
- inputPaths = (
- "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
- "${PODS_ROOT}/Manifest.lock",
- );
- name = "[CP] Check Pods Manifest.lock";
- outputFileListPaths = (
- );
- outputPaths = (
- "$(DERIVED_FILE_DIR)/Pods-VaultUITests-checkManifestLockResult.txt",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
- showEnvVarsInLog = 0;
- };
5DC7F827F296E839DC4DE7BD /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -1402,9 +1387,14 @@
};
CE59C7652E4F47FE0024A246 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
- target = CEE481692DBE8AC800F4A367 /* VaultUI */;
+ target = 13B07F861A680F5B00A75B9A /* AliasVault */;
targetProxy = CE59C7642E4F47FE0024A246 /* PBXContainerItemProxy */;
};
+ CE59C7672E4F47FE0024A247 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = CEE482A92DBE8EFE00F4A367 /* VaultModels */;
+ targetProxy = CE59C7662E4F47FE0024A247 /* PBXContainerItemProxy */;
+ };
CE7782622EA1822400A75E6F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = CE77825C2EA1822400A75E6F /* VaultUtils */;
@@ -1483,6 +1473,7 @@
"@loader_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
+ "$(SDKROOT)/usr/lib/swift",
"$(inherited)",
"$(PROJECT_DIR)/RustCoreFramework/RustCore/lib/$(RUST_LIB_PLATFORM)",
);
@@ -1493,6 +1484,7 @@
"-all_load",
"-laliasvault_core",
);
+ OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.RustCoreFramework;
PRODUCT_NAME = "$(TARGET_NAME)";
"RUST_LIB_PLATFORM[sdk=iphoneos*]" = device;
@@ -1735,6 +1727,7 @@
"@loader_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
+ "$(SDKROOT)/usr/lib/swift",
"$(inherited)",
"$(PROJECT_DIR)/RustCoreFramework/RustCore/lib/$(RUST_LIB_PLATFORM)",
);
@@ -1746,6 +1739,7 @@
"-all_load",
"-laliasvault_core",
);
+ OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.RustCoreFramework;
PRODUCT_NAME = "$(TARGET_NAME)";
"RUST_LIB_PLATFORM[sdk=iphoneos*]" = device;
@@ -1765,7 +1759,6 @@
};
CE59C7662E4F47FE0024A246 /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 0185B497D6794232013782D4 /* Pods-VaultUITests.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
@@ -1788,19 +1781,19 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
- PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app.VaultUITests;
+ PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app.AliasVaultUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_TARGET_NAME = AliasVault;
};
name = Debug;
};
CE59C7672E4F47FE0024A246 /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 017AFF1289CCDC7514CC84DA /* Pods-VaultUITests.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
@@ -1823,12 +1816,13 @@
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
- PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app.VaultUITests;
+ PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app.AliasVaultUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_TARGET_NAME = AliasVault;
};
name = Release;
};
@@ -1982,7 +1976,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
- LIBRARY_SEARCH_PATHS = "$(inherited)";
+ LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
@@ -2042,7 +2036,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
- LIBRARY_SEARCH_PATHS = "$(inherited)";
+ LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
@@ -2166,7 +2160,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
- LIBRARY_SEARCH_PATHS = "$(inherited)";
+ LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
@@ -2226,7 +2220,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
- LIBRARY_SEARCH_PATHS = "$(inherited)";
+ LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
@@ -2483,7 +2477,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- CE59C7682E4F47FE0024A246 /* Build configuration list for PBXNativeTarget "VaultUITests" */ = {
+ CE59C7682E4F47FE0024A246 /* Build configuration list for PBXNativeTarget "AliasVaultUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CE59C7662E4F47FE0024A246 /* Debug */,
diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVault.xcscheme b/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVault.xcscheme
index c3352f446..4bcc7ffe4 100644
--- a/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVault.xcscheme
+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVault.xcscheme
@@ -39,6 +39,17 @@
ReferencedContainer = "container:AliasVault.xcodeproj">
</BuildableReference>
</TestableReference>
+ <TestableReference
+ skipped = "NO"
+ parallelizable = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "CE59C75E2E4F47FD0024A246"
+ BuildableName = "AliasVaultUITests.xctest"
+ BlueprintName = "AliasVaultUITests"
+ ReferencedContainer = "container:AliasVault.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
</Testables>
</TestAction>
<LaunchAction
diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVaultUITests.xcscheme b/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVaultUITests.xcscheme
new file mode 100644
index 000000000..6047f147f
--- /dev/null
+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/xcshareddata/xcschemes/AliasVaultUITests.xcscheme
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "1620"
+ version = "1.7">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES"
+ buildArchitectures = "Automatic">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "NO"
+ buildForArchiving = "NO"
+ buildForAnalyzing = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "CE59C75E2E4F47FD0024A246"
+ BuildableName = "AliasVaultUITests.xctest"
+ BlueprintName = "AliasVaultUITests"
+ ReferencedContainer = "container:AliasVault.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
+ BuildableName = "AliasVault.app"
+ BlueprintName = "AliasVault"
+ ReferencedContainer = "container:AliasVault.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES">
+ <TestPlans>
+ <TestPlanReference
+ reference = "container:AliasVaultUITests.xctestplan"
+ default = "YES">
+ </TestPlanReference>
+ </TestPlans>
+ <Testables>
+ <TestableReference
+ skipped = "NO"
+ parallelizable = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "CE59C75E2E4F47FD0024A246"
+ BuildableName = "AliasVaultUITests.xctest"
+ BlueprintName = "AliasVaultUITests"
+ ReferencedContainer = "container:AliasVault.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
+ BuildableName = "AliasVault.app"
+ BlueprintName = "AliasVault"
+ ReferencedContainer = "container:AliasVault.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
+ BuildableName = "AliasVault.app"
+ BlueprintName = "AliasVault"
+ ReferencedContainer = "container:AliasVault.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/apps/mobile-app/ios/AliasVault.xcworkspace/contents.xcworkspacedata b/apps/mobile-app/ios/AliasVault.xcworkspace/contents.xcworkspacedata
index ea2fde653..2bf6abb39 100644
--- a/apps/mobile-app/ios/AliasVault.xcworkspace/contents.xcworkspacedata
+++ b/apps/mobile-app/ios/AliasVault.xcworkspace/contents.xcworkspacedata
@@ -7,4 +7,7 @@
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
+ <FileRef
+ location = "group:AliasVaultUITests.xctestplan">
+ </FileRef>
</Workspace>
diff --git a/apps/mobile-app/ios/AliasVaultUITests.xctestplan b/apps/mobile-app/ios/AliasVaultUITests.xctestplan
new file mode 100644
index 000000000..f678b283e
--- /dev/null
+++ b/apps/mobile-app/ios/AliasVaultUITests.xctestplan
@@ -0,0 +1,30 @@
+{
+ "configurations" : [
+ {
+ "id" : "951DE877-ECA8-4F41-8726-D1278DCCDFA0",
+ "name" : "Test Scheme Action",
+ "options" : {
+
+ }
+ }
+ ],
+ "defaultOptions" : {
+ "performanceAntipatternCheckerEnabled" : true,
+ "targetForVariableExpansion" : {
+ "containerPath" : "container:AliasVault.xcodeproj",
+ "identifier" : "13B07F861A680F5B00A75B9A",
+ "name" : "AliasVault"
+ }
+ },
+ "testTargets" : [
+ {
+ "parallelizable" : true,
+ "target" : {
+ "containerPath" : "container:AliasVault.xcodeproj",
+ "identifier" : "CE59C75E2E4F47FD0024A246",
+ "name" : "AliasVaultUITests"
+ }
+ }
+ ],
+ "version" : 1
+}
diff --git a/apps/mobile-app/ios/AliasVaultUITests/AliasVaultUITests.swift b/apps/mobile-app/ios/AliasVaultUITests/AliasVaultUITests.swift
new file mode 100644
index 000000000..c98ac9ff4
--- /dev/null
+++ b/apps/mobile-app/ios/AliasVaultUITests/AliasVaultUITests.swift
@@ -0,0 +1,555 @@
+import XCTest
+
+/// E2E UI Tests for AliasVault iOS app
+/// Migrated from Maestro tests to native XCTest
+/// Uses dynamically created test users (no pre-configured credentials needed)
+final class AliasVaultUITests: XCTestCase {
+ var app: XCUIApplication!
+
+ /// Shared test user created for the test run
+ static var testUser: TestUser?
+
+ override func setUp() {
+ super.setUp()
+ continueAfterFailure = false
+ app = XCUIApplication()
+
+ // Enable verbose synchronization debugging to identify what's blocking idle
+ // This helps diagnose what resources are keeping the app busy
+ app.launchArguments.append("-DTXEnableVerboseSyncSystem")
+ app.launchArguments.append("YES")
+ app.launchArguments.append("-DTXEnableVerboseSyncResources")
+ app.launchArguments.append("YES")
+ }
+
+ override func tearDown() {
+ app = nil
+ super.tearDown()
+ }
+
+ // MARK: - Test Setup
+
+ /// Create a test user before tests that need authentication
+ private func ensureTestUser() async throws -> TestUser {
+ if let existingUser = Self.testUser {
+ return existingUser
+ }
+
+ // Check if API is available
+ let apiAvailable = await TestUserRegistration.isApiAvailable()
+ guard apiAvailable else {
+ throw XCTSkip("API not available at \(TestConfiguration.apiUrl). Start the local server first.")
+ }
+
+ // Create a new test user
+ let user = try await TestUserRegistration.createTestUser()
+ Self.testUser = user
+ return user
+ }
+
+ // MARK: - Test 01: App Launch
+
+ /// Test 01: App Launch
+ /// Verifies the app launches correctly and shows the login screen
+ @MainActor
+ func test01AppLaunch() {
+ // Launch the app with a clean state
+ app.launchArguments.append("--reset-state")
+ app.launch()
+
+ // Wait for app to fully load - look for AliasVault text
+ // Use waitForExistenceNoIdle to avoid hanging on React Native timers/animations
+ let aliasVaultText = app.staticTexts["AliasVault"]
+ XCTAssertTrue(
+ aliasVaultText.waitForExistenceNoIdle(timeout: 15),
+ "App should display AliasVault text on launch"
+ )
+
+ // Verify the login screen is displayed
+ let loginScreen = app.findElement(testID: "login-screen")
+ XCTAssertTrue(
+ loginScreen.waitForExistenceNoIdle(timeout: TestConfiguration.defaultTimeout),
+ "Login screen should be visible"
+ )
+
+ // Verify login form elements
+ let usernameInput = app.findElement(testID: "username-input")
+ XCTAssertTrue(usernameInput.exists, "Username input should be visible")
+
+ let passwordInput = app.findElement(testID: "password-input")
+ XCTAssertTrue(passwordInput.exists, "Password input should be visible")
+
+ // Check for Log in button
+ let loginButton = app.findElement(testID: "login-button")
+ XCTAssertTrue(loginButton.exists, "Log in button should be visible")
+
+ // Take screenshot
+ let screenshot = XCUIScreen.main.screenshot()
+ let attachment = XCTAttachment(screenshot: screenshot)
+ attachment.name = "01-app-launched"
+ attachment.lifetime = .keepAlways
+ add(attachment)
+ }
+
+ // MARK: - Test 02: Login Validation
+
+ /// Test 02: Login Validation
+ /// Verifies login form validation and error handling
+ @MainActor
+ func test02LoginValidation() {
+ // Launch the app fresh
+ app.launchArguments.append("--reset-state")
+ app.launch()
+
+ // Wait for login screen (use waitForExistenceNoIdle for React Native compatibility)
+ let loginScreen = app.findElement(testID: "login-screen")
+ XCTAssertTrue(
+ loginScreen.waitForExistenceNoIdle(timeout: 15),
+ "Login screen should be visible"
+ )
+
+ // Test 1: Empty form submission
+ let loginButton = app.findElement(testID: "login-button")
+ loginButton.tapNoIdle()
+
+ // Should show validation error (optional - may have different implementation)
+ let emptyFormScreenshot = XCUIScreen.main.screenshot()
+ let attachment1 = XCTAttachment(screenshot: emptyFormScreenshot)
+ attachment1.name = "02-1-empty-form-validation"
+ attachment1.lifetime = .keepAlways
+ add(attachment1)
+
+ // Test 2: Invalid credentials
+ let usernameInput = app.findTextField(testID: "username-input")
+ usernameInput.tapNoIdle()
+ usernameInput.typeText("[email protected]")
+
+ let passwordInput = app.findTextField(testID: "password-input")
+ passwordInput.tapNoIdle()
+ passwordInput.typeText("wrongpassword")
+
+ app.hideKeyboardIfVisible()
+
+ loginButton.tapNoIdle()
+
+ // Wait for error response (network request may take time)
+ let errorMessage = app.findElement(testID: "error-message")
+ _ = errorMessage.waitForExistenceNoIdle(timeout: 15)
+
+ let invalidCredentialsScreenshot = XCUIScreen.main.screenshot()
+ let attachment2 = XCTAttachment(screenshot: invalidCredentialsScreenshot)
+ attachment2.name = "02-2-invalid-credentials"
+ attachment2.lifetime = .keepAlways
+ add(attachment2)
+ }
+
+ // MARK: - Test 03: Successful Login
+
+ /// Test 03: Successful Login
+ /// Verifies login flow with dynamically created test user
+ @MainActor
+ func test03SuccessfulLogin() async throws {
+ // Create test user dynamically
+ let testUser = try await ensureTestUser()
+
+ // Launch the app fresh
+ app.launchArguments.append("--reset-state")
+ app.launch()
+
+ // Wait for login screen (use waitForExistenceNoIdle for React Native compatibility)
+ let loginScreen = app.findElement(testID: "login-screen")
+ XCTAssertTrue(
+ loginScreen.waitForExistenceNoIdle(timeout: 15),
+ "Login screen should be visible"
+ )
+
+ // Configure API URL to use local server
+ let serverUrlLink = app.findElement(testID: "server-url-link")
+ serverUrlLink.tapNoIdle()
+
+ // Wait for settings screen to load and select "Self-hosted" option
+ let selfHostedOption = app.findElement(testID: "api-option-custom")
+ XCTAssertTrue(
+ selfHostedOption.waitForExistenceNoIdle(timeout: 10),
+ "Settings screen should show Self-hosted option"
+ )
+ selfHostedOption.tapNoIdle()
+
+ // Wait for custom URL input to appear
+ let customApiUrlInput = app.findTextField(testID: "custom-api-url-input")
+ XCTAssertTrue(
+ customApiUrlInput.waitForExistenceNoIdle(timeout: 5),
+ "Custom API URL input should appear"
+ )
+
+ // Clear existing text and enter the local API URL
+ customApiUrlInput.tapNoIdle()
+ customApiUrlInput.clearAndTypeTextNoIdle(TestConfiguration.apiUrl)
+ app.hideKeyboardIfVisible()
+
+ // Go back to login screen
+ let backButton = app.findElement(testID: "back-button")
+ backButton.tapNoIdle()
+
+ // Wait for login screen to be visible again
+ XCTAssertTrue(
+ loginScreen.waitForExistenceNoIdle(timeout: 10),
+ "Should return to login screen"
+ )
+
+ // Now perform login with dynamically created test user
+ let usernameInput = app.findTextField(testID: "username-input")
+ usernameInput.tapNoIdle()
+ usernameInput.typeText(testUser.username)
+
+ let passwordInput = app.findTextField(testID: "password-input")
+ passwordInput.tapNoIdle()
+ passwordInput.typeText(testUser.password)
+
+ app.hideKeyboardIfVisible()
+
+ let credentialsScreenshot = XCUIScreen.main.screenshot()
+ let attachment1 = XCTAttachment(screenshot: credentialsScreenshot)
+ attachment1.name = "03-1-credentials-entered"
+ attachment1.lifetime = .keepAlways
+ add(attachment1)
+
+ // Submit login
+ let loginButton = app.findElement(testID: "login-button")
+ loginButton.tapNoIdle()
+
+ // Wait for login to complete (may include vault sync)
+ let itemsScreen = app.findElement(testID: "items-screen")
+ XCTAssertTrue(
+ itemsScreen.waitForExistenceNoIdle(timeout: TestConfiguration.extendedTimeout),
+ "Should navigate to items screen after successful login"
+ )
+
+ // Verify we're on the items/vault screen
+ let itemsList = app.findElement(testID: "items-list")
+ XCTAssertTrue(itemsList.exists, "Items list should be visible")
+
+ let loginSuccessScreenshot = XCUIScreen.main.screenshot()
+ let attachment2 = XCTAttachment(screenshot: loginSuccessScreenshot)
+ attachment2.name = "03-2-login-successful"
+ attachment2.lifetime = .keepAlways
+ add(attachment2)
+ }
+
+ // MARK: - Test 04: Create New Item
+
+ /// Test 04: Create New Item
+ /// Verifies item creation flow
+ /// Note: This test assumes tests 01-03 have already run and the app is logged in
+ @MainActor
+ func test04CreateItem() {
+ // Generate unique item name
+ let uniqueName = TestConfiguration.generateUniqueName(prefix: "E2E Test")
+
+ // Don't relaunch the app - just verify we're on the items screen
+ // If the app was terminated between tests, this will fail gracefully
+
+ // Wait for items screen (assumes already authenticated from test03)
+ // Use waitForExistenceNoIdle for React Native compatibility
+ let itemsScreen = app.findElement(testID: "items-screen")
+ XCTAssertTrue(
+ itemsScreen.waitForExistenceNoIdle(timeout: TestConfiguration.extendedTimeout),
+ "Should be on items screen (run test03 first to authenticate)"
+ )
+
+ // Tap the FAB (Floating Action Button) to add new item
+ let addItemButton = app.findElement(testID: "add-item-button")
+ addItemButton.tapNoIdle()
+
+ // Wait for add/edit screen to load
+ let addEditScreen = app.findElement(testID: "add-edit-screen")
+ XCTAssertTrue(
+ addEditScreen.waitForExistenceNoIdle(timeout: 10),
+ "Add/edit screen should appear"
+ )
+
+ let addItemScreenshot = XCUIScreen.main.screenshot()
+ let attachment1 = XCTAttachment(screenshot: addItemScreenshot)
+ attachment1.name = "04-1-add-item-screen"
+ attachment1.lifetime = .keepAlways
+ add(attachment1)
+
+ // Enter item name
+ let itemNameInput = app.findTextField(testID: "item-name-input")
+ itemNameInput.tapNoIdle()
+ itemNameInput.typeText(uniqueName)
+
+ // Enter service URL
+ let serviceUrlInput = app.findTextField(testID: "service-url-input")
+ serviceUrlInput.tapNoIdle()
+ serviceUrlInput.typeText("https://example.com")
+
+ // Add email field
+ let addEmailButton = app.findElement(testID: "add-email-button")
+ addEmailButton.tapNoIdle()
+
+ // Enter email
+ let loginEmailInput = app.findTextField(testID: "login-email-input")
+ loginEmailInput.tapNoIdle()
+ loginEmailInput.typeText("[email protected]")
+
+ // Enter username (optional)
+ let loginUsernameInput = app.findTextField(testID: "login-username-input")
+ if loginUsernameInput.exists {
+ loginUsernameInput.tapNoIdle()
+ loginUsernameInput.typeText("e2euser")
+ }
+
+ app.hideKeyboardIfVisible()
+
+ let itemFilledScreenshot = XCUIScreen.main.screenshot()
+ let attachment2 = XCTAttachment(screenshot: itemFilledScreenshot)
+ attachment2.name = "04-2-item-filled"
+ attachment2.lifetime = .keepAlways
+ add(attachment2)
+
+ // Save the item
+ let saveButton = app.findElement(testID: "save-button")
+ saveButton.tapNoIdle()
+
+ // Wait for item detail screen to load (app navigates here after save)
+ XCTAssertTrue(
+ app.waitForText("Login credentials", timeout: 10),
+ "Should show item detail screen with Login credentials"
+ )
+
+ let itemDetailScreenshot = XCUIScreen.main.screenshot()
+ let attachment3 = XCTAttachment(screenshot: itemDetailScreenshot)
+ attachment3.name = "04-3-item-detail-screen"
+ attachment3.lifetime = .keepAlways
+ add(attachment3)
+
+ // Wait a moment for UI to settle
+ sleep(1)
+
+ // Go back to items list
+ let backButton = app.findElement(testID: "back-button")
+ backButton.tapNoIdle()
+
+ // Wait for items screen to be visible
+ XCTAssertTrue(
+ itemsScreen.waitForExistenceNoIdle(timeout: 10),
+ "Should return to items screen"
+ )
+
+ // Verify the newly created item appears in the list by tapping on it
+ let newItem = app.staticTexts[uniqueName]
+ XCTAssertTrue(
+ newItem.waitForExistenceNoIdle(timeout: 5),
+ "Newly created item should appear in list"
+ )
+ newItem.tapNoIdle()
+
+
+ // Verify email is preserved
+ XCTAssertTrue(
+ app.waitForText("[email protected]", timeout: 5),
+ "Email should be preserved after sync"
+ )
+
+ let itemVerifiedAfterSyncScreenshot = XCUIScreen.main.screenshot()
+ let attachment9 = XCTAttachment(screenshot: itemVerifiedAfterSyncScreenshot)
+ attachment9.name = "05-9-item-verified-after-sync"
+ attachment9.lifetime = .keepAlways
+ add(attachment9)
+ }
+
+ // MARK: - Helper Methods
+
+ /// Ensure user is authenticated - handles login, unlock, initialize, and reinitialize screens
+ @MainActor
+ private func ensureAuthenticated(with testUser: TestUser) {
+ // Wait a moment for initial app loading
+ sleep(3)
+
+ // Take a debug screenshot to see what's on screen
+ let debugScreenshot = XCUIScreen.main.screenshot()
+ let debugAttachment = XCTAttachment(screenshot: debugScreenshot)
+ debugAttachment.name = "debug-ensureAuthenticated-initial"
+ debugAttachment.lifetime = .keepAlways
+ add(debugAttachment)
+
+ // Check for various screens - the app might be on any of these
+ // Use waitForExistenceNoIdle throughout to avoid hanging on React Native timers
+ let maxAttempts = 20
+ for attempt in 1...maxAttempts {
+ // Check if already on items screen - we're done
+ let itemsScreen = app.findElement(testID: "items-screen")
+ if itemsScreen.waitForExistenceNoIdle(timeout: 1) {
+ print("[ensureAuthenticated] Found items-screen on attempt \(attempt)")
+ return
+ }
+
+ // Check if we're on login screen
+ let loginScreen = app.findElement(testID: "login-screen")
+ if loginScreen.waitForExistenceNoIdle(timeout: 1) {
+ print("[ensureAuthenticated] Found login-screen on attempt \(attempt)")
+ performLogin(with: testUser)
+ return
+ }
+
+ // Check if we're on unlock screen (vault is locked but user is logged in)
+ let unlockScreen = app.findElement(testID: "unlock-screen")
+ if unlockScreen.waitForExistenceNoIdle(timeout: 1) {
+ print("[ensureAuthenticated] Found unlock-screen on attempt \(attempt)")
+ performUnlock(with: testUser)
+ return
+ }
+
+ // Check if we're on initialize screen (waiting for biometric - might have a system prompt)
+ // If so, we need to handle the biometric prompt or wait for it to navigate
+ let initializeScreen = app.findElement(testID: "initialize-screen")
+ if initializeScreen.waitForExistenceNoIdle(timeout: 1) {
+ print("[ensureAuthenticated] Found initialize-screen on attempt \(attempt) - waiting for navigation")
+ // The initialize screen will eventually navigate to login, unlock, or items
+ // Handle possible biometric alert by tapping cancel if it exists
+ let springboardApp = XCUIApplication(bundleIdentifier: "com.apple.springboard")
+ let cancelButton = springboardApp.buttons["Cancel"]
+ if cancelButton.waitForExistence(timeout: 2) {
+ cancelButton.tap()
+ print("[ensureAuthenticated] Dismissed biometric prompt")
+ }
+ sleep(2)
+ continue
+ }
+
+ // Check if we're on reinitialize screen
+ let reinitializeScreen = app.findElement(testID: "reinitialize-screen")
+ if reinitializeScreen.waitForExistenceNoIdle(timeout: 1) {
+ print("[ensureAuthenticated] Found reinitialize-screen on attempt \(attempt) - waiting for navigation")
+ // Similar to initialize - handle biometric prompt
+ let springboardApp = XCUIApplication(bundleIdentifier: "com.apple.springboard")
+ let cancelButton = springboardApp.buttons["Cancel"]
+ if cancelButton.waitForExistence(timeout: 2) {
+ cancelButton.tap()
+ print("[ensureAuthenticated] Dismissed biometric prompt")
+ }
+ sleep(2)
+ continue
+ }
+
+ // If nothing found, take a screenshot and wait
+ if attempt == 5 || attempt == 10 || attempt == 15 {
+ let midScreenshot = XCUIScreen.main.screenshot()
+ let midAttachment = XCTAttachment(screenshot: midScreenshot)
+ midAttachment.name = "debug-ensureAuthenticated-attempt-\(attempt)"
+ midAttachment.lifetime = .keepAlways
+ add(midAttachment)
+ }
+
+ // If nothing found, wait a bit and try again (app might still be loading)
+ if attempt < maxAttempts {
+ sleep(1)
+ }
+ }
+
+ // Take final screenshot before failing
+ let finalScreenshot = XCUIScreen.main.screenshot()
+ let finalAttachment = XCTAttachment(screenshot: finalScreenshot)
+ finalAttachment.name = "debug-ensureAuthenticated-failed"
+ finalAttachment.lifetime = .keepAlways
+ add(finalAttachment)
+
+ // If we get here, we couldn't find any expected screen
+ XCTFail("Could not find login screen, unlock screen, or items screen after \(maxAttempts) attempts")
+ }
+
+ /// Perform login with provided test user credentials
+ @MainActor
+ private func performLogin(with testUser: TestUser) {
+ // Configure API URL
+ let serverUrlLink = app.findElement(testID: "server-url-link")
+ if serverUrlLink.waitForExistenceNoIdle(timeout: 5) {
+ serverUrlLink.tapNoIdle()
+
+ let selfHostedOption = app.findElement(testID: "api-option-custom")
+ if selfHostedOption.waitForExistenceNoIdle(timeout: 5) {
+ selfHostedOption.tapNoIdle()
+
+ let customApiUrlInput = app.findTextField(testID: "custom-api-url-input")
+ if customApiUrlInput.waitForExistenceNoIdle(timeout: 5) {
+ customApiUrlInput.tapNoIdle()
+ customApiUrlInput.clearAndTypeTextNoIdle(TestConfiguration.apiUrl)
+ app.hideKeyboardIfVisible()
+ }
+
+ let backButton = app.findElement(testID: "back-button")
+ backButton.tapNoIdle()
+ }
+ }
+
+ // Wait for login screen
+ let loginScreen = app.findElement(testID: "login-screen")
+ _ = loginScreen.waitForExistenceNoIdle(timeout: 5)
+
+ // Enter credentials
+ let usernameInput = app.findTextField(testID: "username-input")
+ usernameInput.tapNoIdle()
+ usernameInput.typeText(testUser.username)
+
+ let passwordInput = app.findTextField(testID: "password-input")
+ passwordInput.tapNoIdle()
+ passwordInput.typeText(testUser.password)
+
+ app.hideKeyboardIfVisible()
+
+ // Submit login
+ let loginButton = app.findElement(testID: "login-button")
+ loginButton.tapNoIdle()
+
+ // Wait for items screen
+ let itemsScreen = app.findElement(testID: "items-screen")
+ _ = itemsScreen.waitForExistenceNoIdle(timeout: TestConfiguration.extendedTimeout)
+ }
+
+ /// Perform unlock with provided test user password (for locked vault)
+ @MainActor
+ private func performUnlock(with testUser: TestUser) {
+ // Wait for "Unlock vault" text to appear (indicates form is loaded)
+ XCTAssertTrue(
+ app.waitForText("Unlock vault", timeout: 15),
+ "Unlock vault header should appear"
+ )
+
+ // Find password field - React Native renders it as a generic "Other" element
+ // but we can still interact with it by finding the text input
+ let passwordInput = app.findTextField(testID: "unlock-password-input")
+ if passwordInput.waitForExistenceNoIdle(timeout: 3) {
+ passwordInput.tapNoIdle()
+ passwordInput.typeText(testUser.password)
+ } else {
+ // Fallback: tap on the password field area and type
+ // The field is typically below "Enter your password" text
+ let enterPasswordText = app.staticTexts["Enter your password"]
+ if enterPasswordText.exists {
+ // Tap below this text where the input field should be
+ let coordinate = enterPasswordText.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 3.0))
+ coordinate.tap()
+ sleep(1)
+ app.typeText(testUser.password)
+ } else {
+ XCTFail("Could not find password input area")
+ return
+ }
+ }
+
+ app.hideKeyboardIfVisible()
+
+ // Find and tap unlock button by its text
+ let unlockButton = app.staticTexts["Unlock"]
+ XCTAssertTrue(
+ unlockButton.waitForExistenceNoIdle(timeout: 5),
+ "Unlock button text should exist"
+ )
+ unlockButton.tapNoIdle()
+
+ // Wait for items screen
+ let itemsScreen = app.findElement(testID: "items-screen")
+ _ = itemsScreen.waitForExistenceNoIdle(timeout: TestConfiguration.extendedTimeout)
+ }
+}
diff --git a/apps/mobile-app/ios/AliasVaultUITests/TestConfiguration.swift b/apps/mobile-app/ios/AliasVaultUITests/TestConfiguration.swift
new file mode 100644
index 000000000..293ff11f6
--- /dev/null
+++ b/apps/mobile-app/ios/AliasVaultUITests/TestConfiguration.swift
@@ -0,0 +1,24 @@
+import Foundation
+
+/// Configuration for E2E tests
+enum TestConfiguration {
+ /// API URL for testing (defaults to local development server)
+ static var apiUrl: String {
+ return ProcessInfo.processInfo.environment["API_URL"] ?? "http://localhost:5092"
+ }
+
+ /// Generate a unique name for test items
+ static func generateUniqueName(prefix: String = "E2E Test") -> String {
+ let timestamp = Int(Date().timeIntervalSince1970 * 1000)
+ return "\(prefix) \(timestamp)"
+ }
+
+ /// Default timeout for element waiting (seconds)
+ static let defaultTimeout: TimeInterval = 10
+
+ /// Extended timeout for operations that may take longer (like login with network)
+ static let extendedTimeout: TimeInterval = 30
+
+ /// Short timeout for quick checks
+ static let shortTimeout: TimeInterval = 2
+}
diff --git a/apps/mobile-app/ios/AliasVaultUITests/TestUserRegistration.swift b/apps/mobile-app/ios/AliasVaultUITests/TestUserRegistration.swift
new file mode 100644
index 000000000..3563de77a
--- /dev/null
+++ b/apps/mobile-app/ios/AliasVaultUITests/TestUserRegistration.swift
@@ -0,0 +1,403 @@
+import Foundation
+import CryptoKit
+import SQLite3
+
+// Import the Rust core SRP functions
+import RustCoreFramework
+
+// Import VaultModels for VaultVersions and VaultSql
+import VaultModels
+
+/// Test user credentials and token.
+struct TestUser {
+ let username: String
+ let password: String
+ let token: String
+ let refreshToken: String
+}
+
+/// API response models
+struct TokenResponse: Codable {
+ let token: String
+ let refreshToken: String
+}
+
+struct ApiError: Codable {
+ let title: String?
+ let message: String?
+}
+
+/// Default encryption settings for Argon2Id.
+/// These match the server defaults in AliasVault.Cryptography.Client/Defaults.cs
+enum EncryptionDefaults {
+ static let type = "Argon2Id"
+ static let iterations: UInt32 = 2
+ static let memorySize: UInt32 = 19456
+ static let parallelism: UInt32 = 1
+
+ static var settingsJson: String {
+ """
+ {"DegreeOfParallelism":\(parallelism),"MemorySize":\(memorySize),"Iterations":\(iterations)}
+ """
+ }
+}
+
+/// Test user registration helper using SRP protocol.
+/// Mirrors the browser extension's test-api.ts implementation.
+enum TestUserRegistration {
+
+ /// API URL for testing (defaults to local development server)
+ static var apiUrl: String {
+ return ProcessInfo.processInfo.environment["API_URL"] ?? "http://localhost:5092"
+ }
+
+ // MARK: - Username/Password Generation
+
+ /// Generate a random test username.
+ static func generateTestUsername() -> String {
+ let randomPart = String((0..<10).map { _ in "abcdefghijklmnopqrstuvwxyz0123456789".randomElement()! })
+ return "test_\(randomPart)@example.tld"
+ }
+
+ /// Generate a random test password.
+ static func generateTestPassword() -> String {
+ let randomPart = String((0..<15).map { _ in "abcdefghijklmnopqrstuvwxyz0123456789".randomElement()! })
+ return "TestPass_\(randomPart)!"
+ }
+
+ /// Normalize username by converting to lowercase and trimming whitespace.
+ static func normalizeUsername(_ username: String) -> String {
+ return username.lowercased().trimmingCharacters(in: .whitespaces)
+ }
+
+ // MARK: - Argon2 Key Derivation
+
+ /// Derive encryption key from password using Argon2Id via Rust core.
+ ///
+ /// Uses the AliasVault default parameters:
+ /// - Iterations: 2
+ /// - Memory: 19456 KiB
+ /// - Parallelism: 1
+ /// - Output length: 32 bytes
+ static func deriveKeyArgon2(_ password: String, salt: String) throws -> Data {
+ // Use the Rust core's Argon2 implementation
+ let hashHex = try argon2HashPassword(password: password, salt: salt)
+
+ // Convert hex string to Data
+ return try hexToBytes(hashHex)
+ }
+
+ // MARK: - Hex Conversion
+
+ /// Convert Data to uppercase hex string.
+ static func bytesToHex(_ data: Data) -> String {
+ return data.map { String(format: "%02X", $0) }.joined()
+ }
+
+ /// Convert hex string to Data.
+ static func hexToBytes(_ hex: String) throws -> Data {
+ var hex = hex.trimmingCharacters(in: .whitespaces)
+ if hex.hasPrefix("0x") || hex.hasPrefix("0X") {
+ hex = String(hex.dropFirst(2))
+ }
+
+ guard hex.count % 2 == 0 else {
+ throw NSError(domain: "TestUserRegistration", code: 3,
+ userInfo: [NSLocalizedDescriptionKey: "Invalid hex string length"])
+ }
+
+ var data = Data()
+ var index = hex.startIndex
+ while index < hex.endIndex {
+ let nextIndex = hex.index(index, offsetBy: 2)
+ guard let byte = UInt8(hex[index..<nextIndex], radix: 16) else {
+ throw NSError(domain: "TestUserRegistration", code: 4,
+ userInfo: [NSLocalizedDescriptionKey: "Invalid hex character"])
+ }
+ data.append(byte)
+ index = nextIndex
+ }
+ return data
+ }
+
+ // MARK: - Registration
+
+ /// Register a new test user via the API using SRP protocol.
+ static func registerTestUser(
+ apiBaseUrl: String,
+ username: String,
+ password: String
+ ) async throws -> TokenResponse {
+ let baseUrl = apiBaseUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/v1/"
+ let normalizedUsername = normalizeUsername(username)
+
+ // Generate salt using Rust core
+ let salt = srpGenerateSalt()
+
+ // Derive key from password
+ let encryptionKey = try deriveKeyArgon2(password, salt: salt)
+ let passwordHashHex = bytesToHex(encryptionKey)
+
+ // Derive SRP private key and verifier using Rust core
+ let privateKey = try srpDerivePrivateKey(salt: salt, identity: normalizedUsername, passwordHash: passwordHashHex)
+ let verifier = try srpDeriveVerifier(privateKey: privateKey)
+
+ // Build registration request
+ let registerRequest: [String: Any] = [
+ "username": normalizedUsername,
+ "salt": salt,
+ "verifier": verifier,
+ "encryptionType": EncryptionDefaults.type,
+ "encryptionSettings": EncryptionDefaults.settingsJson
+ ]
+
+ let requestData = try JSONSerialization.data(withJSONObject: registerRequest)
+
+ // Send registration request
+ var request = URLRequest(url: URL(string: "\(baseUrl)Auth/register")!)
+ request.httpMethod = "POST"
+ request.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ request.httpBody = requestData
+
+ let (data, response) = try await URLSession.shared.data(for: request)
+
+ guard let httpResponse = response as? HTTPURLResponse else {
+ throw NSError(domain: "TestUserRegistration", code: 5,
+ userInfo: [NSLocalizedDescriptionKey: "Invalid response"])
+ }
+
+ guard httpResponse.statusCode == 200 else {
+ let errorMessage: String
+ if let apiError = try? JSONDecoder().decode(ApiError.self, from: data) {
+ errorMessage = apiError.title ?? apiError.message ?? "Unknown error"
+ } else if let text = String(data: data, encoding: .utf8) {
+ errorMessage = text
+ } else {
+ errorMessage = "HTTP \(httpResponse.statusCode)"
+ }
+ throw NSError(domain: "TestUserRegistration", code: httpResponse.statusCode,
+ userInfo: [NSLocalizedDescriptionKey: "Registration failed: \(errorMessage)"])
+ }
+
+ let tokenResponse = try JSONDecoder().decode(TokenResponse.self, from: data)
+
+ // Upload initial empty vault
+ try await uploadInitialVault(
+ apiBaseUrl: apiBaseUrl,
+ token: tokenResponse.token,
+ username: normalizedUsername,
+ encryptionKey: encryptionKey
+ )
+
+ return tokenResponse
+ }
+
+ // MARK: - Vault Upload
+
+ /// Upload an initial empty vault to the server.
+ static func uploadInitialVault(
+ apiBaseUrl: String,
+ token: String,
+ username: String,
+ encryptionKey: Data
+ ) async throws {
+ let baseUrl = apiBaseUrl.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/v1/"
+
+ // Create empty vault database (minimal SQLite)
+ let vaultBase64 = createEmptyVaultDatabase()
+
+ // Encrypt the vault using AES-GCM
+ let encryptedVault = try symmetricEncrypt(plaintext: vaultBase64, key: encryptionKey)
+
+ // Generate RSA key pair for the vault
+ let rsaKeyPair = try generateRsaKeyPair()
+
+ // Get current timestamp
+ let now = ISO8601DateFormatter().string(from: Date())
+
+ // Build vault upload request
+ let vaultRequest: [String: Any] = [
+ "username": normalizeUsername(username),
+ "blob": encryptedVault,
+ "version": VaultVersions.latestVersion, // From auto-generated VaultVersions.swift
+ "currentRevisionNumber": VaultVersions.latestRevision,
+ "encryptionPublicKey": rsaKeyPair.publicKey,
+ "credentialsCount": 0,
+ "emailAddressList": [String](),
+ "privateEmailDomainList": [String](),
+ "hiddenPrivateEmailDomainList": [String](),
+ "publicEmailDomainList": [String](),
+ "createdAt": now,
+ "updatedAt": now
+ ]
+
+ let requestData = try JSONSerialization.data(withJSONObject: vaultRequest)
+
+ var request = URLRequest(url: URL(string: "\(baseUrl)Vault")!)
+ request.httpMethod = "POST"
+ request.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
+ request.httpBody = requestData
+
+ let (data, response) = try await URLSession.shared.data(for: request)
+
+ guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else {
+ let errorText = String(data: data, encoding: .utf8) ?? "Unknown error"
+ throw NSError(domain: "TestUserRegistration", code: 6,
+ userInfo: [NSLocalizedDescriptionKey: "Failed to upload vault: \(errorText)"])
+ }
+ }
+
+ // MARK: - Encryption Helpers
+
+ /// Encrypt data using AES-GCM (matches browser extension's EncryptionUtility).
+ static func symmetricEncrypt(plaintext: String, key: Data) throws -> String {
+ guard let plaintextData = plaintext.data(using: .utf8) else {
+ throw NSError(domain: "TestUserRegistration", code: 7,
+ userInfo: [NSLocalizedDescriptionKey: "Invalid plaintext encoding"])
+ }
+
+ let symmetricKey = SymmetricKey(data: key)
+ let sealedBox = try AES.GCM.seal(plaintextData, using: symmetricKey)
+
+ // Combined format: nonce + ciphertext + tag
+ guard let combined = sealedBox.combined else {
+ throw NSError(domain: "TestUserRegistration", code: 8,
+ userInfo: [NSLocalizedDescriptionKey: "Failed to get combined sealed box"])
+ }
+
+ return combined.base64EncodedString()
+ }
+
+ /// Generate RSA key pair for vault encryption.
+ static func generateRsaKeyPair() throws -> (publicKey: String, privateKey: String) {
+ let attributes: [String: Any] = [
+ kSecAttrKeyType as String: kSecAttrKeyTypeRSA,
+ kSecAttrKeySizeInBits as String: 2048
+ ]
+
+ var error: Unmanaged<CFError>?
+ guard let privateKey = SecKeyCreateRandomKey(attributes as CFDictionary, &error) else {
+ throw error!.takeRetainedValue() as Error
+ }
+
+ guard let publicKey = SecKeyCopyPublicKey(privateKey) else {
+ throw NSError(domain: "TestUserRegistration", code: 9,
+ userInfo: [NSLocalizedDescriptionKey: "Failed to get public key"])
+ }
+
+ // Export keys as JWK format
+ let publicKeyJwk = try exportKeyAsJwk(publicKey, isPrivate: false)
+ let privateKeyJwk = try exportKeyAsJwk(privateKey, isPrivate: true)
+
+ return (publicKeyJwk, privateKeyJwk)
+ }
+
+ /// Export a SecKey as JWK JSON string.
+ static func exportKeyAsJwk(_ key: SecKey, isPrivate: Bool) throws -> String {
+ var error: Unmanaged<CFError>?
+ guard let keyData = SecKeyCopyExternalRepresentation(key, &error) as Data? else {
+ throw error!.takeRetainedValue() as Error
+ }
+
+ // For RSA keys, create a simplified JWK
+ // This is a basic implementation - production would need full JWK encoding
+ let base64Key = keyData.base64EncodedString()
+
+ let jwk: [String: Any] = [
+ "kty": "RSA",
+ "key_ops": isPrivate ? ["decrypt"] : ["encrypt"],
+ "ext": true,
+ "key": base64Key
+ ]
+
+ let jsonData = try JSONSerialization.data(withJSONObject: jwk)
+ return String(data: jsonData, encoding: .utf8)!
+ }
+
+ // MARK: - Empty Vault Creation
+
+ /// Create an empty vault database as base64 string.
+ /// This creates a real SQLite database with the vault schema using VaultSql.completeSchema.
+ static func createEmptyVaultDatabase() -> String {
+ // Create a temporary SQLite database file
+ let tempDir = FileManager.default.temporaryDirectory
+ let dbPath = tempDir.appendingPathComponent(UUID().uuidString + ".db").path
+
+ var database: OpaquePointer?
+
+ // Open/create the database
+ guard sqlite3_open(dbPath, &database) == SQLITE_OK else {
+ print("Failed to create SQLite database")
+ return ""
+ }
+
+ defer {
+ sqlite3_close(database)
+ try? FileManager.default.removeItem(atPath: dbPath)
+ }
+
+ // Execute the complete schema SQL from VaultSql (auto-generated from TypeScript)
+ let schemaSql = VaultSql.completeSchema
+ var errorMessage: UnsafeMutablePointer<CChar>?
+
+ let result = sqlite3_exec(database, schemaSql, nil, nil, &errorMessage)
+ if result != SQLITE_OK {
+ let error = errorMessage.map { String(cString: $0) } ?? "Unknown error"
+ print("Failed to execute schema SQL: \(error)")
+ sqlite3_free(errorMessage)
+ return ""
+ }
+
+ // Read the database file and encode as base64
+ guard let dbData = FileManager.default.contents(atPath: dbPath) else {
+ print("Failed to read database file")
+ return ""
+ }
+
+ return dbData.base64EncodedString()
+ }
+
+ // MARK: - Public API
+
+ /// Create a test user with random credentials.
+ static func createTestUser(apiBaseUrl: String? = nil) async throws -> TestUser {
+ let url = apiBaseUrl ?? apiUrl
+ let username = generateTestUsername()
+ let password = generateTestPassword()
+
+ let tokenResponse = try await registerTestUser(
+ apiBaseUrl: url,
+ username: username,
+ password: password
+ )
+
+ return TestUser(
+ username: username,
+ password: password,
+ token: tokenResponse.token,
+ refreshToken: tokenResponse.refreshToken
+ )
+ }
+
+ /// Check if the API is available.
+ static func isApiAvailable(apiBaseUrl: String? = nil) async -> Bool {
+ let url = (apiBaseUrl ?? apiUrl).trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/v1/"
+
+ var request = URLRequest(url: URL(string: "\(url)Auth/status")!)
+ request.httpMethod = "GET"
+ request.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ request.timeoutInterval = 5
+
+ do {
+ let (_, response) = try await URLSession.shared.data(for: request)
+ if let httpResponse = response as? HTTPURLResponse {
+ // Status endpoint returns 401 when not authenticated, but that means API is running
+ return httpResponse.statusCode == 401 || httpResponse.statusCode == 200
+ }
+ return false
+ } catch {
+ return false
+ }
+ }
+}
diff --git a/apps/mobile-app/ios/AliasVaultUITests/XCUIElementHelpers.swift b/apps/mobile-app/ios/AliasVaultUITests/XCUIElementHelpers.swift
new file mode 100644
index 000000000..f513d417b
--- /dev/null
+++ b/apps/mobile-app/ios/AliasVaultUITests/XCUIElementHelpers.swift
@@ -0,0 +1,206 @@
+import XCTest
+
+/// Extension to help find elements by their testID (React Native accessibilityIdentifier)
+extension XCUIElementQuery {
+ /// Find an element by its testID (maps to accessibilityIdentifier in React Native)
+ @MainActor
+ func element(testID: String) -> XCUIElement {
+ return self.matching(identifier: testID).firstMatch
+ }
+}
+
+extension XCUIElement {
+ /// Wait for element to exist without waiting for app idle
+ /// This is essential for React Native apps that have continuous timers/animations
+ @MainActor
+ func waitForExistenceNoIdle(timeout: TimeInterval = 10) -> Bool {
+ let expectation = XCTNSPredicateExpectation(
+ predicate: NSPredicate(format: "exists == true"),
+ object: self
+ )
+ let result = XCTWaiter.wait(for: [expectation], timeout: timeout)
+ return result == .completed
+ }
+
+ /// Wait for element to be hittable (visible and interactable)
+ @MainActor
+ func waitForHittable(timeout: TimeInterval = 10) -> Bool {
+ let expectation = XCTNSPredicateExpectation(
+ predicate: NSPredicate(format: "isHittable == true"),
+ object: self
+ )
+ let result = XCTWaiter.wait(for: [expectation], timeout: timeout)
+ return result == .completed
+ }
+
+ /// Tap element without waiting for app idle
+ /// This is essential for React Native apps that have continuous timers/animations
+ /// Uses press(forDuration:) which bypasses idle wait unlike tap()
+ @MainActor
+ func tapNoIdle() {
+ self.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).press(forDuration: 0.01)
+ }
+
+ /// Clear text field and enter new text (no idle wait version)
+ @MainActor
+ func clearAndTypeTextNoIdle(_ text: String) {
+ guard let currentValue = self.value as? String, !currentValue.isEmpty else {
+ self.tapNoIdle()
+ self.typeText(text)
+ return
+ }
+
+ self.tapNoIdle()
+ // Select all and delete
+ let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: currentValue.count)
+ self.typeText(deleteString)
+ self.typeText(text)
+ }
+
+ /// Clear text field and enter new text
+ @MainActor
+ func clearAndTypeText(_ text: String) {
+ guard let currentValue = self.value as? String, !currentValue.isEmpty else {
+ self.tap()
+ self.typeText(text)
+ return
+ }
+
+ self.tap()
+ // Select all and delete
+ let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: currentValue.count)
+ self.typeText(deleteString)
+ self.typeText(text)
+ }
+}
+
+extension XCUIApplication {
+ /// Wait for an element with testID to exist (no idle wait - safe for React Native)
+ @MainActor
+ func waitForElement(testID: String, timeout: TimeInterval = 10) -> XCUIElement {
+ let element = self.descendants(matching: .any).matching(identifier: testID).firstMatch
+ _ = element.waitForExistenceNoIdle(timeout: timeout)
+ return element
+ }
+
+ /// Find a button by testID or text label
+ @MainActor
+ func findButton(testID: String? = nil, label: String? = nil) -> XCUIElement {
+ if let testID = testID {
+ // Check buttons first
+ let button = self.buttons.matching(identifier: testID).firstMatch
+ if button.exists {
+ return button
+ }
+ // Check other elements (React Native may render as other types)
+ return self.descendants(matching: .any).matching(identifier: testID).firstMatch
+ }
+ if let label = label {
+ return self.buttons[label]
+ }
+ fatalError("Must provide either testID or label")
+ }
+
+ /// Find a text field by testID
+ @MainActor
+ func findTextField(testID: String) -> XCUIElement {
+ // Check textFields first by identifier
+ let textField = self.textFields.matching(identifier: testID).firstMatch
+ if textField.exists {
+ return textField
+ }
+ // Check secureTextFields by identifier
+ let secureField = self.secureTextFields.matching(identifier: testID).firstMatch
+ if secureField.exists {
+ return secureField
+ }
+ // Check any element with that identifier (React Native may render as different types)
+ let anyElement = self.descendants(matching: .any).matching(identifier: testID).firstMatch
+ if anyElement.exists {
+ return anyElement
+ }
+ // Check textFields by label (fallback for some React Native versions)
+ let textFieldByLabel = self.textFields[testID]
+ if textFieldByLabel.exists {
+ return textFieldByLabel
+ }
+ // Check secureTextFields by label
+ let secureFieldByLabel = self.secureTextFields[testID]
+ if secureFieldByLabel.exists {
+ return secureFieldByLabel
+ }
+ return anyElement
+ }
+
+ /// Find any element by testID
+ @MainActor
+ func findElement(testID: String) -> XCUIElement {
+ return self.descendants(matching: .any).matching(identifier: testID).firstMatch
+ }
+
+ /// Check if element with testID exists (no idle wait - safe for React Native)
+ @MainActor
+ func elementExists(testID: String, timeout: TimeInterval = 2) -> Bool {
+ let element = self.descendants(matching: .any).matching(identifier: testID).firstMatch
+ return element.waitForExistenceNoIdle(timeout: timeout)
+ }
+
+ /// Find text element by its content
+ @MainActor
+ func findText(_ text: String) -> XCUIElement {
+ return self.staticTexts[text]
+ }
+
+ /// Wait for text to appear (no idle wait - safe for React Native)
+ @MainActor
+ func waitForText(_ text: String, timeout: TimeInterval = 10) -> Bool {
+ return self.staticTexts[text].waitForExistenceNoIdle(timeout: timeout)
+ }
+
+ /// Hide keyboard if visible (uses press to avoid idle wait)
+ @MainActor
+ func hideKeyboardIfVisible() {
+ // Try tapping outside to dismiss - uses press(forDuration:) to avoid idle wait
+ if self.keyboards.count > 0 {
+ // Tap outside the keyboard area to dismiss
+ let coordinate = self.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.3))
+ coordinate.press(forDuration: 0.01)
+ }
+ }
+
+ /// Perform pull-to-refresh gesture on a scrollable element
+ @MainActor
+ func pullToRefresh(on element: XCUIElement? = nil) {
+ let scrollView = element ?? self.scrollViews.firstMatch
+ let startPoint = scrollView.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.3))
+ let endPoint = scrollView.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.8))
+ startPoint.press(forDuration: 0.1, thenDragTo: endPoint)
+ }
+
+ /// Open a deep link URL
+ @MainActor
+ func openDeepLink(_ urlString: String) {
+ // Use Safari to trigger deep link
+ let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")
+ safari.launch()
+
+ // Wait for Safari to load
+ sleep(1)
+
+ // Tap address bar and enter URL
+ let urlBar = safari.textFields["Address"]
+ if urlBar.waitForExistence(timeout: 5) {
+ urlBar.tap()
+ urlBar.typeText(urlString + "\n")
+ }
+
+ // Handle potential "Open" dialog
+ let openButton = safari.buttons["Open"]
+ if openButton.waitForExistence(timeout: 3) {
+ openButton.tap()
+ }
+
+ // Small delay for the deep link to process
+ sleep(2)
+ }
+}
diff --git a/apps/mobile-app/ios/Podfile b/apps/mobile-app/ios/Podfile
index b826a5a59..5e548fc61 100644
--- a/apps/mobile-app/ios/Podfile
+++ b/apps/mobile-app/ios/Podfile
@@ -96,7 +96,3 @@ end
target 'VaultUI' do
pod 'Macaw', '~> 0.9.7'
end
-
-target 'VaultUITests' do
- pod 'Macaw', '~> 0.9.7'
-end
diff --git a/apps/mobile-app/ios/Podfile.lock b/apps/mobile-app/ios/Podfile.lock
index 20d366cc2..409a69c58 100644
--- a/apps/mobile-app/ios/Podfile.lock
+++ b/apps/mobile-app/ios/Podfile.lock
@@ -2912,6 +2912,6 @@ SPEC CHECKSUMS:
SWXMLHash: dd733a457e9c4fe93b1538654057aefae4acb382
Yoga: dc7c21200195acacb62fa920c588e7c2106de45e
-PODFILE CHECKSUM: ac288e273086bafdd610cafff08ccca0d164f7c3
+PODFILE CHECKSUM: c9fd83c0b06630a5c47fc37559d625af3423d649
COCOAPODS: 1.16.2
diff --git a/apps/mobile-app/ios/VaultStoreKitTests/VaultStoreKitTests.swift b/apps/mobile-app/ios/VaultStoreKitTests/VaultStoreKitTests.swift
index f97659330..f80badb9b 100644
--- a/apps/mobile-app/ios/VaultStoreKitTests/VaultStoreKitTests.swift
+++ b/apps/mobile-app/ios/VaultStoreKitTests/VaultStoreKitTests.swift
@@ -45,45 +45,44 @@ final public class VaultStoreKitTests: XCTestCase {
XCTAssertTrue(vaultStore.isVaultUnlocked, "Vault should be unlocked after initialization")
}
- func testGetAllCredentials() async throws {
- // Try to get all credentials
- let credentials = try vaultStore.getAllCredentials()
-
- // Verify we got some credentials back
- XCTAssertFalse(credentials.isEmpty, "Should have retrieved some credentials")
-
- // Verify the structure of the first credential
- if let firstCredential = credentials.first {
- XCTAssertNotNil(firstCredential.id, "Credential should have an ID")
- XCTAssertNotNil(firstCredential.service, "Credential should have a service")
- XCTAssertNotNil(firstCredential.password, "Credential should have a password")
+ func testGetAllItems() async throws {
+ // Try to get all items
+ let items = try vaultStore.getAllItems()
+
+ // Verify we got some items back
+ XCTAssertFalse(items.isEmpty, "Should have retrieved some items")
+
+ // Verify the structure of the first item
+ if let firstItem = items.first {
+ XCTAssertNotNil(firstItem.id, "Item should have an ID")
+ XCTAssertNotNil(firstItem.name, "Item should have a name")
+ XCTAssertNotNil(firstItem.password, "Item should have a password")
}
}
/**
- * This test verifies that the Gmail credential details are correct including
- * the expectedlogo binary data.
+ * This test verifies that the Gmail item details are correct including
+ * the expected logo binary data.
*/
- func testGetGmailCredentialDetails() async throws {
- // Get all credentials
- let credentials = try vaultStore.getAllCredentials()
+ func testGetGmailItemDetails() async throws {
+ // Get all items
+ let items = try vaultStore.getAllItems()
- // Find the Gmail credential
- let gmailCredential = credentials.first { $0.service.name == "Gmail Test Account" }
- XCTAssertNotNil(gmailCredential, "Gmail Test Account credential should exist")
+ // Find the Gmail item
+ let gmailItem = items.first { $0.name == "Gmail Test Account" }
+ XCTAssertNotNil(gmailItem, "Gmail Test Account item should exist")
- if let gmail = gmailCredential {
+ if let gmail = gmailItem {
// Verify all expected properties
- XCTAssertEqual(gmail.service.name, "Gmail Test Account")
- XCTAssertEqual(gmail.service.url, "https://google.com")
+ XCTAssertEqual(gmail.name, "Gmail Test Account")
+ XCTAssertEqual(gmail.url, "https://google.com")
XCTAssertEqual(gmail.username, "[email protected]")
- XCTAssertEqual(gmail.alias?.firstName, "Test")
- XCTAssertEqual(gmail.alias?.lastName, "User")
- XCTAssertEqual(gmail.notes, "Test Gmail account for unit testing")
+ XCTAssertEqual(gmail.firstName, "Test")
+ XCTAssertEqual(gmail.lastName, "User")
// Verify logo exists and has sufficient size
- XCTAssertNotNil(gmail.service.logo, "Service logo should not be nil")
- if let logoData = gmail.service.logo {
+ XCTAssertNotNil(gmail.logo, "Item logo should not be nil")
+ if let logoData = gmail.logo {
XCTAssertGreaterThan(logoData.count, 1024, "Logo data should exceed 1KB in size")
}
}