Files
Rick d09d1b335a Removed support for Swift 5.7 and removed related Swift version checks (#6142)
* Remove M1 base image + test with installing simulator runtime on xcode 14.3.1

* Comment out other jobs for testing

* Added SnapshotTestingStub Package.swift for Swift 5.8 when running on CircleCI with Xcode 14.3.1

* Re-add rosetta step for iOS 13 simulators

* Fix compilation errors targeting iOS 13 because of SKTesting API not being available

* Reverting temporary commenting out CircleCI jobs

* Removed iOS 13 test support since it was only used for generating snapshots, which failed

* Removed M1 specific Mint dependency from CircleCI config

* Simplified CircleCI config by removing macos 12.6 executer since it's no longer used

* Remove last mention of old macos executor

* Removed the validate Package.swift file for Swift 5.7 build step

* Removed iOS 14 test from default build and run

* Removed support for Swift 5.7 and removed related Swift version checks
2026-01-28 08:21:24 +01:00

118 lines
3.6 KiB
Swift

//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// DebugViewSwiftUITests.swift
//
// Created by Nacho Soto on 6/12/23.
#if DEBUG && (os(iOS) || VISION_OS)
import Nimble
@testable import RevenueCat
import SwiftUI
import XCTest
@available(iOS 16.0, *)
class DebugViewSwiftUITests: TestCase {
override func setUp() async throws {
try await super.setUp()
try AvailabilityChecks.iOS16APIAvailableOrSkipTest()
}
@MainActor
func testLoadingState() {
self.snapshot(.init(), width: 300, height: 400)
}
@MainActor
func testDebugView() throws {
let model = DebugViewModel()
model.configuration = .loaded(.init(
sdkVersion: "4.20.0",
observerMode: false,
sandbox: true,
storeKit2Enabled: true,
locale: .init(identifier: "en_US"),
offlineCustomerInfoSupport: true,
verificationMode: "Enforced",
receiptURL: URL(string: "file://receipt")
))
model.diagnosticsResult = .loaded(.init(status: .healthy(warnings: [])))
model.customerInfo = .loaded(try Self.mockCustomerInfo)
model.currentAppUserID = "Nacho"
model.offerings = .loaded(.init(
offerings: [:],
currentOfferingID: nil,
placements: nil,
targeting: nil,
contents: .mockContents,
loadedFromDiskCache: false
))
self.snapshot(model, width: 450, height: 900)
}
}
@available(iOS 16.0, *)
private extension DebugViewSwiftUITests {
func snapshot(
_ model: DebugViewModel,
width: CGFloat,
height: CGFloat
) {
NavigationView {
DebugSummaryView(model: model)
}
.frame(width: width, height: height)
.snapshot(size: CGSize(width: width, height: height))
}
static var mockCustomerInfo: CustomerInfo {
get throws {
return try .init(
data: [
"request_date": "2023-08-16T10:30:42Z",
"subscriber": [
"subscriptions": [
"monthly_freetrial": [
"billing_issues_detected_at": nil,
"expires_date": "2019-07-26T23:50:40Z",
"is_sandbox": true,
"original_purchase_date": "2019-07-26T23:30:41Z",
"period_type": "normal",
"purchase_date": "2019-07-26T23:45:40Z",
"store": "app_store",
"unsubscribe_detected_at": nil
] as [String: Any?]
],
"non_subscriptions": [:] as [String: Any],
"entitlements": [
"pro": [
"product_identifier": "monthly_freetrial",
"expires_date": "2018-12-19T02:40:36Z",
"purchase_date": "2018-07-26T23:30:41Z"
]
],
"first_seen": "2023-07-17T00:05:54Z",
"original_app_user_id": "nacho2",
"other_purchases": [:] as [String: Any]
] as [String: Any]
]
)
}
}
}
#endif