Skip to content

Commit

Permalink
Merge pull request gini#729 from gini/Add-automation-tests
Browse files Browse the repository at this point in the history
Add automation tests
  • Loading branch information
ValentinaIancu-Gini authored Dec 5, 2024
2 parents e4b4c02 + d86a4d3 commit f9eaa64
Show file tree
Hide file tree
Showing 28 changed files with 2,714 additions and 2 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@
ReferencedContainer = "container:GiniBankSDKExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D7E50A5E2C32D0AD004C1CBF"
BuildableName = "GiniBankSDKExampleUITests.xctest"
BlueprintName = "GiniBankSDKExampleUITests"
ReferencedContainer = "container:GiniBankSDKExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand All @@ -42,6 +56,156 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D7E50A5E2C32D0AD004C1CBF"
BuildableName = "GiniBankSDKExampleUITests.xctest"
BlueprintName = "GiniBankSDKExampleUITests"
ReferencedContainer = "container:GiniBankSDKExample.xcodeproj">
</BuildableReference>
<SelectedTests>
<Test
Identifier = "GiniCameraAccessScreenUITests/testCameraAccessScreenBackButton()">
</Test>
<Test
Identifier = "GiniCameraAccessScreenUITests/testCameraAccessScreenGiveAccessButton()">
</Test>
<Test
Identifier = "GiniCameraAccessScreenUITests/testCameraAccessScreenHelpButton()">
</Test>
<Test
Identifier = "GiniCaptureScreenUITests/testCancelButtonInMenu()">
</Test>
<Test
Identifier = "GiniCaptureScreenUITests/testCancelNavigationButton()">
</Test>
<Test
Identifier = "GiniCaptureScreenUITests/testFlashButton()">
</Test>
<Test
Identifier = "GiniCaptureScreenUITests/testUploadFilesButtonInMenu()">
</Test>
<Test
Identifier = "GiniCaptureScreenUITests/testUploadPhotosButtonInMenu()">
</Test>
<Test
Identifier = "GiniErrorScreenUITests/testErrorScreenBackToCamera()">
</Test>
<Test
Identifier = "GiniErrorScreenUITests/testErrorScreenCancelButton()">
</Test>
<Test
Identifier = "GiniErrorScreenUITests/testErrorScreenEnterManually()">
</Test>
<Test
Identifier = "GiniHelpScreenUITests/testHelpScreenImportDocumentsButton()">
</Test>
<Test
Identifier = "GiniHelpScreenUITests/testHelpScreenSupportedFormatsButton()">
</Test>
<Test
Identifier = "GiniHelpScreenUITests/testHelpScreenTipsButton()">
</Test>
<Test
Identifier = "GiniMainScreenUITests/testMainScreenPhotopaymentButton()">
</Test>
<Test
Identifier = "GiniOnboardingScreenUITest/testOnboardingGetStartedButton()">
</Test>
<Test
Identifier = "GiniOnboardingScreenUITest/testOnboardingSkipButton()">
</Test>
<Test
Identifier = "GiniOnboardingScreenUITest/testOnboardingSwipeAction()">
</Test>
<Test
Identifier = "GiniOnboardingScreenUITest/testOnboardingSwipeActionBottomNavBar()">
</Test>
<Test
Identifier = "GiniOnboardingScreenUITest/testOnboardingSwipeActionCustomBottomNavBar()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistant()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistantCancelButton()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistantDisableSwitch()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistantEditName()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistantEditPrice()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistantEditQuantity()">
</Test>
<Test
Identifier = "GiniReturnAssistantScreenUITests/testReturnAssistantHelpButton()">
</Test>
<Test
Identifier = "GiniReviewScreenUITests/testAddPageButton()">
</Test>
<Test
Identifier = "GiniReviewScreenUITests/testCancelButton()">
</Test>
<Test
Identifier = "GiniReviewScreenUITests/testDeleteButton()">
</Test>
<Test
Identifier = "GiniReviewScreenUITests/testProcessButton()">
</Test>
<Test
Identifier = "GiniSkontoScreenUITests/testSkonto()">
</Test>
<Test
Identifier = "GiniSkontoScreenUITests/testSkontoBackButton()">
</Test>
<Test
Identifier = "GiniSkontoScreenUITests/testSkontoHelpButtonbo()">
</Test>
<Test
Identifier = "GiniSkontoScreenUITests/testSkontoInFuture()">
</Test>
<Test
Identifier = "GiniSkontoScreenUITests/testSkontoInPast()">
</Test>
<Test
Identifier = "GiniSkontoScreenUITests/testSkontoSwitch()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testAlwaysAttach()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testAttachOnlyThisTransaction()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testBackButtonFromPreviewScreen()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testDeleteDocumentFromExtractions()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testDeleteDocumentFromPreview()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testDontAttach()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testEditMenuCancelButtonExtractionScreen()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testEditMenuCancelButtonPreviewScreen()">
</Test>
<Test
Identifier = "TransactionDocsScreenUITests/testOpenDocument()">
</Test>
</SelectedTests>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@
ReferencedContainer = "container:GiniBankSDKExample.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2870684C2CB9670200D5F2C9"
BuildableName = "GiniBankSDKExampleUITests.xctest"
BlueprintName = "GiniBankSDKExampleUITests"
ReferencedContainer = "container:GiniBankSDKExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down Expand Up @@ -92,6 +103,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F490C7FC25DE87A800D8CA6F"
BuildableName = "GiniBankSDKExampleTests.xctest"
BlueprintName = "GiniBankSDKExampleTests"
ReferencedContainer = "container:GiniBankSDKExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ final class DemoViewController: UIViewController {
private func configureWelcomeTitle() {
welcomeTitleTopConstraint.constant = Constants.welcomeTitleTopConstant
welcomeTitlte.text = DemoScreenStrings.welcomeTitle.localized
welcomeTitlte.accessibilityIdentifier = MainScreenAccessibilityIdentifiers.welcomeTextTitle.rawValue
}

private func configureIbanTextField() {
Expand Down Expand Up @@ -101,7 +102,9 @@ final class DemoViewController: UIViewController {

let iconTapGesture = UITapGestureRecognizer(target: self, action: #selector(ibanCameraIconTapped))
ibanTextField.rightView?.addGestureRecognizer(iconTapGesture)

ibanTextField.accessibilityIdentifier = MainScreenAccessibilityIdentifiers.ibanTextField.rawValue
cameraIcon.accessibilityIdentifier = MainScreenAccessibilityIdentifiers.cameraIconButton.rawValue

UITextField.appearance().tintColor = ColorPalette.giniBlue
}
}
Expand All @@ -126,11 +129,13 @@ final class DemoViewController: UIViewController {
photoPaymentButton.backgroundColor = itemBackgroundColor
photoPaymentButton.setTitle(DemoScreenStrings.photoPaymentButtonTitle.localized, for: .normal)
photoPaymentButton.setTitleColor(textColor, for: .normal)
photoPaymentButton.accessibilityIdentifier = MainScreenAccessibilityIdentifiers.photoPaymentButton.rawValue
}

private func configureScreenDescriptionTitle() {
descriptionTitle.text = DemoScreenStrings.screenDescription.localized
descriptionTitle.textColor = textColor
descriptionTitle.accessibilityIdentifier = MainScreenAccessibilityIdentifiers.descriptionTextTitle.rawValue
}

private func configureMetaTitle() {
Expand All @@ -140,6 +145,7 @@ final class DemoViewController: UIViewController {
metaInformationLabel.textColor = textColor
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.launchSettings))
metaInformationLabel.addGestureRecognizer(tapGesture)
metaInformationLabel.accessibilityIdentifier = MainScreenAccessibilityIdentifiers.metaInformationLabel.rawValue
}

private func startSDK(entryPoint: GiniConfiguration.GiniEntryPoint) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// MainScreenAccessibilityIdentifiers.swift
//
// Copyright © 2024 Gini GmbH. All rights reserved.
//


import Foundation
public enum MainScreenAccessibilityIdentifiers: String {
case photoPaymentButton = "photoPaymentButtonIdentifier"
case cameraIconButton = "cameraIconButtonIdentifier"
case ibanTextField = "ibanTextFieldIdentifier"
case welcomeTextTitle = "welcomeTextTitleIdentifier"
case descriptionTextTitle = "descriptionTextTitleIdentifier"
case metaInformationLabel = "metaInformationLabelIdentifier"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// SettingScreenAccessibilityIdentifiers.swift
//
// Copyright © 2024 Gini GmbH. All rights reserved.
//


import Foundation
public enum SettingScreenAccessibilityIdentifiers: String {
case closeButton = "closeButtonIdentifier"
case qrCodeScanSwitch = "qrCodeScanSwitchIdentifier"
case qrCodeScanOnlySwitch = "qrCodeScanOnlySwitchIdentifier"
case multiPageSwitch = "multipageSwitch"
case flashToggleSwitch = "flashToggleSwitchIdentifier"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// GiniBankSDKExampleUITests.swift
//
// Copyright © 2024 Gini GmbH. All rights reserved.
//



import XCTest
import GiniCaptureSDK
import GiniBankSDK

class GiniBankSDKExampleUITests: XCTestCase {

var app: XCUIApplication!
var mainScreen: MainScreen!
var helpScreen: HelpScreen!
var settingScreen: SettingScreen!
var captureScreen: CaptureScreen!
var errorScreen: ErrorScreen!
var cameraAccessScreen: CameraAccessScreen!
var onboadingScreen: OnboardingScreen!
var skontoScreen: SkontoScreen!
var returnAssistantScreen: ReturnAssistantScreen!
var reviewScreen: ReviewScreen!
var transactionDocsScreen: TransactionDocsScreen!
var isSimulator = true

override func setUpWithError() throws {

if isSimulator {
throw XCTSkip("Skipping test")
}
continueAfterFailure = false
app = XCUIApplication()
app.launchArguments = ["-testing"]
app.launch()
//Initialize Identifiers based on current locale
let currentLocale = Locale.current.languageCode ?? "en"
mainScreen = MainScreen(app: app, locale: currentLocale)
helpScreen = HelpScreen(app: app, locale: currentLocale)
settingScreen = SettingScreen(app: app, locale: currentLocale)
captureScreen = CaptureScreen(app: app, locale: currentLocale)
errorScreen = ErrorScreen(app: app, locale: currentLocale)
cameraAccessScreen = CameraAccessScreen(app: app, locale: currentLocale)
onboadingScreen = OnboardingScreen(app: app, locale: currentLocale)
skontoScreen = SkontoScreen(app: app, locale: currentLocale)
returnAssistantScreen = ReturnAssistantScreen(app: app, locale: currentLocale)
reviewScreen = ReviewScreen(app: app, locale: currentLocale)
transactionDocsScreen = TransactionDocsScreen(app: app, locale: currentLocale)
}

override func tearDownWithError() throws {
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
if !isSimulator {
attachment.lifetime = .deleteOnSuccess
add(attachment)
app.terminate()
}
}
}
Loading

0 comments on commit f9eaa64

Please sign in to comment.