Skip to content

elf0-fr/ScrollingLibraryUITest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to ScrollingLibraryUITest

This application is designed to test my Swift package’s UI (ScrollingLibrary) using XCUITest.

func testAutoScrollingByDefault() throws {
        searchField.firstMatch.typeText("07")
        app.buttons["07: Auto Scrolling"].tap()
        
        let carousel = app.scrollViews["carousel"]
        XCTAssert(carousel.waitForExistence(timeout: 3))
        
        let toggle = getSwitch(for: "toggle")
        #if !os(macOS)
        // Observation: checking for existence fails the next XCTAssert on macOS
        XCTAssert(toggle.waitForExistence(timeout: 3))
        #endif
        
        // Auto scrolling
        XCTAssert(carousel.otherElements["carouselElement_4"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        XCTAssert(carousel.otherElements["carouselElement_5"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        sleep(2)
        XCTAssert(carousel.otherElements["carouselElement_6"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        sleep(2)
        XCTAssert(carousel.otherElements["carouselElement_7"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        sleep(2)
        XCTAssert(carousel.otherElements["carouselElement_4"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        
        // Manual scrolling
        swipeLeft(carousel: carousel)
        swipeLeft(carousel: carousel)
        XCTAssert(carousel.otherElements["carouselElement_6"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        
        // Auto scrolling
        sleep(2)
        XCTAssert(carousel.otherElements["carouselElement_7"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        sleep(2)
        XCTAssert(carousel.otherElements["carouselElement_4"].wait(for: \.isHittable, toEqual: true, timeout: 3))
        
        // Auto scrolling disabled
        toggle.tap()
        sleep(3)
        XCTAssert(carousel.otherElements["carouselElement_4"].wait(for: \.isHittable, toEqual: true, timeout: 3))
    }

About

An application designed to test my ScrollingLibrary

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages