Skip to content

Commit

Permalink
Automated UI tests for authentication flows.
Browse files Browse the repository at this point in the history
  • Loading branch information
tijme committed Jun 26, 2023
1 parent 416ef5f commit bb6dbc0
Show file tree
Hide file tree
Showing 13 changed files with 276 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .semver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.17
1.4.18
32 changes: 28 additions & 4 deletions Raivo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
70684DEF225A1BF70038BDB4 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70684DEE225A1BF70038BDB4 /* main.swift */; };
70684DF1225A2ED90038BDB4 /* MiscellaneousForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70684DF0225A2ED90038BDB4 /* MiscellaneousForm.swift */; };
70684DF4225A37630038BDB4 /* MiscellaneousInactivityLockFormOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70684DF3225A37630038BDB4 /* MiscellaneousInactivityLockFormOption.swift */; };
706ED9BD2A4A218E00CE66D6 /* AuthRoboticTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 706ED9BC2A4A218E00CE66D6 /* AuthRoboticTest.swift */; };
706ED9BF2A4A21FB00CE66D6 /* AuthFlowHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 706ED9BE2A4A21FB00CE66D6 /* AuthFlowHelper.swift */; };
706FD81522EB71A500F433F7 /* QuickResponseCodeForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 706FD81422EB71A500F433F7 /* QuickResponseCodeForm.swift */; };
7076C22622E7909000AFBDD9 /* MainQuickResponseCodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7076C22522E7909000AFBDD9 /* MainQuickResponseCodeViewController.swift */; };
7077A337227CC84F00338CA3 /* PasswordAlgorithmFormOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7077A336227CC84F00338CA3 /* PasswordAlgorithmFormOption.swift */; };
Expand Down Expand Up @@ -290,6 +292,8 @@
70684DEE225A1BF70038BDB4 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
70684DF0225A2ED90038BDB4 /* MiscellaneousForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MiscellaneousForm.swift; sourceTree = "<group>"; };
70684DF3225A37630038BDB4 /* MiscellaneousInactivityLockFormOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MiscellaneousInactivityLockFormOption.swift; sourceTree = "<group>"; };
706ED9BC2A4A218E00CE66D6 /* AuthRoboticTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthRoboticTest.swift; sourceTree = "<group>"; };
706ED9BE2A4A21FB00CE66D6 /* AuthFlowHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthFlowHelper.swift; sourceTree = "<group>"; };
706FD81422EB71A500F433F7 /* QuickResponseCodeForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickResponseCodeForm.swift; sourceTree = "<group>"; };
7076C22522E7909000AFBDD9 /* MainQuickResponseCodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainQuickResponseCodeViewController.swift; sourceTree = "<group>"; };
7077A336227CC84F00338CA3 /* PasswordAlgorithmFormOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordAlgorithmFormOption.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -663,6 +667,7 @@
isa = PBXGroup;
children = (
70F2DB80238D9A4C00CFF63F /* SetupFlowHelper.swift */,
706ED9BE2A4A21FB00CE66D6 /* AuthFlowHelper.swift */,
);
path = Flows;
sourceTree = "<group>";
Expand Down Expand Up @@ -768,6 +773,14 @@
path = Options;
sourceTree = "<group>";
};
706ED9BB2A4A215100CE66D6 /* Auth */ = {
isa = PBXGroup;
children = (
706ED9BC2A4A218E00CE66D6 /* AuthRoboticTest.swift */,
);
path = Auth;
sourceTree = "<group>";
};
7077A333227CC75E00338CA3 /* Rows */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1077,6 +1090,7 @@
70F2DB7C238D4E4700CFF63F /* Flows */ = {
isa = PBXGroup;
children = (
706ED9BB2A4A215100CE66D6 /* Auth */,
70F64B53238EF3B300A5F56E /* Setup */,
);
path = Flows;
Expand Down Expand Up @@ -1458,7 +1472,9 @@
buildActionMask = 2147483647;
files = (
701ECE3C23D387700015D12A /* HumanDelayHelper.swift in Sources */,
706ED9BD2A4A218E00CE66D6 /* AuthRoboticTest.swift in Sources */,
70F2DB81238D9A4C00CFF63F /* SetupFlowHelper.swift in Sources */,
706ED9BF2A4A21FB00CE66D6 /* AuthFlowHelper.swift in Sources */,
70F64B76238F082400A5F56E /* BiometricHelper.swift in Sources */,
70631CAE230DC2A10040DD71 /* SetupRoboticTest.swift in Sources */,
);
Expand Down Expand Up @@ -1621,7 +1637,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Raivo/Raivo.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 82;
CURRENT_PROJECT_VERSION = 83;
DEVELOPMENT_TEAM = 564B4ETY69;
INFOPLIST_FILE = "$(SRCROOT)/Raivo/Supporting/Info.plist";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
Expand All @@ -1630,7 +1646,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.17;
MARKETING_VERSION = 1.4.18;
PRODUCT_BUNDLE_IDENTIFIER = com.finnwea.Raivo.Debug;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand All @@ -1648,7 +1664,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Raivo/Raivo.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 82;
CURRENT_PROJECT_VERSION = 83;
DEVELOPMENT_TEAM = 564B4ETY69;
INFOPLIST_FILE = "$(SRCROOT)/Raivo/Supporting/Info.plist";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
Expand All @@ -1657,7 +1673,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.17;
MARKETING_VERSION = 1.4.18;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand All @@ -1673,13 +1689,17 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 564B4ETY69;
INFOPLIST_FILE = RaivoUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.finnwea.RaivoUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Raivo;
Expand All @@ -1692,13 +1712,17 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 564B4ETY69;
INFOPLIST_FILE = RaivoUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.finnwea.RaivoUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Raivo;
Expand Down
1 change: 1 addition & 0 deletions Raivo/Controllers/Auth/AuthEntryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AuthEntryViewController: UIViewController, UIPasscodeFieldDelegate {

biometricButton.isHidden = !StorageHelper.shared.getBiometricUnlockEnabled()

passcodeField.shadowAccessibilityIdentifier = "passcode"
passcodeField.delegate = self
passcodeField.layoutIfNeeded()

Expand Down
1 change: 1 addition & 0 deletions Raivo/Forms/MiscellaneousForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ class MiscellaneousForm {

<<< ButtonRow("sign_out", { row in
row.title = "Sign out of Raivo"
row.cell.accessibilityIdentifier = "miscSignOut"
}).cellUpdate({ cell, row in
cell.textLabel?.textAlignment = .left
cell.imageView?.image = UIImage(named: "form-logout")
Expand Down
3 changes: 3 additions & 0 deletions Raivo/Helpers/AppHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,7 @@ class AppHelper {
/// If the current runtime should reset the app state before startup
public static let argumentResetState = CommandLine.arguments.contains("--ResetState")

/// If the current runtime should disable biometric unlock
public static let argumentDisableBiometrics = CommandLine.arguments.contains("--DisableBiometrics")

}
4 changes: 4 additions & 0 deletions Raivo/Helpers/StorageHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ class StorageHelper {
///
/// - Returns: Positive if biometric unlock is enabled
public func getBiometricUnlockEnabled() -> Bool {
guard !AppHelper.argumentDisableBiometrics else {
return false
}

guard let enabled = try? globals().string(forKey: Key.BIOMETRIC_AUTHENTICATION_ENABLED) else {
return false
}
Expand Down
13 changes: 7 additions & 6 deletions Raivo/Storyboards/Auth.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -30,7 +30,7 @@
<objects>
<navigationController restorationIdentifier="AuthRootController" storyboardIdentifier="AuthRootController" id="gmH-zH-eht" customClass="AuthRootViewController" customModule="Raivo" customModuleProvider="target" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="NvE-Ep-Hsc">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<rect key="frame" x="0.0" y="48" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
Expand All @@ -53,13 +53,13 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oRd-ny-Rp6" userLabel="Wrapper">
<rect key="frame" x="0.0" y="88" width="414" height="774"/>
<rect key="frame" x="0.0" y="92" width="414" height="770"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PVE-R8-zi7" userLabel="Content">
<rect key="frame" x="0.0" y="0.0" width="414" height="774"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="770"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="5nT-3F-W59">
<rect key="frame" x="0.0" y="236" width="414" height="302"/>
<rect key="frame" x="0.0" y="234" width="414" height="302"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="app-icon" translatesAutoresizingMaskIntoConstraints="NO" id="GWG-jo-ayS" userLabel="Logo">
<rect key="frame" x="127" y="0.0" width="160" height="160"/>
Expand Down Expand Up @@ -127,6 +127,7 @@
</subviews>
<viewLayoutGuide key="safeArea" id="q9X-y2-Q3g"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<accessibility key="accessibilityConfiguration" identifier="authEntry"/>
<constraints>
<constraint firstItem="q9X-y2-Q3g" firstAttribute="trailing" secondItem="oRd-ny-Rp6" secondAttribute="trailing" id="23Z-bq-p2y"/>
<constraint firstAttribute="bottom" secondItem="Vz1-KG-knS" secondAttribute="bottom" id="K1l-BU-u1v"/>
Expand Down
Loading

0 comments on commit bb6dbc0

Please sign in to comment.