Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ class AfterpayPriceBreakdownViewSnapshotTests: STPSnapshotTestCase {
return containingView
}

func testClearpayInMultiRow() {
NSLocale.stp_withLocale(as: NSLocale(localeIdentifier: "en_GB")) { [self] in
let priceBreakdownView = AfterpayPriceBreakdownView(currency: "gbp")
let containingView = embedInRenderableView(priceBreakdownView, width: 320, height: 50)

STPSnapshotVerifyView(containingView)
}
}

func testAfterpayInSingleRow() {
let priceBreakdownView = AfterpayPriceBreakdownView(currency: "eur")
let containingView = embedInRenderableView(priceBreakdownView, width: 500, height: 30)
Expand Down
6 changes: 5 additions & 1 deletion Stripe/StripeiOSTests/NSDictionary+StripeTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@ class Dictionary_StripeTest: XCTestCase {
"b": "not a url",
] as [AnyHashable: Any]
XCTAssertEqual(dict.stp_url(forKey: "a"), URL(string: "https://example.com"))
XCTAssertNil(dict.stp_url(forKey: "b"))
if #available(iOS 17.0, *) { // In iOS 17 or later, instead of returning `nil` this will be a valid but escaped URL.
XCTAssertEqual(dict.stp_url(forKey: "b"), URL(string: "not%20a%20url"))
} else {
XCTAssertNil(dict.stp_url(forKey: "b"))
}
XCTAssertNil(dict.stp_url(forKey: "c"))
}
}
96 changes: 0 additions & 96 deletions Stripe/StripeiOSTests/NSLocale+STPSwizzling.swift

This file was deleted.

77 changes: 26 additions & 51 deletions Stripe/StripeiOSTests/STPCardFormViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,25 @@ class STPCardFormViewTests: XCTestCase {
}
}

func testHidingPostalCodeOnInit() {
NSLocale.stp_withLocale(as: NSLocale(localeIdentifier: "zh_Hans_HK")) {
let cardForm = STPCardFormView()
XCTAssertTrue(cardForm.postalCodeField.isHidden)
}
}

func testHidingPostalUPECodeOnInit() {
NSLocale.stp_withLocale(as: NSLocale(localeIdentifier: "zh_Hans_HK")) {
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: nil
)
XCTAssertTrue(cardForm.postalCodeField.isHidden)
}
}

func testNotHidingPostalUPECodeOnInit() {
NSLocale.stp_withLocale(as: NSLocale(localeIdentifier: "en_US")) {
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: nil
)
XCTAssertFalse(cardForm.postalCodeField.isHidden)
}
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: nil
)
XCTAssertFalse(cardForm.postalCodeField.isHidden)
}

func testPanLockedOnInit() {
NSLocale.stp_withLocale(as: NSLocale(localeIdentifier: "en_US")) {
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: nil,
inputMode: .panLocked
)
XCTAssertFalse(cardForm.numberField.isUserInteractionEnabled)
}
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: nil,
inputMode: .panLocked
)
XCTAssertFalse(cardForm.numberField.isUserInteractionEnabled)
}

func testPrefilledOnInit() {
Expand All @@ -123,20 +100,18 @@ class STPCardFormViewTests: XCTestCase {
expiryYear: 25,
cardBrand: .amex
)
NSLocale.stp_withLocale(as: NSLocale(localeIdentifier: "en_US")) {
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: prefillDeatils,
inputMode: .panLocked
)
let cardForm = STPCardFormView(
billingAddressCollection: .automatic,
style: .standard,
postalCodeRequirement: .upe,
prefillDetails: prefillDeatils,
inputMode: .panLocked
)

XCTAssertEqual(cardForm.numberField.text, prefillDeatils.formattedLast4)
XCTAssertEqual(cardForm.numberField.cardBrandState.brand, prefillDeatils.cardBrand)
XCTAssertEqual(cardForm.expiryField.text, prefillDeatils.formattedExpiry)
XCTAssertEqual(cardForm.cvcField.cardBrand, prefillDeatils.cardBrand)
}
XCTAssertEqual(cardForm.numberField.text, prefillDeatils.formattedLast4)
XCTAssertEqual(cardForm.numberField.cardBrandState.brand, prefillDeatils.cardBrand)
XCTAssertEqual(cardForm.expiryField.text, prefillDeatils.formattedExpiry)
XCTAssertEqual(cardForm.cvcField.cardBrand, prefillDeatils.cardBrand)
}

func testCBCWithPreferredNetwork() {
Expand Down
4 changes: 2 additions & 2 deletions Stripe/StripeiOSTests/STPIntentActionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class STPIntentActionTest: XCTestCase {
[
"type": "redirect_to_url",
"redirect_to_url": [
"url": "not a url"
"url": ""
],
])
XCTAssertNotNil(badURL)
Expand Down Expand Up @@ -72,7 +72,7 @@ class STPIntentActionTest: XCTestCase {
"type": "redirect_to_url",
"redirect_to_url": [
"url": "https://stripe.com/",
"return_url": "not a url",
"return_url": "",
],
])
XCTAssertNotNil(badReturnURL)
Expand Down
8 changes: 4 additions & 4 deletions StripeCore/StripeCoreTestUtils/STPSnapshotTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import iOSSnapshotTestCase

let TEST_DEVICE_MODEL = "iPhone13,1" // iPhone 12 mini
let TEST_DEVICE_OS_VERSION = "16.4"
let TEST_DEVICE_OS_VERSION_26_1 = "26.1"
let TEST_DEVICE_OS_VERSION_26_2 = "26.2"

open class STPSnapshotTestCase: FBSnapshotTestCase {

Expand All @@ -20,16 +20,16 @@ open class STPSnapshotTestCase: FBSnapshotTestCase {
let deviceModel = ProcessInfo.processInfo.environment["SIMULATOR_MODEL_IDENTIFIER"]!
recordMode = ProcessInfo.processInfo.environment["STP_RECORD_SNAPSHOTS"] != nil
guard deviceModel == TEST_DEVICE_MODEL,
[TEST_DEVICE_OS_VERSION, TEST_DEVICE_OS_VERSION_26_1].contains(UIDevice.current.systemVersion)
[TEST_DEVICE_OS_VERSION, TEST_DEVICE_OS_VERSION_26_2].contains(UIDevice.current.systemVersion)
else {
continueAfterFailure = false
XCTFail("You must run snapshot tests on \(TEST_DEVICE_MODEL) running \(TEST_DEVICE_OS_VERSION) or \(TEST_DEVICE_OS_VERSION_26_1). You are running these tests on a \(deviceModel) on \(UIDevice.current.systemVersion).")
XCTFail("You must run snapshot tests on \(TEST_DEVICE_MODEL) running \(TEST_DEVICE_OS_VERSION) or \(TEST_DEVICE_OS_VERSION_26_2). You are running these tests on a \(deviceModel) on \(UIDevice.current.systemVersion).")
return
}
}

var isIOS26_1: Bool {
let isiOS26_1 = UIDevice.current.systemVersion == TEST_DEVICE_OS_VERSION_26_1
let isiOS26_1 = UIDevice.current.systemVersion == TEST_DEVICE_OS_VERSION_26_2
#if compiler(>=6.2.1)
let isXcode26_1 = true
#else
Expand Down
Binary file modified ...entViewControllerSnapshotTest/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...erSnapshotTest/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ndividualViewControllerSnapshotTest/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...omeViewControllerSnapshotTest/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...uccessViewControllerSnapshotTest/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...sts.AddressViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ssViewControllerSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...ViewControllerSnapshotTests/[email protected]
Binary file modified ...ssViewControllerSnapshotTests/[email protected]
Binary file modified ...wControllerSnapshotTests/[email protected]
Binary file modified ...ntSheetTests.LinkButtonSnapshotTests/[email protected]
Binary file modified ...ntSheetTests.LinkButtonSnapshotTests/[email protected]
Binary file modified ...SheetTests.LinkButtonSnapshotTests/[email protected]
Binary file modified ...nViewSnapshotTests/[email protected]
Binary file modified ...Tests.LinkSignUpViewControllerSnapshotTests/[email protected]
Binary file modified ...ePaymentSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...PaymentSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...ntSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...ntSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...tSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...ymentSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...PaymentSheetSnapshotTests/[email protected]
Binary file modified ...mentSheetSnapshotTests/[email protected]
Binary file modified ...Tests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...heetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...tTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...s.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...eetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...aymentSheetSnapshotTests/[email protected]
Binary file modified ...tSnapshotTests/[email protected]
Binary file modified ...ntSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...sts.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...eetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...tTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...SheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...heetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...mentSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...ests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...tTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...sts.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...heetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...ests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ....PaymentSheetSnapshotTests/[email protected]
Binary file modified ...ests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...SheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...tSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...entSheetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...Tests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...eetTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...etTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...tTests.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...mentSheetSnapshotTests/[email protected]
Binary file modified ...s.PaymentSheetSnapshotTests/[email protected]
Binary file modified ...heetVerticalViewControllerSnapshotTest/[email protected]
Binary file modified ...icalViewControllerSnapshotTest/[email protected]
Binary file modified ...eetVerticalViewControllerSnapshotTest/[email protected]
Binary file modified ...alViewControllerSnapshotTest/[email protected]
Binary file modified ...lViewControllerSnapshotTest/[email protected]
Binary file modified ...ViewControllerSnapshotTest/[email protected]
Binary file modified ...ontrollerSnapshotTest/[email protected]
Binary file modified ...ontrollerSnapshotTest/[email protected]
Binary file modified ...icalViewControllerSnapshotTest/[email protected]
Binary file modified ...ontrollerSnapshotTest/[email protected]
Binary file modified ...icalViewControllerSnapshotTest/[email protected]
Binary file modified ...tVerticalViewControllerSnapshotTest/[email protected]
Binary file modified ...ViewControllerSnapshotTest/[email protected]
Binary file modified ...ontrollerSnapshotTest/[email protected]
Binary file modified ...icalViewControllerSnapshotTest/[email protected]
Binary file modified ...ollerSnapshotTest/[email protected]
Binary file modified ...wControllerSnapshotTest/[email protected]
Binary file modified ...lViewControllerSnapshotTest/[email protected]
Binary file modified ...tSheetVerticalViewControllerSnapshotTest/[email protected]
Binary file modified ...tSheetVerticalViewControllerSnapshotTest/[email protected]
Binary file modified ...ewControllerSnapshotTests/[email protected]
Binary file modified ...PaymentMethodListViewControllerSnapshotTest/[email protected]
Binary file modified ...ViewSnapshotTests/[email protected]
Binary file modified ...tonsViewSnapshotTests/[email protected]
Binary file modified ...etButtonsViewSnapshotTests/[email protected]
Binary file modified ...nsViewSnapshotTests/[email protected]
Loading
Loading