-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from khipu/geolocation
adds geolocation managment
- Loading branch information
Showing
26 changed files
with
588 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ DerivedData | |
*.hmap | ||
*.ipa | ||
.idea/* | ||
.vscode/* | ||
|
||
# Bundler | ||
.bundle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
Example/Tests/Components/LocationAccessRequestComponentTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import XCTest | ||
import SwiftUI | ||
import ViewInspector | ||
@testable import KhipuClientIOS | ||
|
||
@available(iOS 15.0.0, *) | ||
final class LocationAccessRequestComponentTests: XCTestCase { | ||
|
||
func testLocationRequestWarningViewRendersCorrectly() throws { | ||
let translator = MockDataGenerator.createTranslator() | ||
let themeManager = ThemeManager() | ||
let expectationContinue = expectation(description: "Continue button tapped") | ||
let expectationDecline = expectation(description: "Decline button tapped") | ||
|
||
let view = LocationRequestWarningView( | ||
translator: translator, | ||
operationId: "test-operation", | ||
bank: "Test Bank", | ||
continueButton: { expectationContinue.fulfill() }, | ||
declineButton: { expectationDecline.fulfill() } | ||
).environmentObject(themeManager) | ||
|
||
let inspector = try view.inspect() | ||
|
||
let titleText = try inspector.find(text: translator.t("geolocation.warning.title").replacingOccurrences(of: "{{bank}}", with: "Test Bank")).string() | ||
XCTAssertEqual(titleText, "Test Bank solicita comprobar tu ubicación") | ||
|
||
let descriptionText = try inspector.find(text: translator.t("geolocation.warning.description")).string() | ||
XCTAssertEqual(descriptionText, "A continuación, se solicitará conocer tu ubicación.") | ||
|
||
let continueButton = try inspector.find(button: translator.t("geolocation.warning.button.continue")) | ||
XCTAssertEqual(try continueButton.labelView().text().string(), "Ir a activar ubicación") | ||
try continueButton.tap() | ||
|
||
let declineButton = try inspector.find(button: translator.t("geolocation.warning.button.decline")) | ||
XCTAssertEqual(try declineButton.labelView().text().string(), "No activar ubicación") | ||
try declineButton.tap() | ||
|
||
wait(for: [expectationContinue, expectationDecline], timeout: 1.0) | ||
} | ||
|
||
func testLocationAccessErrorViewRendersCorrectly() throws { | ||
let translator = MockDataGenerator.createTranslator() | ||
let themeManager = ThemeManager() | ||
let expectationContinue = expectation(description: "Continue button tapped") | ||
let expectationDecline = expectation(description: "Decline button tapped") | ||
|
||
let view = LocationAccessErrorView( | ||
translator: translator, | ||
operationId: "test-operation", | ||
bank: "Test Bank", | ||
continueButton: { expectationContinue.fulfill() }, | ||
declineButton: { expectationDecline.fulfill() } | ||
).environmentObject(themeManager) | ||
|
||
let inspector = try view.inspect() | ||
|
||
let titleText = try inspector.find(text: translator.t("geolocation.blocked.title")).string() | ||
XCTAssertEqual(titleText, "Restablece el permiso de ubicación para continuar") | ||
|
||
let descriptionText = try inspector.find(text: translator.t("geolocation.blocked.description").replacingOccurrences(of: "{{bank}}", with: "Test Bank")).string() | ||
XCTAssertEqual(descriptionText, "Activar este permiso es necesario para completar el pago en Test Bank.") | ||
|
||
let continueButton = try inspector.find(button: translator.t("geolocation.blocked.button.continue")) | ||
XCTAssertEqual(try continueButton.labelView().text().string(), "Activar permiso de ubicación") | ||
try continueButton.tap() | ||
|
||
let declineButton = try inspector.find(button: translator.t("geolocation.blocked.button.decline")) | ||
XCTAssertEqual(try declineButton.labelView().text().string(), "Salir") | ||
try declineButton.tap() | ||
|
||
wait(for: [expectationContinue, expectationDecline], timeout: 1.0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.