Skip to content

bootuz/Swift-UITesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift UITesting

A Playwright-flavored wrapper over Apple's XCUITest. Swift-native, all-sync, Swift 6 ready.

import UITesting

struct LibraryScreen: Screen {
    let driver: any Driver

    var addButton: Locator<Button>     { button(A11y.Library.addButton) }
    var nameField: Locator<TextField>  { textField(A11y.Library.inlineFormNameField) }
    var saveButton: Locator<Button>    { button(A11y.Library.inlineFormSaveButton) }

    func deckCell(named name: String) -> Locator<AnyElement> {
        locator(accID: A11y.Library.deckCell(name), of: AnyElement.self)
    }
}
import UITesting

final class CreateDeckFlowTests: UITestingTestCase {
    func test_createDeck_appearsInLibrary() throws {
        app.launch()

        let library = LibraryScreen(driver: driver)
        try library.addButton.tap()
        try library.nameField.typeText("FlowTest Deck")
        try library.saveButton.tap()

        try expect(library.deckCell(named: "FlowTest Deck")).toBeVisible()
    }
}

What you get over raw XCUITest

  • Lazy locatorsLocator<Button> is a description, not a snapshot. Re-resolves on every action.
  • Auto-waiting actions and assertions — no more assertExists().tap() everywhere.
  • Compile-time type safetyscreen.text("Saved").tap() is a compile error.
  • Structured failure messages with optional diagnostic mode that suggests likely test ID typos.

License

MIT

About

A Playwright-flavored wrapper over Apple's XCUITest. Swift-native, all-sync, Swift 6 ready.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages