From 1d4666e79e0ad4a8d2b06551bc9383130acfb22b Mon Sep 17 00:00:00 2001 From: mahee96 <47920326+mahee96@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:52:31 +0530 Subject: [PATCH] UITests: fixes for iOS 26 compatibility --- AltStore.xcodeproj/project.pbxproj | 2 +- SideStore/Tests/UITests/UITests.swift | 76 +++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 7d3c5fd5..87cd9574 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -3527,7 +3527,7 @@ ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu17; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 26.0; + IPHONEOS_DEPLOYMENT_TARGET = 18.6; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)"; diff --git a/SideStore/Tests/UITests/UITests.swift b/SideStore/Tests/UITests/UITests.swift index 0cf187fb..97736ba6 100644 --- a/SideStore/Tests/UITests/UITests.swift +++ b/SideStore/Tests/UITests/UITests.swift @@ -19,7 +19,41 @@ final class UITests: XCTestCase { private static let APP_NAME = "SideStore" + func printAllMethods(of className: String) { + guard let cls: AnyClass = objc_getClass(className) as? AnyClass else { + print("Class \(className) not found") + return + } + + var methodCount: UInt32 = 0 + if let methodList = class_copyMethodList(cls, &methodCount) { + for i in 0.. 0 { appsSidestoreIoTextField.typeText("\n") // Fallback to newline so that soft kb is dismissed + _ = app.waitForExistence(timeout: 0.5) } let cellsQuery = collectionViewsQuery.cells @@ -318,17 +367,22 @@ private extension UITests { let app = XCUIApplication() app.tabBars["Tab Bar"].buttons["Sources"].tap() app.navigationBars["Sources"].buttons["Add"].tap() + _ = app.waitForExistence(timeout: 0.5) let collectionViewsQuery = app.collectionViews let appsSidestoreIoTextField = collectionViewsQuery.textFields["apps.sidestore.io"] _ = appsSidestoreIoTextField.exists || appsSidestoreIoTextField.waitForExistence(timeout: 5) + _ = app.waitForExistence(timeout: 0.5) appsSidestoreIoTextField.tap() appsSidestoreIoTextField.tap() _ = appsSidestoreIoTextField.exists || appsSidestoreIoTextField.waitForExistence(timeout: 5) collectionViewsQuery.staticTexts["Paste"].tap() + _ = app.waitForExistence(timeout: 0.5) + if app.keyboards.count > 0 { appsSidestoreIoTextField.typeText("\n") // Fallback to newline so that soft kb is dismissed + _ = app.waitForExistence(timeout: 0.5) } let cellsQuery = collectionViewsQuery.cells @@ -380,14 +434,24 @@ private extension UITests { .containing(.button, identifier: source.identifier) .children(matching: .button)[source.identifier] XCTAssert(sourceButton.exists || sourceButton.waitForExistence(timeout: 10), "Source preview for id: '\(source.alertTitle)' not found in the view") - + + _ = sourceButton.waitForExistence(timeout: 0.5) + // let addButton = sourceButton.children(matching: .button).firstMatch +// let addButton = sourceButton.descendants(matching: .button)["add"] +// XCTAssert(addButton.exists || addButton.waitForExistence(timeout: 0.3), " `+` button for id: '\(source.alertTitle)' not found in the preview container") +// addButton.tap() + let addButton = sourceButton.children(matching: .button)["add"] - XCTAssert(addButton.exists || addButton.waitForExistence(timeout: 0.3), " `+` button for id: '\(source.alertTitle)' not found in the preview container") - addButton.tap() + XCTAssert(addButton.waitForExistence(timeout: 1)) //TODO: fine tune down the value to make tests faster (but validate tests still works) +// addButton.tap() + + let coord = addButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)) + coord.tap() if source.requiresSwipe { sourceButton.swipeUp(velocity: .slow) // Swipe up if needed. + _ = sourceButton.waitForExistence(timeout: 0.1) } } } @@ -396,7 +460,8 @@ private extension UITests { // Navigate to the Sources screen and open the Add Source view. app.tabBars["Tab Bar"].buttons["Sources"].tap() app.navigationBars["Sources"].buttons["Add"].tap() - + _ = app.waitForExistence(timeout: 0.5) + let cellsQuery = app.collectionViews.cells // Data model for recommended sources. NOTE: This list order is required to be the same as that of "Add Source" Screen @@ -421,7 +486,8 @@ private extension UITests { // Navigate to the Sources screen and open the Add Source view. app.tabBars["Tab Bar"].buttons["Sources"].tap() app.navigationBars["Sources"].buttons["Add"].tap() - + _ = app.waitForExistence(timeout: 0.5) + let cellsQuery = app.collectionViews.cells // Data model for recommended sources. NOTE: This list order is required to be the same as that of "Add Source" Screen