~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/old-fella

Old people's social media app

0
1
main
29 lines · 1.2 KB Raw History
import XCTest

final class QuoteLoadingTests: XCTestCase {
    func testUncachedQuotedPostLoadsAtTopOfDetail() throws {
        try XCTSkipIf(UIDevice.current.userInterfaceIdiom == .pad, "Requires the iPhone tab layout")
        continueAfterFailure = false
        let app = XCUIApplication()
        app.launchArguments = [
            "-ui-testing", "-ui-testing-signed-in", "-ui-testing-rich-scroll", "-ui-testing-thread-delay"
        ]
        app.launch()

        let quote = app.buttons["quotedPostLink"].firstMatch
        for _ in 0..<5 {
            if quote.exists && quote.isHittable { break }
            app.swipeUp()
        }
        XCTAssertTrue(quote.waitForExistence(timeout: 10))
        quote.tap()

        let navigation = app.navigationBars["Post"]
        XCTAssertTrue(navigation.waitForExistence(timeout: 5))
        let loading = app.otherElements["postDetailLoading"].firstMatch
        XCTAssertTrue(loading.waitForExistence(timeout: 2))
        XCTAssertLessThan(loading.frame.minY - navigation.frame.maxY, 45)
        let quotedPost = "at://mae.example/app.bsky.feed.post/scroll-2-quote"
        XCTAssertTrue(app.buttons["postText-\(quotedPost)"].firstMatch.waitForExistence(timeout: 10))
    }
}