import InlineSnapshotTesting import TestCases import XCTest final class iOS16_17_OldPresentsNewTests: BaseIntegrationTests { @MainActor override func setUp() { super.setUp() self.app.buttons["iOS 16 + 17"].tap() self.app.buttons["Old presents new"].tap() self.clearLogs() // SnapshotTesting.isRecording = true } @MainActor func testBasics() { self.app.buttons["Increment"].tap() XCTAssertEqual(self.app.staticTexts["1"].exists, true) self.assertLogs { """ OldPresentsNewTestCase.body ViewStore.deinit ViewStore.init WithViewStore.body """ } } // TODO: Flakey test @MainActor func testPresentChild_NotObservingChildCount() { self.app.buttons["Present child"].tap() self.assertLogs { """ ObservableBasicsView.body OldPresentsNewTestCase.body StoreOf.init StoreOf.init StoreOf.init StoreOf.init StoreOf.init ViewStore.deinit ViewStore.init ViewStoreOf.deinit ViewStoreOf.init ViewStoreOf.init WithViewStore.body WithViewStoreOf.body """ } } // TODO: Flakey test @MainActor func testDismissChild_NotObservingChildCount() { self.app.buttons["Present child"].tap() self.clearLogs() self.app.buttons["Dismiss"].tap() self.assertLogs { """ OldPresentsNewTestCase.body StoreOf.deinit StoreOf.deinit ViewStore.deinit ViewStore.init ViewStoreOf.deinit WithViewStore.body """ } } @MainActor func testObserveChildCount() { self.app.buttons["Toggle observe child count"].tap() XCTAssertEqual(self.app.staticTexts["Child count: N/A"].exists, true) self.assertLogs { """ OldPresentsNewTestCase.body ViewStore.deinit ViewStore.init WithViewStore.body """ } } // TODO: Flakey test @MainActor func testPresentChild_ObservingChildCount() { self.app.buttons["Toggle observe child count"].tap() self.clearLogs() self.app.buttons["Present child"].tap() self.assertLogs { """ ObservableBasicsView.body OldPresentsNewTestCase.body StoreOf.init StoreOf.init StoreOf.init StoreOf.init StoreOf.init ViewStore.deinit ViewStore.init ViewStoreOf.deinit ViewStoreOf.init ViewStoreOf.init WithViewStore.body WithViewStoreOf.body """ } } @MainActor func testIncrementChild_ObservingChildCount() { self.app.buttons["Toggle observe child count"].tap() self.app.buttons["Present child"].tap() self.clearLogs() self.app.buttons.matching(identifier: "Increment").element(boundBy: 0).tap() XCTAssertEqual(self.app.staticTexts["1"].exists, true) XCTAssertEqual(self.app.staticTexts["Child count: 1"].exists, true) self.assertLogs { """ ObservableBasicsView.body OldPresentsNewTestCase.body ViewStore.deinit ViewStore.init WithViewStore.body """ } } // TODO: Flakey test @MainActor func testDismissChild_ObservingChildCount() { self.app.buttons["Toggle observe child count"].tap() self.app.buttons["Present child"].tap() self.clearLogs() self.app.buttons["Dismiss"].tap() self.assertLogs { """ OldPresentsNewTestCase.body StoreOf.deinit StoreOf.deinit ViewStore.deinit ViewStore.init ViewStoreOf.deinit WithViewStore.body """ } } @MainActor func testDeinit() { self.app.buttons["Toggle observe child count"].tap() self.app.buttons["Present child"].tap() self.app.buttons.matching(identifier: "Increment").element(boundBy: 0).tap() self.app.buttons["Dismiss"].tap() self.clearLogs() self.app.buttons["iOS 16 + 17"].tap() self.assertLogs { """ PresentationStoreOf.deinit Store.deinit Store.deinit ViewPresentationStoreOf.deinit ViewStore.deinit """ } } }